Examples of ASTPtRootNode


Examples of ptolemy.data.expr.ASTPtRootNode

     @exception IllegalActionException If the string does not represent
     *   a parsable complex number.
     */
    public ComplexToken(String init) throws IllegalActionException {
        PtParser parser = new PtParser();
        ASTPtRootNode tree = parser.generateParseTree(init);
        Token token = (new ParseTreeEvaluator()).evaluateParseTree(tree);

        if (token instanceof ComplexToken) {
            _value = ((ComplexToken) token).complexValue();
        } else {
View Full Code Here

Examples of ptolemy.data.expr.ASTPtRootNode

        for (Iterator variables = model.attributeList(Variable.class)
                .iterator(); variables.hasNext();) {
            Variable variable = (Variable) variables.next();
            String expression = variable.getExpression();
            ASTPtRootNode root;

            if (variable.isStringMode()) {
                root = parser.generateStringParseTree(expression);
            } else {
                root = parser.generateParseTree(expression);
View Full Code Here

Examples of ptolemy.data.expr.ASTPtRootNode

                if (attribute instanceof Settable) {
                    Settable settable = (Settable) attribute;
                    String expression = settable.getExpression();
                    VariableScope scope = new VariableScope(object);
                    try {
                        ASTPtRootNode tree = _TYPE_PARSER
                                .generateParseTree(expression);
                        Token token = _TYPE_EVALUATOR.evaluateParseTree(tree,
                                scope);

                        if (isAttributeTypeEnabled()) {
View Full Code Here

Examples of ptolemy.data.expr.ASTPtRootNode

                                            .getExpression()) + "\"", castType,
                            "String");
                }

                PtParser parser = new PtParser();
                ASTPtRootNode parseTree = null;
                try {
                    parseTree = parser.generateParseTree(variable
                            .getExpression());
                } catch (Throwable throwable) {
                    throw new IllegalActionException(variable, throwable,
View Full Code Here

Examples of ptolemy.data.expr.ASTPtRootNode

                matchResult);
        String expression;
        if (_valueParseTree instanceof ASTPtSumNode) {
            StringBuffer buffer = new StringBuffer();
            for (int i = 0; i < _valueParseTree.jjtGetNumChildren(); i++) {
                ASTPtRootNode child = (ASTPtRootNode) _valueParseTree
                        .jjtGetChild(i);
                if (!(child.isConstant() && child.getToken() instanceof StringToken)) {
                    ASTPtLeafNode newNode = _evaluate(child, evaluator, scope);
                    buffer.append(_parseTreeWriter
                            .parseTreeToExpression(newNode));
                } else {
                    buffer.append(((StringToken) child.getToken())
                            .stringValue());
                }
            }
            expression = buffer.toString();
        } else if (!(_valueParseTree.isConstant() && _valueParseTree.getToken() instanceof StringToken)) {
            ASTPtRootNode newRoot = _evaluate(_valueParseTree, evaluator, scope);
            expression = _parseTreeWriter.parseTreeToExpression(newRoot);
        } else {
            expression = _attributeValue.get();
        }
        String moml = "<property name=\"" + _attributeName + "\" class=\""
View Full Code Here

Examples of ptolemy.data.expr.ASTPtRootNode

     @exception IllegalActionException If the string does
     *   not contain a parsable array.
     */
    public ArrayToken(String init) throws IllegalActionException {
        PtParser parser = new PtParser();
        ASTPtRootNode tree = parser.generateParseTree(init);
        ParseTreeEvaluator evaluator = new ParseTreeEvaluator();
        Token token = evaluator.evaluateParseTree(tree);

        if (token instanceof ArrayToken) {
            _value = ((ArrayToken) token)._value;
View Full Code Here

Examples of ptolemy.data.expr.ASTPtRootNode

                    throw new IllegalActionException("The loop special " +
                            "function requires exactly 4 arguments.");
                }

                String current = null;
                ASTPtRootNode child = (ASTPtRootNode) node.jjtGetChild(1);
                if (child != null && child instanceof ASTPtLeafNode &&
                        ((ASTPtLeafNode) child).isIdentifier()) {
                    current = ((ASTPtLeafNode) child).getName();
                }
                if (current == null) {
View Full Code Here

Examples of ptolemy.data.expr.ASTPtRootNode

                                + test.getClass().getName());
            }

            boolean value = ((BooleanToken) test).booleanValue();

            ASTPtRootNode tokenChild;

            if (value) {
                tokenChild = (ASTPtRootNode) node.jjtGetChild(1);
            } else {
                tokenChild = (ASTPtRootNode) node.jjtGetChild(2);
            }

            tokenChild.visit(this);

            if (node.isConstant()) {
                node.setToken(_evaluatedChildToken);
            }
        }
View Full Code Here

Examples of ptolemy.data.expr.ASTPtRootNode

            _evaluator = new LoopEvaluator(pattern, matchResult, current,
                    boundVariable);
        }

        public Token apply(Token[] arguments) throws IllegalActionException {
            ASTPtRootNode tree =
                (ASTPtRootNode) ((ObjectToken) arguments[0]).getValue();
            Token currentValue = _startValue;
            for (Object element : _collection) {
                Token elementToken;
                if (element instanceof Token) {
View Full Code Here

Examples of ptolemy.data.expr.ASTPtRootNode

     @exception IllegalActionException If the string does
     *   not contain a parsable boolean matrix.
     */
    public BooleanMatrixToken(String init) throws IllegalActionException {
        PtParser parser = new PtParser();
        ASTPtRootNode tree = parser.generateParseTree(init);
        Token token = (new ParseTreeEvaluator()).evaluateParseTree(tree);

        if (token instanceof BooleanMatrixToken) {
            boolean[][] value = ((BooleanMatrixToken) token).booleanMatrix();
            _initialize(value);
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.