Examples of ExpressionValue


Examples of org.encog.ml.prg.expvalue.ExpressionValue

        String str = tok.nextToken().trim();
        int idx = str.indexOf('#');
        if( idx!=-1) {
          int enumType = Integer.parseInt(str.substring(0,idx));
          int enumVal = Integer.parseInt(str.substring(idx+1));
          node.getData()[0] = new ExpressionValue(enumType,enumVal);
         
        }
        // is it boolean?
        else if( str.length()==1 && "tf".indexOf(Character.toLowerCase(str.charAt(0)))!=-1 ) {
          node.getData()[i] = new ExpressionValue(str.equalsIgnoreCase("t"));
        }
        // is it a string?
        else if( str.charAt(0)=='\"' ) {
          node.getData()[i] = new ExpressionValue(str.substring(1,str.length()-1));
        }
        // is it an integer
        else if( str.indexOf('.')==-1 && str.toLowerCase().indexOf('e')==-1) {
          long l;
          try {
            l = Long.parseLong(str);
          } catch(NumberFormatException ex) {
            // sometimes Java will output a long value that is larger than can be parsed
            // this is very likely not a useful genome and we just set it to zero so that
            // the population load does not fail.
            l=0;
          }
          node.getData()[i] = new ExpressionValue(l);
        }
        // At this point, must be a float
        else {
          node.getData()[i] = new ExpressionValue(CSVFormat.EG_FORMAT.parse(str));
        }
      }
    }
   
    return this.nodeStack.pop();
View Full Code Here

Examples of org.quorum.execution.ExpressionValue

        if(array != null) { //something is very wrong, since the object clearly exists
            for(int i = 0; i < array.getSize(); i++) {
                ArrayChild child = new ArrayChild();
                child.index = i;
                ExpressionValue value = array.get(i);
                if(value != null && !value.isNull()) {
                    int hash = value.getObjectHash();
                    RuntimeObject arrayChild = data.getObject(hash);
                    child.object = arrayChild;
                }
                kids.add(child);
            }
View Full Code Here

Examples of org.quorum.execution.ExpressionValue

        }
        else if(parent instanceof DataObject) {
            DataObject d = (DataObject) parent;
            String name = d.getName();

            ExpressionValue value = d.getCurrentValue();
            if(value == null){
                value = data.getLocalScope().getVariable(name);
            }
            if(value != null && value.getType() != null && !value.getType().isPrimitiveType()) {
                if(!value.isNull()) { //it's a legal object
                    //request the object of that hash number from the
                    //data environment
                    int hash = value.getObjectHash();
                    RuntimeObject object = data.getObject(hash);

                    if(object != null && object.hasParents()) {
                        InheritanceNode node = new InheritanceNode();
                        node.child = object;
                        kids.add(node);
                    }

                    if(object != null) {
                        Iterator<DataObject> obs = object.getLocalVariables();
                        while(obs.hasNext()) {
                            kids.add(obs.next());
                        }

                        addArrayChildren(kids, object);
                    }
                }
            }


        }
        else if (parent instanceof InheritanceNode){ //an object with parents
            InheritanceNode node = (InheritanceNode) parent;
            RuntimeObject child = node.child;
            Iterator<RuntimeObject> ros = child.getParents();
            while(ros.hasNext()) {
                kids.add(ros.next());
            }
        }
        else if (parent instanceof RuntimeObject){ //a parent of an object
            RuntimeObject node = (RuntimeObject) parent;
            if(node.hasLocalVariables()) {//if it has variables, display them
                Iterator<DataObject> vars = node.getLocalVariables();
                while(vars.hasNext()) {
                    ChildNode cn = new ChildNode();
                    cn.scope = node;
                    cn.data = vars.next();
                    kids.add(cn);
                }
            }
        }
        else if (parent instanceof ThisObject){ //a parent of an object
            ThisObject th = (ThisObject)parent;
            RuntimeObject node = th.myThis;
            if(node.hasLocalVariables()) {//if it has variables, display them
                Iterator<DataObject> vars = node.getLocalVariables();
                while(vars.hasNext()) {
                    ChildNode cn = new ChildNode();
                    cn.scope = node;
                    cn.data = vars.next();
                    kids.add(cn);
                }
            }
        }
        else if (parent instanceof ChildNode){ //a parent of an object
            ChildNode n = (ChildNode) parent;
            DataObject d = n.data;
            String name = d.getName();

            ExpressionValue value = n.scope.getVariable(name);
            if(value != null && value.getType() != null && !value.getType().isPrimitiveType()) {
                if(!value.isNull()) { //it's a legal object
                    //request the object of that hash number from the
                    //data environment
                    int hash = value.getObjectHash();
                    RuntimeObject object = data.getObject(hash);

                    if(object.hasParents()) {
                        InheritanceNode node = new InheritanceNode();
                        node.child = object;
View Full Code Here

Examples of org.quorum.execution.ExpressionValue

        }
        else if(node instanceof DataObject) {
            DataObject d = (DataObject) node;
            String name = d.getName();

            ExpressionValue value = data.getLocalScope().getVariable(name);
            if(value != null && value.getType() != null && !value.getType().isPrimitiveType()) {
                if(!value.isNull()) { //it's a legal object
                    //request the object of that hash number from the
                    //data environment
                    int hash = value.getObjectHash();
                    RuntimeObject object = data.getObject(hash);
                    int vars = object.getNumberLocalVariables() + object.getNumberParents();
                    return vars;
                }
            }
        }
        else if (node instanceof InheritanceNode){ //an object with parents
            InheritanceNode n = (InheritanceNode) node;
            return n.child.getNumberParents();
        }
        else if (node instanceof RuntimeObject){ //a parent of an object
            return ((RuntimeObject)node).getNumberLocalVariables(); //don't add parents, as they are flattened in the child, not stored here
        }
        else if (node instanceof ThisObject){ //a parent of an object
            return ((ThisObject)node).myThis.getNumberLocalVariables(); //don't add parents, as they are flattened in the child, not stored here
        }
        else if (node instanceof ChildNode){ //a parent of an object
            ChildNode n = (ChildNode) node;
            DataObject d = n.data;
            String name = d.getName();

            ExpressionValue value = n.scope.getVariable(name);
            if(value != null && value.getType() != null && !value.getType().isPrimitiveType()) {
                if(!value.isNull()) { //it's a legal object
                    //request the object of that hash number from the
                    //data environment
                    int hash = value.getObjectHash();
                    RuntimeObject object = data.getObject(hash);
                    int vars = object.getNumberLocalVariables() + object.getNumberParents();
                    return vars;
                }
            }
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.