@Test public void testStringData4() { final int count = 100000; final ObjectHashMap map = new ObjectHashMap(); assertNotNull( map ); for ( int idx = 0; idx < count; idx++ ) { final String key = "key" + idx; final String strval = "value" + idx; map.put( key, strval ); } final long start = System.currentTimeMillis(); final org.drools.core.util.Iterator itr = map.iterator(); Object val = null; while ( (val = itr.next()) != null ) { val.hashCode(); } final long end = System.currentTimeMillis(); System.out.println( "Custom ObjectHashMap iterate ET - " + ((end - start)) ); }
for ( AgendaItem act = (AgendaItem) it.next(); act != null; act = (AgendaItem) it.next() ) { list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s" ) + ":" + act.isQueued() ); for ( AgendaItem act = (AgendaItem) it.next(); act != null; act = (AgendaItem) it.next() ) { list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s" ) + ":" + act.isQueued() );
for ( AgendaItem act = (AgendaItem) it.next(); act != null; act = (AgendaItem) it.next() ) { list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s" ) + ":" + act.isQueued() ); for ( AgendaItem act = (AgendaItem) it.next(); act != null; act = (AgendaItem) it.next() ) { list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s" ) + ":" + act.isQueued() );
for ( AgendaItem act = (AgendaItem) it.next(); act != null; act = (AgendaItem) it.next() ) { list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s1" ) + ":" + act.getDeclarationValue( "$s2" ) + ":" + act.isQueued() ); for ( AgendaItem act = (AgendaItem) it.next(); act != null; act = (AgendaItem) it.next() ) { list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s1" ) + ":" + act.getDeclarationValue( "$s2" ) + ":" + act.isQueued() );
for ( AgendaItem act = (AgendaItem) it.next(); act != null; act = (AgendaItem) it.next() ) { list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s1" ) + ":" + act.getDeclarationValue( "$s2" ) + ":" + act.isQueued() ); it = ActivationIterator.iterator( ksession ); list = new ArrayList(); for ( AgendaItem act = (AgendaItem) it.next(); act != null; act = (AgendaItem) it.next() ) { list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s1" ) + ":" + act.getDeclarationValue( "$s2" ) + ":" + act.isQueued() );
for ( AgendaItem act = (AgendaItem) it.next(); act != null; act = (AgendaItem) it.next() ) { list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s" ) + ":" + act.isQueued() ); for ( AgendaItem act = (AgendaItem) it.next(); act != null; act = (AgendaItem) it.next() ) { list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s" ) + ":" + act.isQueued() );
for ( AgendaItem act = (AgendaItem) it.next(); act != null; act = (AgendaItem) it.next() ) { list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s" ) + ":" + act.isQueued() ); for ( AgendaItem act = (AgendaItem) it.next(); act != null; act = (AgendaItem) it.next() ) { list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s" ) + ":" + act.isQueued() );
Assertions.assertThat(betaMemory.getLeftTupleMemory().size()).isEqualTo(2); Iterator<LeftTuple> it = tupleMemory.iterator(); for ( LeftTuple next = it.next(); next != null; next = it.next() ) { final Object obj = next.getFactHandle().getObject(); Assertions.assertThat(obj == charlie || obj == debbie).isTrue(); Assertions.assertThat(betaMemory.getLeftTupleMemory().size()).isEqualTo(1); it = tupleMemory.iterator(); for ( LeftTuple next = it.next(); next != null; next = it.next() ) { final Object obj = next.getFactHandle().getObject(); Assertions.assertThat(obj == charlie).isTrue();
@Test(timeout = 10000 ) public void testDefeatOutcomePosNeg() { KieSession kSession = getSession( "org/drools/compiler/beliefsystem/defeasible/negDefeatPos.drl" ); ArrayList list = new ArrayList(); kSession.setGlobal( "list", list ); kSession.fireAllRules(); TruthMaintenanceSystem tms = ((NamedEntryPoint) kSession.getEntryPoint( "DEFAULT" )).getTruthMaintenanceSystem(); FactType Xtype = kSession.getKieBase().getFactType( "org.drools.defeasible", "X" ); ObjectHashMap keys = tms.getEqualityKeyMap(); Iterator iter = keys.iterator(); ObjectHashMap.ObjectEntry entry; while ( ( entry = ( ObjectHashMap.ObjectEntry) iter.next() ) != null ) { EqualityKey key = (EqualityKey) entry.getValue(); Class factClass = key.getFactHandle().getObject().getClass(); if ( factClass == Xtype.getFactClass() ) { checkStatus( key, 1, DefeasibilityStatus.DEFEASIBLY ); } else { fail( "Unrecognized object has been logically justified : " + factClass ); } } assertEquals( 2, kSession.getObjects().size() ); assertEquals( 1, getNegativeObjects(kSession).size() ); assertEquals( 1, list.size() ); assertTrue( list.contains( "-1" ) ); }
for ( AgendaItem act = (AgendaItem) it.next(); act != null; act = (AgendaItem) it.next() ) { if ( act.getRule().getName().equals( "rule3" ) ) { list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s1" ) + ":" + act.getDeclarationValue( "$s2" ) + ":" + act.getDeclarationValue( "$s3" ) + ":" + act.isQueued() );
for ( AgendaItem act = (AgendaItem) it.next(); act != null; act = (AgendaItem) it.next() ) { if ( act.getRule().getName().equals( "rule3" ) ) { list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s1" ) + ":" + act.getDeclarationValue( "$s2" ) + ":" + act.getDeclarationValue( "$s3" ) + ":" + act.isQueued() ); for ( AgendaItem act = (AgendaItem) it.next(); act != null; act = (AgendaItem) it.next() ) { if ( act.getRule().getName().equals( "rule3" ) ) { list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s1" ) + ":" + act.getDeclarationValue( "$s2" ) + ":" + act.getDeclarationValue( "$s3" ) + ":" + act.isQueued() );