Package ioke.lang

Examples of ioke.lang.Runtime


        return 0;
    }

    public static char charInvocation(IokeJavaIntegrated object, Object[] args, String name) {
        IokeObject pr = object.__get_IokeProxy();
        Runtime runtime = object.__get_IokeRuntime();
        Message newMessage = new Message(runtime, name);
        for(Object arg : args) {
            newMessage.getArguments(null).add(runtime.createMessage(Message.wrap(arg, runtime)));
        }

        try {
            IokeObject msg = runtime.createMessage(newMessage);
            Object result = Interpreter.send(msg, runtime.ground, pr);
            if(result instanceof Character) {
                return Character.valueOf((Character)result);
            } else if(result instanceof IokeObject && IokeObject.data(result) instanceof JavaWrapper && JavaWrapper.getObject(result) instanceof Character) {
                return Character.valueOf((Character)JavaWrapper.getObject(result));
View Full Code Here


        return 0;
    }

    public static boolean booleanInvocation(IokeJavaIntegrated object, Object[] args, String name) {
        IokeObject pr = object.__get_IokeProxy();
        Runtime runtime = object.__get_IokeRuntime();
        Message newMessage = new Message(runtime, name);
        for(Object arg : args) {
            newMessage.getArguments(null).add(runtime.createMessage(Message.wrap(arg, runtime)));
        }

        try {
            IokeObject msg = runtime.createMessage(newMessage);
            Object result = Interpreter.send(msg, runtime.ground, pr);
            if(result instanceof Boolean) {
                return Boolean.valueOf((Boolean)result);
            } else if(result instanceof IokeObject && IokeObject.data(result) instanceof JavaWrapper && JavaWrapper.getObject(result) instanceof Boolean) {
                return Boolean.valueOf((Boolean)JavaWrapper.getObject(result));
View Full Code Here

        return false;
    }

    public static long longInvocation(IokeJavaIntegrated object, Object[] args, String name) {
        IokeObject pr = object.__get_IokeProxy();
        Runtime runtime = object.__get_IokeRuntime();
        Message newMessage = new Message(runtime, name);
        for(Object arg : args) {
            newMessage.getArguments(null).add(runtime.createMessage(Message.wrap(arg, runtime)));
        }

        try {
            IokeObject msg = runtime.createMessage(newMessage);
            Object result = Interpreter.send(msg, runtime.ground, pr);
            if(result instanceof Long) {
                return Long.valueOf((Long)result);
            } else if(result instanceof IokeObject && IokeObject.data(result) instanceof JavaWrapper && JavaWrapper.getObject(result) instanceof Long) {
                return Long.valueOf((Integer)JavaWrapper.getObject(result));
View Full Code Here

        return 0;
    }

    public static float floatInvocation(IokeJavaIntegrated object, Object[] args, String name) {
        IokeObject pr = object.__get_IokeProxy();
        Runtime runtime = object.__get_IokeRuntime();
        Message newMessage = new Message(runtime, name);
        for(Object arg : args) {
            newMessage.getArguments(null).add(runtime.createMessage(Message.wrap(arg, runtime)));
        }

        try {
            IokeObject msg = runtime.createMessage(newMessage);
            Object result = Interpreter.send(msg, runtime.ground, pr);

            if(result instanceof Float) {
                return Float.valueOf((Float)result);
            } else if(result instanceof IokeObject && IokeObject.data(result) instanceof JavaWrapper && JavaWrapper.getObject(result) instanceof Float) {
View Full Code Here

        return 0F;
    }

    public static double doubleInvocation(IokeJavaIntegrated object, Object[] args, String name) {
        IokeObject pr = object.__get_IokeProxy();
        Runtime runtime = object.__get_IokeRuntime();
        Message newMessage = new Message(runtime, name);
        for(Object arg : args) {
            newMessage.getArguments(null).add(runtime.createMessage(Message.wrap(arg, runtime)));
        }

        try {
            IokeObject msg = runtime.createMessage(newMessage);
            Object result = Interpreter.send(msg, runtime.ground, pr);

            if(result instanceof Double) {
                return Double.valueOf((Double)result);
            } else if(result instanceof IokeObject && IokeObject.data(result) instanceof JavaWrapper && JavaWrapper.getObject(result) instanceof Double) {
View Full Code Here

        return 0D;
    }

    public static Object objectInvocation(IokeJavaIntegrated object, Object[] args, String name, Class expectedType) {
        IokeObject pr = object.__get_IokeProxy();
        Runtime runtime = object.__get_IokeRuntime();

        Message newMessage = new Message(runtime, name);
        for(Object arg : args) {
            newMessage.getArguments(null).add(runtime.createMessage(Message.wrap(arg, runtime)));
        }

        try {
            IokeObject msg = runtime.createMessage(newMessage);
            return tryConvertTo(Interpreter.send(msg, runtime.ground, pr), expectedType, runtime);
        } catch(Throwable e) {
            return null;
        }
    }
View Full Code Here

        Benchmark.init(bm);
        return bm;
    }

    public static void init(IokeObject bm) throws ControlFlow {
        Runtime runtime = bm.runtime;
        bm.setKind("Benchmark");
        runtime.ground.setCell("Benchmark", bm);
        bm.singleMimicsWithoutCheck(runtime.origin);

        bm.registerMethod(runtime.newNativeMethod("expects two optional numbers, x (default 10) and y (default 1), and a block of code to run, and will run benchmark this block x times, while looping y times in each benchmark. after each loop will print the timings for this loop", new NativeMethod("report") {
                private final DefaultArgumentsDefinition ARGUMENTS = DefaultArgumentsDefinition
                    .builder()
                    .withOptionalPositional("repetitions", "10")
                    .withOptionalPositional("loops", "1")
                    .withRequiredPositionalUnevaluated("code")
View Full Code Here

TOP

Related Classes of ioke.lang.Runtime

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.