Package org.apache.hivemind.conditional

Examples of org.apache.hivemind.conditional.Node


        if (_conditionalExpressionParser == null)
            _conditionalExpressionParser = new Parser();

        try
        {
            Node node = _conditionalExpressionParser.parse(expression);

            return node.evaluate(new EvaluationContextImpl(module.getClassResolver()));
        }
        catch (RuntimeException ex)
        {
            _errorHandler.error(_log, ex.getMessage(), location, ex);
View Full Code Here


        if (_conditionalExpressionParser == null)
            _conditionalExpressionParser = new Parser();

        try
        {
            Node node = _conditionalExpressionParser.parse(expression);

            return node.evaluate(new EvaluationContextImpl(module.getClassResolver()));
        }
        catch (RuntimeException ex)
        {
            _errorHandler.error(_log, ex.getMessage(), location, ex);
View Full Code Here

        if (_conditionalExpressionParser == null)
            _conditionalExpressionParser = new Parser();

        try
        {
            Node node = _conditionalExpressionParser.parse(expression);

            return node.evaluate(new EvaluationContextImpl(module.getClassResolver()));
        }
        catch (RuntimeException ex)
        {
            _errorHandler.error(_log, ex.getMessage(), location, ex);
View Full Code Here

*/
public class TestNode extends HiveMindTestCase
{
    public void testConstructorAndGetters()
    {
        Node left = (Node) newMock(Node.class);
        Node right = (Node) newMock(Node.class);
        Evaluator evaluator = (Evaluator) newMock(Evaluator.class);

        replayControls();

        Node n = new NodeImpl(left, right, evaluator);

        assertSame(left, n.getLeft());
        assertSame(right, n.getRight());

        verifyControls();
    }
View Full Code Here

    {
        MockControl control = newControl(Evaluator.class);
        Evaluator evaluator = (Evaluator) control.getMock();
        EvaluationContext context = (EvaluationContext) newMock(EvaluationContext.class);

        Node n = new NodeImpl(evaluator);

        evaluator.evaluate(context, n);
        control.setReturnValue(false);

        evaluator.evaluate(context, n);
        control.setReturnValue(true);

        replayControls();

        assertEquals(false, n.evaluate(context));
        assertEquals(true, n.evaluate(context));

        verifyControls();
    }
View Full Code Here

        if (_conditionalExpressionParser == null)
            _conditionalExpressionParser = new Parser();

        try
        {
            Node node = _conditionalExpressionParser.parse(expression);

            return node.evaluate(new EvaluationContextImpl(module.getClassResolver()));
        }
        catch (RuntimeException ex)
        {
            _errorHandler.error(_log, ex.getMessage(), location, ex);
View Full Code Here

        if (_conditionalExpressionParser == null)
            _conditionalExpressionParser = new Parser();

        try
        {
            Node node = _conditionalExpressionParser.parse(expression);

            return node.evaluate(new EvaluationContextImpl(module.getClassResolver()));
        }
        catch (RuntimeException ex)
        {
            _errorHandler.error(_log, ex.getMessage(), location, ex);
View Full Code Here

    }

    private Node newNode(EvaluationContext context, boolean value)
    {
        MockControl control = newControl(Node.class);
        Node node = (Node) control.getMock();

        node.evaluate(context);

        control.setReturnValue(value);

        return node;
    }
View Full Code Here

    }

    public void testNotEvaluator()
    {
        EvaluationContext context = newContext();
        Node left = newNode(context, true);

        Node node = new NodeImpl(left, null, new NotEvaluator());

        replayControls();

        assertEquals(false, node.evaluate(context));

        verifyControls();
    }
View Full Code Here

    }

    public void testAndEvaluatorTrue()
    {
        EvaluationContext context = newContext();
        Node left = newNode(context, true);
        Node right = newNode(context, true);

        Node node = new NodeImpl(left, right, new AndEvaluator());

        replayControls();

        assertEquals(true, node.evaluate(context));

        verifyControls();
    }
View Full Code Here

TOP

Related Classes of org.apache.hivemind.conditional.Node

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.