Package org.drools.core.reteoo

Examples of org.drools.core.reteoo.MockTupleSource


        final RuleImpl rule1 = new RuleImpl("test-rule1");
        final RuleImpl rule2 = new RuleImpl("test-rule2");

        final RuleTerminalNode node1 = new RuleTerminalNode(3,
                                                            new MockTupleSource(2),
                                                            rule1,
                                                            rule1.getLhs(),
                                                            0,
                                                            buildContext);

        final RuleTerminalNode node2 = new RuleTerminalNode(5,
                                                            new MockTupleSource(4),
                                                            rule2,
                                                            rule2.getLhs(),
                                                            0,
                                                            buildContext);
View Full Code Here


        final InternalAgenda agenda = (InternalAgenda) ksession.getAgenda();

        final RuleImpl rule1 = new RuleImpl("test-rule1");

        final RuleTerminalNode node1 = new RuleTerminalNode(3,
                                                            new MockTupleSource(2),
                                                            rule1,
                                                            rule1.getLhs(),
                                                            0,
                                                            buildContext);
View Full Code Here

            }
        });

        final RuleImpl rule = new RuleImpl("test-rule");
        final RuleTerminalNode node = new RuleTerminalNode(3,
                                                           new MockTupleSource(2),
                                                           rule,
                                                           rule.getLhs(),
                                                           0,
                                                           buildContext);
View Full Code Here

        };

        // create a rule for each agendaGroup
        final RuleImpl rule0 = new RuleImpl("test-rule0");
        final RuleTerminalNode node0 = new RuleTerminalNode(3,
                                                            new MockTupleSource(2),
                                                            rule0,
                                                            rule0.getLhs(),
                                                            0,
                                                            buildContext);
        rule0.setConsequence(consequence);
        final PropagationContext context0 = pctxFactory.createPropagationContext(0,
                                                                                 PropagationContext.INSERTION,
                                                                                 rule0,
                                                                                 null,
                                                                                 new DefaultFactHandle());

        final RuleImpl rule1 = new RuleImpl("test-rule1",
                                    "agendaGroup1");
        final RuleTerminalNode node1 = new RuleTerminalNode(5,
                                                            new MockTupleSource(4),
                                                            rule1,
                                                            rule1.getLhs(),
                                                            0,
                                                            buildContext);
        rule1.setConsequence(consequence);
        final PropagationContext context1 = pctxFactory.createPropagationContext(0,
                                                                                 PropagationContext.INSERTION,
                                                                                 rule1,
                                                                                 null,
                                                                                 new DefaultFactHandle());

        final RuleImpl rule2 = new RuleImpl("test-rule2",
                                    "agendaGroup2");
        final RuleTerminalNode node2 = new RuleTerminalNode(7,
                                                            new MockTupleSource(6),
                                                            rule2,
                                                            rule2.getLhs(),
                                                            0,
                                                            buildContext);
        rule2.setConsequence(consequence);
        final PropagationContext context2 = pctxFactory.createPropagationContext(0,
                                                                                 PropagationContext.INSERTION,
                                                                                 rule2,
                                                                                 null,
                                                                                 new DefaultFactHandle());

        final RuleImpl rule3 = new RuleImpl("test-rule3",
                                    "agendaGroup3");
        final RuleTerminalNode node3 = new RuleTerminalNode(9,
                                                            new MockTupleSource(8),
                                                            rule3,
                                                            rule3.getLhs(),
                                                            0,
                                                            buildContext);
        rule3.setConsequence(consequence);
View Full Code Here

        // create a rule for the agendaGroup
        final RuleImpl rule = new RuleImpl("test-rule",
                                   "agendaGroup");
        final RuleTerminalNode node = new RuleTerminalNode(2,
                                                           new MockTupleSource(2),
                                                           rule,
                                                           rule.getLhs(),
                                                           0,
                                                           buildContext);
