Examples of PtParser


Examples of ptolemy.data.expr.PtParser

     @param init A string expression of a 2-D fix matrix.
     *  @exception IllegalActionException If the string does
     *   not contain a parsable 2-D fix matrix.
     */
    public FixMatrixToken(String init) throws IllegalActionException {
        PtParser parser = new PtParser();
        ASTPtRootNode tree = parser.generateParseTree(init);
        Token token = (new ParseTreeEvaluator()).evaluateParseTree(tree);

        if (token instanceof FixMatrixToken) {
            FixPoint[][] value = ((FixMatrixToken) token).fixMatrix();
            _initialize(value, null);
View Full Code Here

Examples of ptolemy.data.expr.PtParser

     *   expression language syntax.
     *  @exception IllegalActionException If the string does
     *   not contain a parsable fixed point number.
     */
    public FixToken(String init) throws IllegalActionException {
        PtParser parser = new PtParser();
        ASTPtRootNode tree = parser.generateParseTree(init);
        Token token = (new ParseTreeEvaluator()).evaluateParseTree(tree);

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

Examples of ptolemy.data.expr.PtParser

     @param init A string expression of a 2-D complex matrix.
     *  @exception IllegalActionException If the string does
     *   not contain a parsable 2-D complex matrix.
     */
    public ComplexMatrixToken(String init) throws IllegalActionException {
        PtParser parser = new PtParser();
        ASTPtRootNode tree = parser.generateParseTree(init);
        Token token = (new ParseTreeEvaluator()).evaluateParseTree(tree);

        if (token instanceof ComplexMatrixToken) {
            Complex[][] value = ((ComplexMatrixToken) token).complexMatrix();
            _initialize(value, DO_COPY);
View Full Code Here

Examples of ptolemy.data.expr.PtParser

     @param init A string expression of a 2-D long matrix.
     *  @exception IllegalActionException If the string does
     *   not contain a parsable 2-D long matrix.
     */
    public LongMatrixToken(String init) throws IllegalActionException {
        PtParser parser = new PtParser();
        ASTPtRootNode tree = parser.generateParseTree(init);
        Token token = (new ParseTreeEvaluator()).evaluateParseTree(tree);

        if (token instanceof LongMatrixToken) {
            long[][] value = ((LongMatrixToken) token).longMatrix();
            _initialize(value, DO_COPY);
View Full Code Here

Examples of ptolemy.data.expr.PtParser

     @param init A string expression of a 2-D int matrix.
     *  @exception IllegalActionException If the string does
     *   not contain a parsable 2-D int matrix.
     */
    public IntMatrixToken(String init) throws IllegalActionException {
        PtParser parser = new PtParser();
        ASTPtRootNode tree = parser.generateParseTree(init);
        Token token = (new ParseTreeEvaluator()).evaluateParseTree(tree);

        if (token instanceof IntMatrixToken) {
            int[][] value = ((IntMatrixToken) token).intMatrix();
            _initialize(value);
View Full Code Here

Examples of ptolemy.data.expr.PtParser

     *  <code>function(x,y) 4+x+y</code>.
     *  @exception IllegalActionException If an error occurs, or the
     *  string cannot be parsed into a function.
     */
    public FunctionToken(String init) throws IllegalActionException {
        PtParser parser = new PtParser();
        ASTPtRootNode tree = parser.generateParseTree(init);
        ParseTreeTypeInference inference = new ParseTreeTypeInference();
        inference.inferTypes(tree);

        Token token = (new ParseTreeEvaluator()).evaluateParseTree(tree);

View Full Code Here

Examples of ptolemy.data.expr.PtParser

     @param init A string expression of a 2-D double matrix.
     *  @exception IllegalActionException If the string does
     *   not contain a parsable 2-D double matrix.
     */
    public DoubleMatrixToken(String init) throws IllegalActionException {
        PtParser parser = new PtParser();
        ASTPtRootNode tree = parser.generateParseTree(init);
        Token token = (new ParseTreeEvaluator()).evaluateParseTree(tree);

        if (token instanceof DoubleMatrixToken) {
            double[][] value = ((DoubleMatrixToken) token).doubleMatrix();
            _initialize(value);
View Full Code Here

Examples of ptolemy.data.expr.PtParser

            SootClass entityClass, String expression, Map nameToFieldOrLocal,
            Map nameToType, JimpleBody body, Unit insertPoint) {
        Local local;

        try {
            PtParser parser = new PtParser();
            ASTPtRootNode parseTree = parser.generateParseTree(expression);
            ActorCodeGenerationScope scope = new ActorCodeGenerationScope(
                    entity, entityClass, nameToFieldOrLocal, nameToType, body,
                    insertPoint);
            ParseTreeCodeGenerator generator = new ParseTreeCodeGenerator();
            local = generator.generateCode(parseTree, body, insertPoint, scope);
View Full Code Here

Examples of ptolemy.data.expr.PtParser

        try {
            // Note that the parser is NOT retained, since in most
            // cases the expression doesn't change, and the parser
            // requires a large amount of memory.
            PtParser parser = new PtParser();
            ASTPtRootNode parseTree = parser.generateParseTree(actor.expression
                    .getExpression());

            _cParseTreeCodeGenerator.evaluateParseTree(parseTree,
                    new VariableScope(actor));
        } catch (IllegalActionException ex) {
View Full Code Here

Examples of ptolemy.data.expr.PtParser

                    throw new PtalonRuntimeException(
                            "Unable to set token for name " + paramName, ex);
                }
            }
            try {
                PtParser parser = new PtParser();
                ParseTreeEvaluator _parseTreeEvaluator = new ParseTreeEvaluator();
                for (String parameterName : _parameters.keySet()) {
                    String expression = _parameters.get(parameterName);
                    if (expression == null) {
                        throw new PtalonRuntimeException(
                                "Unable to find expression label for "
                                        + "parameter " + parameterName);
                    }
                    ASTPtRootNode _parseTree = parser
                            .generateParseTree(expression);
                    Parameter parameter = (Parameter) actor
                            .getAttribute(parameterName);
                    if (parameter == null) {
                        String uniqueName = actor.uniqueName(parameterName);
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.