public Builder addSymbolStatistics(Symbol symbol, SymbolStatsEstimate statistics) { symbolStatistics = symbolStatistics.plus(symbol, statistics); return this; }
public MapPSet<E> plusAll(final Collection<? extends E> list) { PMap<E,Object> map = this.map; for(E e : list) map = map.plus(e, In.IN); return from(map); }
public MapPSet<E> plusAll(final Collection<? extends E> list) { PMap<E,Object> map = this.map; for(E e : list) map = map.plus(e, In.IN); return from(map); }
public MapPSet<E> plus(final E e) { if(contains(e)) return this; return new MapPSet<E>(map.plus(e, In.IN)); }
public MapPBag<E> plus(final E e) { return new MapPBag<E>(map.plus(e, count(e)+1), size+1); }
public MapPBag<E> plus(final E e) { return new MapPBag<E>(map.plus(e, count(e)+1), size+1); }
public MapPSet<E> plus(final E e) { if(contains(e)) return this; return new MapPSet<E>(map.plus(e, In.IN)); }
public HashPMap<K,V> plus(final K key, final V value) { PSequence<Entry<K,V>> entries = getEntries(key.hashCode()); int size0 = entries.size(), i = keyIndexIn(entries, key); if(i!=-1) entries = entries.minus(i); entries = entries.plus(new SimpleImmutableEntry<K,V>(key, value)); return new HashPMap<K,V>(intMap.plus(key.hashCode(), entries), size-size0+entries.size()); }
public HashPMap<K,V> plus(final K key, final V value) { PSequence<Entry<K,V>> entries = getEntries(key.hashCode()); int size0 = entries.size(), i = keyIndexIn(entries, key); if(i!=-1) entries = entries.minus(i); entries = entries.plus(new SimpleImmutableEntry<K,V>(key, value)); return new HashPMap<K,V>(intMap.plus(key.hashCode(), entries), size-size0+entries.size()); }
public HashPMap<K,V> minus(final Object key) { PSequence<Entry<K,V>> entries = getEntries(key.hashCode()); int i = keyIndexIn(entries, key); if(i==-1) // key not in this return this; entries = entries.minus(i); if(entries.size()==0) // get rid of the entire hash entry return new HashPMap<K,V>(intMap.minus(key.hashCode()), size-1); // otherwise replace hash entry with new smaller one: return new HashPMap<K,V>(intMap.plus(key.hashCode(), entries), size-1); }
public HashPMap<K,V> minus(final Object key) { PSequence<Entry<K,V>> entries = getEntries(key.hashCode()); int i = keyIndexIn(entries, key); if(i==-1) // key not in this return this; entries = entries.minus(i); if(entries.size()==0) // get rid of the entire hash entry return new HashPMap<K,V>(intMap.minus(key.hashCode()), size-1); // otherwise replace hash entry with new smaller one: return new HashPMap<K,V>(intMap.plus(key.hashCode(), entries), size-1); }
@SuppressWarnings("unchecked") public MapPBag<E> minus(final Object e) { int n = count(e); if(n==0) return this; if(n==1) // remove from map return new MapPBag<E>(map.minus(e), size-1); // otherwise just decrement count: return new MapPBag<E>(map.plus((E)e, n-1), size-1); }
@SuppressWarnings("unchecked") public MapPBag<E> minus(final Object e) { int n = count(e); if(n==0) return this; if(n==1) // remove from map return new MapPBag<E>(map.minus(e), size-1); // otherwise just decrement count: return new MapPBag<E>(map.plus((E)e, n-1), size-1); }
public void testMap() { PMap<Object,String> m = HashTreePMap.<Object,String>empty(); assertEquals(m.size(),0); m = m.plus(1,"One"); assertEquals(m.get(1),"One"); // last three have same hashCode: Object[] keys = {1,2,0,3,ConsPStack.empty()}; String[] values = {"one","two","","three","emptyList"}; for(int i=0;i<keys.length;i++) { m = m.plus(keys[i],values[i]); m = m.minus(keys[i]); m = m.plus(keys[i],values[i]); assertEquals(m.size(),i+1); assertEquals(m.get(keys[i]),values[i]); } for(int i=keys.length-1;i>=0;i--) { m = m.minus(keys[i]); assertEquals(m.size(),i); } }
public MapPSet<E> plusAll(final Collection<? extends E> list) { PMap<E, Object> map = this.map; for (E e : list) map = map.plus(e, In.IN); return from(map); }
@Synchronized("lock") private<R> SequenceM<R> connect(Function<Queue<T>,SequenceM<R>> streamCreator){ Queue<T> queue = this.getNextQueue(); SequenceM<R> stream = streamCreator.apply(queue); this.streamToQueue = streamToQueue.plus(stream,queue); return stream; }
private static <T> PMap<Property<? super T, ?>, PropertyValue<? super T, ?>> byProperty(PropertyValue<? super T, ?>[] propertyValues) { PMap<Property<? super T, ?>, PropertyValue<? super T, ?>> propertyMap = HashTreePMap.empty(); for (PropertyValue<? super T, ?> propertyValue : propertyValues) { propertyMap = propertyMap.plus(propertyValue.property(), propertyValue); } return propertyMap; }
public Events removeEvent(UUID scopeId, UUID eventId) { PMap<UUID, EventRecord> scope = this.events.get(scopeId); if (scope == null) { throw new IllegalArgumentException("Scope not found: " + scopeId); } scope = scope.minus(eventId); if (scope.isEmpty()) { return new Events(this.events.minus(scopeId)); } else { return new Events(this.events.plus(scopeId, scope)); } }