@Test public void testStringData2() { final int count = 100000; final ObjectHashMap map = new ObjectHashMap(); assertNotNull( map ); final long start = System.currentTimeMillis(); for ( int idx = 0; idx < count; idx++ ) { final String key = "key" + idx; final String strval = "value" + idx; map.put( key, strval ); } final long end = System.currentTimeMillis(); System.out.println( "Custom ObjectHashMap put(key,value) ET - " + ((end - start)) ); }
@Test public void testStringData5() { final int count = 100000; final ObjectHashMap map = new ObjectHashMap(); assertNotNull( map ); final long start = System.currentTimeMillis(); for ( int idx = 0; idx < count; idx++ ) { final String key = "key" + idx; final String strval = "value" + idx; map.put( key, strval, false ); } final long end = System.currentTimeMillis(); System.out.println( "Custom ObjectHashMap dup false ET - " + ((end - start)) ); } }
@Test public void testStringData3() { 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(); for ( int idx = 0; idx < count; idx++ ) { final String key = "key" + idx; map.get( key ); } final long end = System.currentTimeMillis(); System.out.println( "Custom ObjectHashMap get(key) ET - " + ((end - start)) ); }
@Test public void testIntegerData() { final ObjectHashMap map = new ObjectHashMap(); assertNotNull( map ); final int count = 1000; for ( int idx = 0; idx < count; idx++ ) { final Integer key = new Integer( idx ); final Integer val = new Integer( idx ); map.put( key, val ); assertEquals( val, map.get( key ) ); } }
@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)) ); }
@Test public void testEmptyIterator() { final ObjectHashMap map = new ObjectHashMap(); final Iterator it = map.iterator(); for ( ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next() ) { fail( "Map is empty, there should be no iteration" ); } }
@Test public void testStringData() { final ObjectHashMap map = new ObjectHashMap(); assertNotNull( map ); final int count = 1000; for ( int idx = 0; idx < count; idx++ ) { final String key = "key" + idx; final String val = "value" + idx; map.put( key, val ); assertEquals( val, map.get( key ) ); } }
@Test public void testStringDataDupFalse() { final ObjectHashMap map = new ObjectHashMap(); assertNotNull( map ); final int count = 10000; for ( int idx = 0; idx < count; idx++ ) { final String key = "key" + idx; final String val = "value" + idx; map.put( key, val, false ); assertEquals( val, map.get( key ) ); } }
public TruthMaintenanceSystem(final AbstractWorkingMemory wm) { this.wm = wm; this.justifiedMap = new ObjectHashMap(); this.assertMap = new ObjectHashMap(); this.assertMap.setComparator( EqualityKeyComparator.getInstance() ); beliefSystem = wm.getSessionConfiguration().getBeliefSystemType().createInstance( wm, this ); }
public SingleThreadedObjectStore(RuleBaseConfiguration conf, Lock lock) { this.behaviour = conf.getAssertBehaviour(); this.lock = lock; this.assertMap = new ObjectHashMap(); if ( AssertBehaviour.IDENTITY.equals(this.behaviour) ) { this.assertMap.setComparator( new IdentityAssertMapComparator() ); this.identityMap = assertMap; } else { this.assertMap.setComparator( new EqualityAssertMapComparator() ); this.identityMap = new ObjectHashMap(); this.identityMap.setComparator( new IdentityAssertMapComparator() ); } }
void hashSinks(final FieldIndex fieldIndex) { if ( this.hashedSinkMap == null ) { this.hashedSinkMap = new ObjectHashMap();