View Full Code Here

        // create a rule for the agendaGroup
        final RuleImpl rule = new RuleImpl("test-rule",
                                   "agendaGroup");
        final RuleTerminalNode node = new RuleTerminalNode(2,
                                                           new MockTupleSource(2),
                                                           rule,
                                                           rule.getLhs(),
                                                           0,
                                                           buildContext);
View Full Code Here

        // create a rule for each agendaGroup
        final RuleImpl rule0 = new RuleImpl("test-rule0");
        rule0.setActivationGroup("activation-group-0");
        final RuleTerminalNode node0 = new RuleTerminalNode(3,
                                                            new MockTupleSource(2),
                                                            rule0,
                                                            rule0.getLhs(),
                                                            0,
                                                            buildContext);
        rule0.setConsequence(consequence);
        final PropagationContext context0 = pctxFactory.createPropagationContext(0,
                                                                                 PropagationContext.INSERTION,
                                                                                 rule0,
                                                                                 null,
                                                                                 new DefaultFactHandle());

        final RuleImpl rule1 = new RuleImpl("test-rule1");
        rule1.setActivationGroup("activation-group-0");
        rule1.setSalience(new SalienceInteger(10));
        final RuleTerminalNode node1 = new RuleTerminalNode(5,
                                                            new MockTupleSource(4),
                                                            rule1,
                                                            rule1.getLhs(),
                                                            0,
                                                            buildContext);
        rule1.setConsequence(consequence);
        final PropagationContext context1 = pctxFactory.createPropagationContext(0,
                                                                                 PropagationContext.INSERTION,
                                                                                 rule1,
                                                                                 null,
                                                                                 new DefaultFactHandle());

        final RuleImpl rule2 = new RuleImpl("test-rule2");
        rule2.setSalience(new SalienceInteger(-5));
        final RuleTerminalNode node2 = new RuleTerminalNode(7,
                                                            new MockTupleSource(6),
                                                            rule2,
                                                            rule2.getLhs(),
                                                            0,
                                                            buildContext);
        rule2.setConsequence(consequence);
        final PropagationContext context2 = pctxFactory.createPropagationContext(0,
                                                                                 PropagationContext.INSERTION,
                                                                                 rule2,
                                                                                 null,
                                                                                 new DefaultFactHandle());

        final RuleImpl rule3 = new RuleImpl("test-rule3",
                                    "agendaGroup3");
        rule3.setSalience(new SalienceInteger(-10));
        rule3.setActivationGroup("activation-group-3");
        final RuleTerminalNode node3 = new RuleTerminalNode(9,
                                                            new MockTupleSource(8),
                                                            rule3,
                                                            rule3.getLhs(),
                                                            0,
                                                            buildContext);
        rule3.setConsequence(consequence);
View Full Code Here

        final RuleImpl rule0 = new RuleImpl("test-rule0");
        rule0.setAgendaGroup("rule-flow-group-0");
        rule0.setConsequence(consequence);

        final RuleTerminalNode node0 = new RuleTerminalNode(3,
                                                            new MockTupleSource(2),
                                                            rule0,
                                                            rule0.getLhs(),
                                                            0,
                                                            buildContext);

        final RuleImpl rule1 = new RuleImpl("test-rule1");
        rule1.setAgendaGroup("rule-flow-group-1");
        rule1.setConsequence(consequence);

        final RuleTerminalNode node1 = new RuleTerminalNode(4,
                                                            new MockTupleSource(2),
                                                            rule1,
                                                            rule1.getLhs(),
                                                            0,
                                                            buildContext);

        final RuleImpl rule2 = new RuleImpl("test-rule2");
        rule2.setAgendaGroup("rule-flow-group-2");
        rule2.setConsequence(consequence);
        rule2.setSalience(new SalienceInteger(10));

        final RuleTerminalNode node2 = new RuleTerminalNode(5,
                                                            new MockTupleSource(2),
                                                            rule2,
                                                            rule2.getLhs(),
                                                            0,
                                                            buildContext);
