use of org.drools.core.reteoo.ReteooBuilder in project drools by kiegroup.
the class KnowledgeBaseImpl method setupRete.
protected void setupRete() {
this.rete = new Rete(this);
this.reteooBuilder = new ReteooBuilder(this);
NodeFactory nodeFactory = kieComponentFactory.getNodeFactoryService();
// always add the default entry point
EntryPointNode epn = nodeFactory.buildEntryPointNode(this.reteooBuilder.getIdGenerator().getNextId(), RuleBasePartitionId.MAIN_PARTITION, this.getConfiguration().isMultithreadEvaluation(), this.rete, EntryPointId.DEFAULT);
epn.attach();
BuildContext context = new BuildContext(this);
context.setCurrentEntryPoint(epn.getEntryPoint());
context.setTupleMemoryEnabled(true);
context.setObjectTypeNodeMemoryEnabled(true);
context.setPartitionId(RuleBasePartitionId.MAIN_PARTITION);
ObjectTypeNode otn = nodeFactory.buildObjectTypeNode(this.reteooBuilder.getIdGenerator().getNextId(), epn, ClassObjectType.InitialFact_ObjectType, context);
otn.attach(context);
}
use of org.drools.core.reteoo.ReteooBuilder in project drools by kiegroup.
the class ReteooBuilderPerformanceTest method addRules.
private static void addRules(InternalKnowledgePackage pkg) {
ReteooBuilder[] reteBuilders = getReteBuilders(RETEBUILDER_COUNT);
System.out.println("Adding rules to ReteBuilder");
long start = System.currentTimeMillis();
for (ReteooBuilder reteBuilder : reteBuilders) {
for (Rule rule : pkg.getRules()) reteBuilder.addRule((RuleImpl) rule);
}
System.out.println("Added " + RULE_COUNT + " rules to each ReteBuilder's in " + format(System.currentTimeMillis() - start));
}
use of org.drools.core.reteoo.ReteooBuilder in project drools by kiegroup.
the class ReteooBuilderPerformanceTest method getReteBuilders.
private static ReteooBuilder[] getReteBuilders(int count) {
System.out.println("Creating " + count + " ReteBuilder's");
ReteooBuilder[] reteBuilders = new ReteooBuilder[count];
RuleBaseConfiguration conf = new RuleBaseConfiguration();
for (int i = 0; i < reteBuilders.length; i++) {
reteBuilders[i] = new ReteooBuilder(new KnowledgeBaseImpl("id1", conf));
}
return reteBuilders;
}
Aggregations