Examples of GlobalVariable


Examples of client.net.sf.saxon.ce.expr.instruct.GlobalVariable

        }

        if (!redundant) {
            GeneralVariable inst;
            if (global) {
                inst = new GlobalVariable();
                ((GlobalVariable)inst).setExecutable(getExecutable());
                if (select != null) {
                    select.setContainer(((GlobalVariable)inst));
                }
                initializeInstruction(exec, decl, inst);
View Full Code Here

Examples of cn.wensiqun.asmsupport.definition.variable.GlobalVariable

     * add
     * @param field
     */
    public void addGlobalVariableEntity(GlobalVariableEntity e) {
        if (ModifierUtils.isStatic(e.getModifiers())) {
          getGlobalVariables().add(new GlobalVariable(e.getOwner(), e));
        } else {
          getGlobalVariables().add(new GlobalVariable(getThisVariable(), e));
        }
    }
View Full Code Here

Examples of cn.wensiqun.asmsupport.definition.variable.GlobalVariable

        return me;
    }*/

    @Override
    public GlobalVariable getGlobalVariable(String name) {
      GlobalVariable gv = super.getGlobalVariable(name);
      if(gv != null){
        return gv;
      }
     
        Class<?> fieldOwner = reallyClass;
        Field f = null;
        for(;fieldOwner!=null ;fieldOwner = fieldOwner.getSuperclass()){
            try {
                f = fieldOwner.getDeclaredField(name);
                break;
            } catch (NoSuchFieldException e) {
            }
        }
       
        if(f == null){
            throw new ASMSupportException("no such field exception : " + name);
        }
       
        if(!ModifierUtils.isStatic(f.getModifiers())){
            throw new ASMSupportException("the field \"" + f.getName() + "\" is non-static, cannot use current method!");
        }
       
        return new GlobalVariable(fieldOwner.equals(reallyClass) ? this : AClassFactory.getProductClass(fieldOwner),
            AClassFactory.getProductClass(f.getType()), f.getModifiers(), name);
    }
View Full Code Here

Examples of cn.wensiqun.asmsupport.definition.variable.GlobalVariable

        return chooser.chooseMethod();
    }*/

    @Override
    public GlobalVariable getGlobalVariable(String name) {
      GlobalVariable gv = super.getGlobalVariable(name);
      if(gv != null){
          return gv;
        }
       
        Class<?> fieldOwner = superClass;
        Field f = null;
        for(;!fieldOwner.equals(Object.class;fieldOwner = fieldOwner.getSuperclass()){
            try {
                f = fieldOwner.getDeclaredField(name);
            } catch (NoSuchFieldException e) {
            }
        }
       
        if(f == null){
            throw new ASMSupportException("no such field exception : " + name);
        }
       
        return new GlobalVariable(AClassFactory.getProductClass(fieldOwner),
                new ProductClass(f.getType()), 0, name);
    }
View Full Code Here

Examples of cn.wensiqun.asmsupport.definition.variable.GlobalVariable

  @Override
  public void newEnum(String name, Parameterized... argus){
        if(!ModifierUtils.isEnum(getMethodOwner().getModifiers())){
          throw new IllegalArgumentException("cannot create an enum constant cause by current class is not enum type");
        }
        GlobalVariable constant = getMethodOwner().getGlobalVariable(name);
        if(!ModifierUtils.isEnum(constant.getGlobalVariableEntity().getModifiers())){
          throw new IllegalArgumentException("cannot new an enum instant assign to non-enum type variable");
        }
        enumArgumentsList.add(new EnumConstructorInfo(name, argus));
    }
View Full Code Here

Examples of cn.wensiqun.asmsupport.definition.variable.GlobalVariable

    if(getMethodOwner().getEnumNum() != enumArgumentsList.size()){
      throw new ASMSupportException("exist unassign enum constant!");
    }
   
    Parameterized[] values = new Parameterized[getMethodOwner().getEnumNum()];
    GlobalVariable enumConstant;
    int i = 0;
    for(EnumConstructorInfo enumArgu : enumArgumentsList){
      enumConstant = getMethodOwner().getGlobalVariable(enumArgu.name);
     
      values[i] = enumConstant;
      String enumName = enumArgu.name;
      Parameterized[] otherArgus = enumArgu.argus;
          Parameterized[] enumArgus = new Parameterized[otherArgus.length + 2];
          enumArgus[0] = Value.value(enumName);
          enumArgus[1] = Value.value(i);
          System.arraycopy(otherArgus, 0, enumArgus, 2, otherArgus.length);
         
          MethodInvoker mi = invokeConstructor(getMethodOwner(), enumArgus);
          assign(enumConstant, mi);
          i++;
    }
   
    GlobalVariable gv = getMethodOwner().getGlobalVariable("ENUM$VALUES");
   
    ArrayValue av = newArrayWithValue(AClassFactory.getArrayClass(getMethodOwner(), 1), values);
    assign(gv, av);
  }
