Package org.quorum.execution

Examples of org.quorum.execution.DataObject


                    kids.add(obs.next());
                }
            }
        }
        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
View Full Code Here


                return false;
            }
        }

        if(node instanceof DataObject) {
            DataObject d = (DataObject) node;
            boolean primitive = d.getCurrentValue().getType().isPrimitiveType();
            if(primitive) {
                return true;
            }
            else {
                return false;
            }
        }

        else if (node instanceof InheritanceNode){ //an object with parents
            return false;
        }
        else if (node instanceof RuntimeObject){ //a parent of an object
            return !((RuntimeObject)node).hasLocalVariables(); //this should NOT be node.hasParents()
                          //as parents are flattened in child references
                          //In other words, parents of children cached in a
                          //runtime object do not store additional references
        }
        else if (node instanceof ThisObject){ //a parent of an object
            return !((ThisObject)node).myThis.hasLocalVariables(); //this should NOT be node.hasParents()
                          //as parents are flattened in child references
                          //In other words, parents of children cached in a
                          //runtime object do not store additional references
        }
        else if (node instanceof ChildNode){ //a parent of an object
            ChildNode n = (ChildNode) node;
            DataObject d = n.data;
            boolean primitive = d.getCurrentValue().getType().isPrimitiveType();
            if(primitive) {
                return true;
            }
            else {
                return false;
View Full Code Here

            if(s.compareTo(QUORUM_ROOT)==0) {
                return data.getLocalScope().getNumberLocalVariables() + 1; //save space for "This"
            }
        }
        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
View Full Code Here

        listeners.remove(l);
    }

    public String getDisplayName(Object node) throws UnknownTypeException {
        if(node instanceof DataObject) {
            DataObject d = (DataObject) node;
            return d.getName();
        }
        else if (node instanceof InheritanceNode){ //an object with parents
            return "inherited";
        }
        else if (node instanceof RuntimeObject){ //a parent of an object
View Full Code Here

        return LOCAL_VARIABLE_IMAGE;
    }

    public String getShortDescription(Object node) throws UnknownTypeException {
        if(node instanceof DataObject) {
            DataObject d = (DataObject) node;
            return d.getName() + ", " + d.getCurrentValue().getType().toString() +
                    ", " + d.getCurrentValue().toString();
        }
        else if (node instanceof InheritanceNode){ //an object with parents
            return "inherited";
        }
        else if (node instanceof RuntimeObject){ //a parent of an object
            return "An object";
        }
        else if (node instanceof ThisObject){ //a parent of an object
            return "The reference to me";
        }
        else if (node instanceof ChildNode){ //a parent of an object
            DataObject d = ((ChildNode) node).data;
            return d.getName() + ", " + d.getCurrentValue().getType().toString() +
                    ", " + d.getCurrentValue().toString();
        }
        else if(node instanceof ArrayChild) {
            return "Array value";
        }
        return "";
View Full Code Here

        return "";
    }

    public Object getValueAt(Object node, String columnID) throws UnknownTypeException {
        if(node instanceof DataObject) {
            DataObject d = (DataObject) node;
            if(columnID.compareTo(TYPE) == 0) {
                return d.getCurrentValue().getType().toString();
            }
            if(columnID.compareTo(VALUE) == 0) {
                return d.getCurrentValue().toString();
            }
        }
        else if (node instanceof InheritanceNode){ //an object with parents
            return "";
        }
        else if(node instanceof RuntimeObject) { //a parent
            RuntimeObject ro = (RuntimeObject) node;
            if(columnID.compareTo(TYPE) == 0) {
                return ro.getClazz().getStaticKey();
            }
            if(columnID.compareTo(VALUE) == 0) {
                return "";
            }
        }
        else if(node instanceof ThisObject) { //a parent
            RuntimeObject ro = ((ThisObject) node).myThis;
            if(columnID.compareTo(TYPE) == 0) {
                return ro.getClazz().getStaticKey();
            }
            if(columnID.compareTo(VALUE) == 0) {
                return "#" + ro.getHashKey();
            }
        }
        else if(node instanceof ChildNode) {
            DataObject d = ((ChildNode) node).data;
            if(columnID.compareTo(TYPE) == 0) {
                return d.getCurrentValue().getType().toString();
            }
            if(columnID.compareTo(VALUE) == 0) {
                return d.getCurrentValue().toString();
            }
        }
        else if(node instanceof ArrayChild) {
            ArrayChild ac = (ArrayChild) node;
            if(columnID.compareTo(TYPE) == 0) {
View Full Code Here

TOP

Related Classes of org.quorum.execution.DataObject

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.