View Full Code Here

        final RuleImpl rule1 = new RuleImpl("test-rule1");
        rule1.setAgendaGroup("rule-flow-group-0");
        rule1.setConsequence(consequence1);

        final RuleTerminalNode node1 = new RuleTerminalNode(4,
                                                            new MockTupleSource(2),
                                                            rule1,
                                                            rule1.getLhs(),
                                                            0,
                                                            buildContext);

        // create context
        final PropagationContext context0 = pctxFactory.createPropagationContext(0,
                                                                                 PropagationContext.INSERTION,
                                                                                 rule1,
                                                                                 null,
                                                                                 new DefaultFactHandle());

        // create rule0
        final Consequence consequence0 = new

                Consequence() {
                    private static final long serialVersionUID = 510l;

                    public void evaluate(KnowledgeHelper knowledgeHelper,
                                         WorkingMemory w) {
                        // activate rule1
                        final RuleTerminalNodeLeftTuple tuple1 = new RuleTerminalNodeLeftTuple(new DefaultFactHandle(1,
                                                                                                                     "cheese"),
                                                                                               node1,
                                                                                               true);
                        node1.assertLeftTuple(tuple1,
                                              context0,
                                              ksession);
                    }

                    public void readExternal(ObjectInput in) throws IOException,
                            ClassNotFoundException {

                    }

                    public void writeExternal(ObjectOutput out) throws IOException {

                    }

                    public String getName() {
                        return "default";
                    }
                };

        final RuleImpl rule0 = new RuleImpl("test-rule0");
        rule0.setAgendaGroup("rule-flow-group-0");
        rule0.setConsequence(consequence0);

        final RuleTerminalNode node0 = new RuleTerminalNode(3,
                                                            new MockTupleSource(2),
                                                            rule0,
                                                            rule0.getLhs(),
                                                            0,
                                                            buildContext);
View Full Code Here

        final RuleImpl rule1 = new RuleImpl("test-rule1");
        rule1.setAgendaGroup("rule-flow-group-0");
        rule1.setConsequence(consequence1);

        final RuleTerminalNode node1 = new RuleTerminalNode(4,
                                                            new MockTupleSource(2),
                                                            rule1,
                                                            rule1.getLhs(),
                                                            0,
                                                            buildContext);

        // create context
        final PropagationContext context0 = pctxFactory.createPropagationContext(0,
                                                                                 PropagationContext.INSERTION,
                                                                                 rule1,
                                                                                 null,
                                                                                 new DefaultFactHandle());

        final RuleTerminalNodeLeftTuple tuple1 = new RuleTerminalNodeLeftTuple(new DefaultFactHandle(1,
                                                                                                     "cheese"),
                                                                               node1,
                                                                               true);

        // create rule0
        final Consequence consequence0 = new

                Consequence() {
                    private static final long serialVersionUID = 510l;

                    public void evaluate(KnowledgeHelper knowledgeHelper,
                                         WorkingMemory w) {
                        // deactivate rule1
                        node1.retractLeftTuple(tuple1,
                                               context0,
                                               ksession);
                    }

                    public void readExternal(ObjectInput in) throws IOException,
                            ClassNotFoundException {

                    }

                    public void writeExternal(ObjectOutput out) throws IOException {

                    }

                    public String getName() {
                        return "default";
                    }
                };

        final RuleImpl rule0 = new RuleImpl("test-rule0");
        rule0.setAgendaGroup("rule-flow-group-0");
        rule0.setConsequence(consequence0);
        rule0.setSalience(new SalienceInteger(10));

        final RuleTerminalNode node0 = new RuleTerminalNode(3,
                                                            new MockTupleSource(2),
                                                            rule0,
                                                            rule0.getLhs(),
                                                            0,
                                                            buildContext);
View Full Code Here

TOP

Related Classes of org.drools.core.reteoo.MockTupleSource

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.