public Integer getAgeI() { Triple t = map.get( propertyKey( "age" ) ); if ( t == null || t.getValue() == null ) { return null; } return (Integer) t.getValue(); }
public int getAge() { Triple t = map.get( propertyKey( "age" ) ); if ( t == null || t.getValue() == null ) { return 0; } return (Integer) t.getValue(); }
public Object remove(Object key) { Object val; // any hard field must be 0-fied // any soft field must be 0-fied on the map // other fields will effectively be removed if ( "name".equals( key ) ) { val = name_reader.getValue( object ); name_writer.setValue( object, null ); return val; } if ( "bol".equals( key ) ) { val = bit_reader.getIntValue( object ); bit_writer.setIntValue( object, 0 ); return val; } if ( "age".equals( key ) ) { val = this.store.get( propertyKey( "age" ) ); super.put( "age", 0 ); return val; } val = super.remove( key ); return val; }
@Test public void testPutAndGetandRemove() { // We know it needs to hold a lot of triples, so instantiate it with huge capacity. // A lower capacity ensures a larger capacity per number of triples, i.e. less collision - default is 0.75f TripleStore store = new TripleStore(10*100*1000, 0.6f ); Individual ind = new Individual(); Triple t = new TripleImpl(ind, "hasName", "mark"); assertFalse( store.put( t ) ); Triple tKey = new TripleImpl(ind, "hasName", V ); t = store.get( tKey ); assertEquals("mark", t.getValue() ); t = new TripleImpl(ind, "hasName", V ); assertEquals( 1, store.removeAll( t ) ); assertFalse( store.remove( t ) ); // try again and make sure it's false. tKey = new TripleImpl(ind, "hasName", V ); assertNull( store.get( tKey ) ); }
@Test public void testPutAndGetWithExisting() { // We know it needs to hold a lot of triples, so instantiate it with huge capacity. // A lower capacity ensures a larger capacity per number of triples, i.e. less collision - default is 0.75f TripleStore store = new TripleStore(10*100*1000, 0.6f ); Individual ind = new Individual(); Triple t = new TripleImpl(ind, "hasName", "mark"); assertFalse( store.put( t ) ); Triple tKey = new TripleImpl(ind, "hasName", V ); t = store.get( tKey ); assertEquals("mark", t.getValue() ); t = new TripleImpl(ind, "hasName", "davide"); assertTrue( store.put( t ) ); tKey = new TripleImpl(ind, "hasName", V ); t = store.get( tKey ); assertEquals("davide", t.getValue() ); }
@Test public void testPutAndGet() { // We know it needs to hold a lot of triples, so instantiate it with huge capacity. // A lower capacity ensures a larger capacity per number of triples, i.e. less collision - default is 0.75f TripleStore store = new TripleStore(10*100*1000, 0.6f ); Individual ind = new Individual(); Triple t = new TripleImpl(ind, "hasName", "mark"); assertFalse( store.put( t ) ); Triple tKey = new TripleImpl(ind, "hasName", V ); t = store.get( tKey ); assertEquals("mark", t.getValue() ); }
public boolean containsKey(Object key) { return store.get( propertyKey( key ) ) != null; }
public Object get(Object key) { Triple t = store.get( propertyKey( key ) ); return t == null ? null : t.getValue(); }
public Object remove(Object key) { return store.remove( store.get( propertyKey ( key ) ) ); }
public Object get( Object key ) { Triple t = store.get( tripleFactory.newTriple( key, TripleStore.PROXY, Variable.v ) ); while ( t != null ) { Object o = t.getValue(); if ( o instanceof TraitProxy && (( TraitProxy ) o ).getObject() == this.object ) { return o; } else { t = (Triple) t.getNext(); } } return null; }
Triple t = get( triple ); if ( t != null ) {