Examples of AbstractTCLNode


Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

        }

        EvaluationResult _result = null;
        Any _any = null;

        AbstractTCLNode _currentOperator = expr;
        Any _currentAny = any;

        StringBuffer _currentPath = new StringBuffer(rootName);

        while (_currentOperator != null)
        {
            _currentPath.append(_currentOperator.toString());

            if (logger_.isDebugEnabled())
            {
                logger_.debug("current path=" + _currentPath.toString());
                logger_.debug("current operator=" + _currentOperator.toString());
                logger_.debug("current any=" + _currentAny);
            }

            // lookup result in cache
            _any = lookupAny(_currentPath.toString());

            if (_any == null)
            {
                // cache MISS
                switch (_currentOperator.getType()) {
                case TCLParserTokenTypes.DOT:
                    // dots are skipped
                    break;

                case TCLParserTokenTypes.UNION_POS:
                    logger_.debug("evaluate union by position");
                    UnionPositionOperator _upo = (UnionPositionOperator) _currentOperator;

                    // default union
                    if (_upo.isDefault())
                    {
                        _any = getETCLEvaluator().evaluateUnion(_currentAny);
                    }
                    else
                    {
                        _any = getETCLEvaluator().evaluateUnion(_currentAny,
                                _upo.getPosition());
                    }

                    break;

                case TCLParserTokenTypes.IDENTIFIER:
                    String _identifer = ((IdentValue) _currentOperator).getIdentifier();

                    _any = getETCLEvaluator().evaluateIdentifier(_currentAny, _identifer);

                    break;

                case TCLParserTokenTypes.NUMBER:
                    int _pos = ((NumberValue) _currentOperator).getNumber().intValue();

                    _any = getETCLEvaluator().evaluateIdentifier(_currentAny, _pos);

                    break;

                case TCLParserTokenTypes.IMPLICIT:
                    ImplicitOperator _op = ((ImplicitOperatorNode) _currentOperator).getOperator();

                    _any = _op.evaluateImplicit(getETCLEvaluator(), _currentAny);

                    _result = EvaluationResult.fromAny(_any);

                    _result.addAny(_currentAny);

                    return _result;

                case TCLParserTokenTypes.ARRAY:
                    int _arrayIndex = ((ArrayOperator) _currentOperator).getArrayIndex();

                    _any = getETCLEvaluator().evaluateArrayIndex(_currentAny, _arrayIndex);

                    break;

                case TCLParserTokenTypes.ASSOC:
                    String _assocName = ((AssocOperator) _currentOperator).getAssocName();

                    _any = getETCLEvaluator().evaluateNamedValueList(_currentAny, _assocName);

                    break;

                default:
                    throw new RuntimeException("unexpected operator: "
                            + AbstractTCLNode.getNameForType(_currentOperator.getType()));
                }
            }

            if (_any != null)
            {
                storeAny(_currentPath.toString(), _any);
                _currentAny = _any;
            }

            _currentOperator = (AbstractTCLNode) _currentOperator.getNextSibling();
        }

        // Create the EvaluationResult
        _result = EvaluationResult.fromAny(_any);
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

        }

        EvaluationResult _result = null;
        Any _any = null;

        AbstractTCLNode _currentOperator = expr;
        Any _currentAny = any;

        StringBuffer _currentPath = new StringBuffer(rootName);

        while (_currentOperator != null)
        {
            _currentPath.append(_currentOperator.toString());

            if (logger_.isDebugEnabled())
            {
                logger_.debug("current path=" + _currentPath.toString());
                logger_.debug("current operator=" + _currentOperator.toString());
                logger_.debug("current any=" + _currentAny);
            }

            // lookup result in cache
            _any = lookupAny(_currentPath.toString());

            if (_any == null)
            {
                // cache MISS
                switch (_currentOperator.getType()) {
                case TCLParserTokenTypes.DOT:
                    // dots are skipped
                    break;

                case TCLParserTokenTypes.UNION_POS:
                    logger_.debug("evaluate union by position");
                    UnionPositionOperator _upo = (UnionPositionOperator) _currentOperator;

                    // default union
                    if (_upo.isDefault())
                    {
                        _any = getETCLEvaluator().evaluateUnion(_currentAny);
                    }
                    else
                    {
                        _any = getETCLEvaluator().evaluateUnion(_currentAny,
                                _upo.getPosition());
                    }

                    break;

                case TCLParserTokenTypes.IDENTIFIER:
                    String _identifer = ((IdentValue) _currentOperator).getIdentifier();

                    _any = getETCLEvaluator().evaluateIdentifier(_currentAny, _identifer);

                    break;

                case TCLParserTokenTypes.NUMBER:
                    int _pos = ((NumberValue) _currentOperator).getNumber().intValue();

                    _any = getETCLEvaluator().evaluateIdentifier(_currentAny, _pos);

                    break;

                case TCLParserTokenTypes.IMPLICIT:
                    ImplicitOperator _op = ((ImplicitOperatorNode) _currentOperator).getOperator();

                    _any = _op.evaluateImplicit(getETCLEvaluator(), _currentAny);

                    _result = EvaluationResult.fromAny(_any);

                    _result.addAny(_currentAny);

                    return _result;

                case TCLParserTokenTypes.ARRAY:
                    int _arrayIndex = ((ArrayOperator) _currentOperator).getArrayIndex();

                    _any = getETCLEvaluator().evaluateArrayIndex(_currentAny, _arrayIndex);

                    break;

                case TCLParserTokenTypes.ASSOC:
                    String _assocName = ((AssocOperator) _currentOperator).getAssocName();

                    _any = getETCLEvaluator().evaluateNamedValueList(_currentAny, _assocName);

                    break;

                default:
                    throw new RuntimeException("unexpected operator: "
                            + AbstractTCLNode.getNameForType(_currentOperator.getType()));
                }
            }

            if (_any != null)
            {
                storeAny(_currentPath.toString(), _any);
                _currentAny = _any;
            }

            _currentOperator = (AbstractTCLNode) _currentOperator.getNextSibling();
        }

        // Create the EvaluationResult
        _result = EvaluationResult.fromAny(_any);
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

    }


    public void testEvaluateCachesResult() throws Exception
    {
        AbstractTCLNode _root = TCLParser.parse( "$.first_name" );
        _root.acceptPreOrder( new TCLCleanUp() );

        Message _event = messageFactory_.newMessage(testUtils_.getTestPersonAny());
        _event.extractValue( context_, ( ETCLComponentName ) _root );

        assertNotNull( context_.lookupResult( "$.first_name" ) );
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

    }


    public void testEvaluateCachesAny() throws Exception
    {
        AbstractTCLNode _root = TCLParser.parse( "$.home_address.street" );
        _root.acceptPreOrder( new TCLCleanUp() );

        Message _event = messageFactory_.newMessage(testUtils_.getTestPersonAny());

        _event.extractValue(context_, ( ETCLComponentName ) _root );
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

        assertTrue(_event.getType() == Message.TYPE_ANY);
    }

    public void testEvaluate_Any() throws Exception {
        String _expr = "$.first_name";
        AbstractTCLNode _root = TCLParser.parse(_expr);

        _root.acceptPreOrder(new TCLCleanUp());

        Message _event = factory_.newMessage(testPerson_);

        EvaluationResult _result =
            _event.extractValue(evaluationContext_,
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

    }

    public void testEvaluate_Structured() throws Exception {
        String _expr = "$.header.fixed_header.event_type.domain_name";
        Message _event = factory_.newMessage(testStructured_);
        AbstractTCLNode _root = TCLParser.parse(_expr);

        _root.acceptPreOrder(new TCLCleanUp());

        EvaluationResult _result =
            _event.extractValue(evaluationContext_,
                                (ETCLComponentName) _root);
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

    private void runStaticTypeCheck(String expr, boolean shouldFail) throws Exception
    {
        try
        {
            AbstractTCLNode _root = TCLParser.parse(expr);

            StaticTypeChecker _checker = new StaticTypeChecker();

            _checker.check(_root);
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

     * @throws Exception
     *             if parsing fails
     */
    private void runEvaluation(String expect, String expression) throws Exception
    {
        AbstractTCLNode fstNode = TCLParser.parse(expect);
        AbstractTCLNode sndNode = TCLParser.parse(expression);

        EvaluationContext _context = new EvaluationContext(getEvaluator());

        EvaluationResult pre_res = fstNode.evaluate(_context);
        EvaluationResult pst_res = sndNode.evaluate(_context);

        assertEquals("expected " + fstNode.toStringTree() + " == " + sndNode.toStringTree(),
                pre_res, pst_res);
    }
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

        ETCLComponentName _comp = (ETCLComponentName) TCLParser.parse("$.first_name.last_name");

        _comp.acceptInOrder(new TCLCleanUp());
        assertEquals("$.first_name.last_name", _comp.getComponentName());

        AbstractTCLNode _root = TCLParser.parse("$.first_name.value + 5");

        _root.acceptInOrder(new TCLCleanUp());
        _comp = (ETCLComponentName) _root.getFirstChild();
        assertEquals("$.first_name.value", _comp.getComponentName());

        _comp = (ETCLComponentName) TCLParser.parse("$domain_name");
        _comp.acceptInOrder(new TCLCleanUp());
        assertEquals("$domain_name", _comp.getComponentName());
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

    }

    public void testLTEforwardsVisitorBug() throws Exception
    {
        String _expr = "$.time <= 1";
        AbstractTCLNode _root = TCLParser.parse(_expr);
        _root.acceptPostOrder(new TCLCleanUp());

        ETCLComponentName _n = (ETCLComponentName) _root.left();

        assertEquals("$.time", _n.getComponentName());
    }
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.