Package org.drools.core.command

Examples of org.drools.core.command.SetVariableCommandFromLastReturn


   
    public KieSessionSimulationFluent newKieSession(ReleaseId releaseId, String id) {
        assureActiveStep();
        activeKieSessionId = id == null ? DEFAULT_ID : id;
        addCommand( new NewKieSessionCommand( releaseId, id ) );
        addCommand( new SetVariableCommandFromLastReturn( StatefulKnowledgeSession.class.getName() ) );

        return new DefaultStatefulKnowledgeSessionSimFluent( this );
    }
View Full Code Here


    }

    public KieSessionSimulationFluent getKieSession(String id) {
        activeKieSessionId = id;
        addCommand(new GetVariableCommand(id));
        addCommand(new SetVariableCommandFromLastReturn(StatefulKnowledgeSession.class.getName()));

        return new DefaultStatefulKnowledgeSessionSimFluent( this );
    }
View Full Code Here

                    @Override
                    public KieSession execute(Context context) {
                        return id != null ? kieContainer.newKieSession( id ) : kieContainer.newKieSession();
                    }
                });
                addCommand( new SetVariableCommandFromLastReturn( StatefulKnowledgeSession.class.getName() ) );

                return new DefaultStatefulKnowledgeSessionSimFluent( this );
            }
        };

        // @formatter:off       
        int counter = 0;
        int remainingInstances = numberOfAllInstances;
        for (SimulationPath path : paths) {
            // only paths that can be started are considered
            if (!path.isStartable()) {
                continue;
            }
            double probability = path.getProbability();
            f.newPath("path" + counter);

            int instancesOfPath = 1;
            // count how many instances/steps should current path have
            if (numberOfAllInstances > 1) {
                instancesOfPath = (int) Math.round((numberOfAllInstances * probability));
               
                // ensure that we won't exceed total number of instance due to rounding
                if (instancesOfPath > remainingInstances) {
                    instancesOfPath = remainingInstances;
                }
               
                remainingInstances -= instancesOfPath;
                       
                for (int i = 0; i < instancesOfPath; i++) {
                    f.newStep( interval * i )
                        .newKieSession( releaseId, null)
                            .end()
                        .addCommand(new SimulateProcessPathCommand(processId, context, path))
                        .addCommand( new SetVariableCommandFromLastReturn( StatefulKnowledgeSession.class.getName() ))
                        .addCommand(new DisposeCommand());
                }
            } else {
                f.newStep(interval)
                .newKieSession(releaseId, null)
                    .end()
                .addCommand(new SimulateProcessPathCommand(processId, context, path))
                .addCommand( new SetVariableCommandFromLastReturn( StatefulKnowledgeSession.class.getName() ))
                .addCommand(new DisposeCommand());
                break;
            }
           
            counter++;
View Full Code Here

   
    public KieSessionSimulationFluent newKieSession(ReleaseId releaseId, String id) {
        assureActiveStep();
        activeKieSessionId = id == null ? DEFAULT_ID : id;
        addCommand( new NewKieSessionCommand( releaseId, id ) );
        addCommand( new SetVariableCommandFromLastReturn( StatefulKnowledgeSession.class.getName() ) );

        return new DefaultStatefulKnowledgeSessionSimFluent( this );
    }
View Full Code Here

    }

    public KieSessionSimulationFluent getKieSession(String id) {
        activeKieSessionId = id;
        addCommand(new GetVariableCommand(id));
        addCommand(new SetVariableCommandFromLastReturn(StatefulKnowledgeSession.class.getName()));

        return new DefaultStatefulKnowledgeSessionSimFluent( this );
    }
View Full Code Here

//        return simulationFluent.getActiveKnowledgeBuilderId();
//    }

    public SimulationFluent end(String context, String name) {
        addCommand(new GetVariableCommand(KnowledgeBuilder.class.getName()));
        addCommand(new SetVariableCommandFromLastReturn(context, name));
        return simulationFluent;
    }
View Full Code Here

        return simulationFluent;
    }
   
    public SimulationFluent end(String name) {
        addCommand(new GetVariableCommand(KnowledgeBuilder.class.getName()));
        addCommand(new SetVariableCommandFromLastReturn(name));
        return simulationFluent;
    }
View Full Code Here

       
        return this;
    }

    public SimulationFluent end(String context, String name) {
        addCommand(new SetVariableCommandFromLastReturn(context, name));
        return simulationFluent;
    }
View Full Code Here

        addCommand(new SetVariableCommandFromLastReturn(context, name));
        return simulationFluent;
    }

    public SimulationFluent end(String name) {
        addCommand(new SetVariableCommandFromLastReturn(name));
        return simulationFluent;
    }
View Full Code Here

        return simulationFluent.getActiveKieSessionId();
    }
   
    public SimulationFluent end(String context, String name) {
        addCommand(new GetVariableCommand(StatefulKnowledgeSession.class.getName()));
        addCommand(new SetVariableCommandFromLastReturn(context, name));
        return simulationFluent;
    }
View Full Code Here

TOP

Related Classes of org.drools.core.command.SetVariableCommandFromLastReturn

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.