Package org.mozilla.javascript

Examples of org.mozilla.javascript.ScriptableObject$Slot


      this.slot.init(var1.xOld, var1.yOld, var1.zOld).remove(var1);
      this.all.remove(var1);
   }

   public void moved(Entity var1) {
      BlockMap$Slot var2 = this.slot.init(var1.xOld, var1.yOld, var1.zOld);
      BlockMap$Slot var3 = this.slot2.init(var1.x, var1.y, var1.z);
      if(!var2.equals(var3)) {
         var2.remove(var1);
         var3.add(var1);
         var1.xOld = var1.x;
         var1.yOld = var1.y;
         var1.zOld = var1.z;
      }
   }
View Full Code Here


      this.tmp.clear();
      return this.getEntities(var1, var2, var3, var4, var5, var6, var7, this.tmp);
   }

   public List getEntities(Entity var1, float var2, float var3, float var4, float var5, float var6, float var7, List var8) {
      BlockMap$Slot var9 = this.slot.init(var2, var3, var4);
      BlockMap$Slot var10 = this.slot2.init(var5, var6, var7);

      for(int var11 = BlockMap$Slot.getXSlot(var9) - 1; var11 <= BlockMap$Slot.getXSlot(var10) + 1; ++var11) {
         for(int var12 = BlockMap$Slot.getYSlot(var9) - 1; var12 <= BlockMap$Slot.getYSlot(var10) + 1; ++var12) {
            for(int var13 = BlockMap$Slot.getZSlot(var9) - 1; var13 <= BlockMap$Slot.getZSlot(var10) + 1; ++var13) {
               if(var11 >= 0 && var12 >= 0 && var13 >= 0 && var11 < this.width && var12 < this.depth && var13 < this.height) {
View Full Code Here

        String lowerCaseName = prototype.getLowerCaseName();

        TypeInfo type = (TypeInfo) prototypes.get(lowerCaseName);

        // check if the prototype info exists already
        ScriptableObject op = (type == null) ? null : type.objProto;

        // if prototype info doesn't exist (i.e. is a standard prototype
        // built by HopExtension), create it.
        if (op == null) {
            if ("global".equals(lowerCaseName)) {
                op = global;
            } else if ("hopobject".equals(lowerCaseName)) {
                op = hopObjectProto;
            } else {
                op = new HopObject(name, this);
            }
            type = registerPrototype(prototype, op);
        }

        // Register a constructor for all types except global.
        // This will first create a new prototyped HopObject and then calls
        // the actual (scripted) constructor on it.
        if (!"global".equals(lowerCaseName)) {
            try {
                new HopObjectCtor(name, this, op);
                op.setParentScope(global);
            } catch (Exception x) {
                app.logError("Error adding ctor for " + name,  x);
            }
        }
View Full Code Here

        return new FileObject(args[0].toString(), args[1].toString());
    }

    public static void init(Scriptable scope) {
        Method[] methods = FileObject.class.getDeclaredMethods();
        ScriptableObject proto = new FileObject();
        proto.setPrototype(getObjectPrototype(scope));
        Member ctorMember = null;
        for (int i=0; i<methods.length; i++) {
            if ("fileObjCtor".equals(methods[i].getName())) {
                ctorMember = methods[i];
                break;
            }
        }
        FunctionObject ctor = new FunctionObject("File", ctorMember, scope);
        ctor.addAsConstructor(scope, proto);
        String[] fileFuncs = {
                                "toString",
                                "getName",
                                "getParent",
                                "isAbsolute",
                                "write",
                                "remove",
                                "list",
                                "flush",
                                "writeln",
                                "close",
                                "getPath",
                                "open",
                                "error",
                                "canRead",
                                "canWrite",
                                "exists",
                                "getAbsolutePath",
                                "getLength",
                                "isDirectory",
                                "isFile",
                                "lastModified",
                                "mkdir",
                                "renameTo",
                                "eof",
                                "isOpened",
                                "readln",
                                "clearError",
                                "readAll"
                               };
        try {
            proto.defineFunctionProperties(fileFuncs, FileObject.class, 0);
        } catch (Exception ignore) {
            System.err.println ("Error defining function properties: "+ignore);
        }
    }
View Full Code Here

        return new FtpObject(args[0].toString());
    }

    public static void init(Scriptable scope) {
        Method[] methods = FtpObject.class.getDeclaredMethods();
        ScriptableObject proto = new FtpObject();
        proto.setPrototype(getObjectPrototype(scope));
        Member ctorMember = null;
        for (int i=0; i<methods.length; i++) {
            if ("ftpObjCtor".equals(methods[i].getName())) {
                ctorMember = methods[i];
                break;
            }
        }
        FunctionObject ctor = new FunctionObject("FtpClient", ctorMember, scope);
        ctor.addAsConstructor(scope, proto);
        String[] ftpFuncs = {
                "login", "cd", "mkdir", "lcd", "putFile",
                "putString", "getFile", "getString", "logout",
                "binary", "ascii"
                            };
        try {
            proto.defineFunctionProperties(ftpFuncs, FtpObject.class, 0);
        } catch (Exception ignore) {
            System.err.println ("Error defining function properties: "+ignore);
        }
    }
View Full Code Here

  /** Execute supplied code against supplied data,
   *   see JavascriptEngineTest for examples */
  public String execute(String code, String jsonData) throws IOException {
        final String jsCode = "data=" + jsonData + ";\n" + code;
        final Context rhinoContext = Context.enter();
        final ScriptableObject scope = rhinoContext.initStandardObjects();

        // execute the script, out script variable maps to sw
        final StringWriter sw = new StringWriter();
        final PrintWriter pw = new PrintWriter(sw, true);
        ScriptableObject.putProperty(scope, "out", Context.javaToJS(pw, scope));
View Full Code Here

        out = System.out;
      else if (sel.equals("System.err"))
        out = System.err;
      Object simStatus = app.find(myUi, "simStatus");
      try {
        ScriptableObject scope = cx.initStandardObjects();
        cx.evaluateString(scope, script, "<cmd>", 1, null);
        if (similarity != null) similarity.destroy();
        similarity = new CustomSimilarity(cx, scope, out);
        app.setCustomSimilarity(similarity);
        app.setString(simStatus, "text", "OK");
View Full Code Here

   * @throws WinkBuildException
   */
  private static void executeJs(final String filename) throws WinkBuildException {
    final Context cx = Context.enter();
    cx.setOptimizationLevel(-1);
    final ScriptableObject scope = cx.initStandardObjects();

    final String fileToInspect = new String(filename);
    boolean goodExecution = false;
    try {
      final Reader buildFile = new FileReader(new File(fileToInspect));
View Full Code Here

      Constants.fileInMemory = Boolean.valueOf(getProperty(Constants.OPTION_FILE_IN_MEMORY));
    }

    final Context cx = Context.enter();
    cx.setOptimizationLevel(-1);
    final ScriptableObject scope = cx.initStandardObjects();

    putFunctions(cx, scope);
    putConf(cx, scope);

    final String mainFile = getProperty(Constants.JS_PATH) + File.separator + getProperty(Constants.JS_MAIN_FILE);
View Full Code Here

        childList.add(childList.size(), text);
    }

    protected void postRenderView() throws Exception {
        ScriptableObject scriptableObject =
                (ScriptableObject) this.page.executeJavaScript("window.LOG").getJavaScriptResult();

        scriptableObject.defineProperty("out", systemOut, ScriptableObject.READONLY);
    }
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.ScriptableObject$Slot

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.