View Full Code Here

Examples of net.sf.saxon.instruct.GlobalVariable

        }
        HashMap map = executable.getCompiledGlobalVariables();
        if (map != null) {
            Iterator iter = map.values().iterator();
            while (iter.hasNext()) {
                GlobalVariable var = (GlobalVariable)iter.next();
                Expression select = var.getSelectExpression();
                select.addToPathMap(pathMap, null);
            }
        }
        return pathMap;
    }
View Full Code Here

Examples of net.sf.saxon.instruct.GlobalVariable

        }
        HashMap map = executable.getCompiledGlobalVariables();
        if (map != null) {
            Iterator iter = map.values().iterator();
            while (iter.hasNext()) {
                GlobalVariable var = (GlobalVariable)iter.next();
                Expression select = var.getSelectExpression();
                if (select != null && ExpressionTool.dependsOnFocus(select)) {
                    return true;
                }
            }
        }
View Full Code Here

Examples of net.sf.saxon.instruct.GlobalVariable

                throw new XPathException("The supplied context item does not match the required context item type");
            }
            // Now check it against the required type defined in the query prolog
            StructuredQName varQName = executable.getInitialContextItemVariableName();
            if (varQName != null) {
                GlobalVariable var = executable.getGlobalVariable(varQName);
                if (var == null) {
                    throw new IllegalStateException("Context item variable not found in executable");
                }
                controller.setParameter(varQName, contextItem);
                try {
                    // do early evaluation to force the type-checking of the context item
                    controller.getBindery().useGlobalParameter(
                            varQName, var.getSlotNumber(), var.getRequiredType(), context);
                } catch (XPathException err) {
                    err.maybeSetLocation(var);
                    if (!err.hasBeenReported()) {
                        try {
                            controller.getErrorListener().fatalError(err);
                        } catch (TransformerException e) {
                            // no action
                        }
                    }
                    throw err;
                }
            }
            UnfailingIterator single = SingletonIterator.makeIterator(contextItem);
            single.next();
            context.setCurrentIterator(single);
            controller.setInitialContextItem(contextItem);
        } else {
            // there might be a default value for the context item
            StructuredQName varQName = executable.getInitialContextItemVariableName();
            if (varQName != null) {
                GlobalVariable var = executable.getGlobalVariable(varQName);
                if (var == null) {
                    throw new IllegalStateException("Context item variable not found in executable");
                }
                try {
                    // do early evaluation to force the type-checking of the context item
                    controller.getBindery().useGlobalParameter(varQName, var.getSlotNumber(), var.getRequiredType(), context);
                } catch (XPathException err) {
                    err.maybeSetLocation(var);
                    if (!err.hasBeenReported()) {
                        try {
                            controller.getErrorListener().fatalError(err);
                        } catch (TransformerException e) {
                            // no action
                        }
                    }
                    throw err;
                }
                ValueRepresentation val = var.getSelectValue(context);
                contextItem = Value.asItem(val);
                UnfailingIterator single = SingletonIterator.makeIterator(contextItem);
                single.next();
                context.setCurrentIterator(single);
                controller.setInitialContextItem(contextItem);
View Full Code Here

Examples of net.sf.saxon.instruct.GlobalVariable

        }

        if (!redundant) {
            GeneralVariable inst;
            if (global) {
                inst = new GlobalVariable();
                ((GlobalVariable)inst).setExecutable(getExecutable());
                if (select != null) {
                    select.setContainer(((GlobalVariable)inst));
                }
                initializeInstruction(exec, inst);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.