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); }
size0 = pseq.size(); inBounds = j>=0 && j<=pseq.size(); pseq = pseq.plus(j, r.nextInt()); if (!inBounds) fail(); } catch (IndexOutOfBoundsException e) { size0 = pseq.size(); inBounds = j>=0 && j<=pseq.size(); pseq = pseq.plusAll(j, TreePVector.singleton(r.nextInt())); if (!inBounds) fail(); } catch (IndexOutOfBoundsException e) { size0 = pseq.size(); inBounds = j>=0 && j<pseq.size(); pseq = pseq.with(j, r.nextInt()); if (!inBounds) fail(); } catch (IndexOutOfBoundsException e) { size0 = pseq.size(); inBounds = j>=0 && j<pseq.size(); pseq = pseq.minus(j); if (!inBounds) fail(); } catch (IndexOutOfBoundsException e) { pseq = pseq.plus(r.nextInt());
public boolean hasNext() { return seq.size()>0 || i.hasNext(); }
public ActivateFlowsAction addFlows(List<String> elementIds, int count) { PSequence<Flow> flows = this.flows; for (String elementId : elementIds) { flows = flows.plus(new Flow(elementId, count)); } return new ActivateFlowsAction(definitionId, flows); }
@Override public <Event extends AggregateEvent<Event>> void register(Class<? extends ReadSideProcessor<Event>> processorClass) { ReadSideProcessor<Event> processor = injector.getInstance(processorClass); PSequence<AggregateEventTag<Event>> eventTags = processor.aggregateTags(); CompletionStage<Done> processorInit = processor.buildHandler().globalPrepare().thenCompose(x -> { AggregateEventTag<Event> tag = eventTags.get(0); ReadSideHandler<Event> handler = processor.buildHandler(); return handler.prepare(tag).thenApply(offset -> { List<Pair<ReadSideHandler<?>, Offset>> currentHandlers = processors.computeIfAbsent(tag.eventType(), (z) -> new ArrayList<>()); currentHandlers.add(Pair.create(handler, offset)); return Done.getInstance(); }); }); try { processorInit.toCompletableFuture().get(30, SECONDS); } catch (Exception e) { throw new RuntimeException("Couldn't register the processor on the testkit.", e); } }
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 boolean hasNext() { return seq.size()>0 || i.hasNext(); }
public ActivateFlowsAction addFlow(String elementId, int count) { return new ActivateFlowsAction(definitionId, flows.plus(new Flow(elementId, count))); }
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 boolean hasNext() { return seq.size() > 0 || i.hasNext(); }
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 boolean hasNext() { return seq.size()>0 || i.hasNext(); }
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 org.pcollections.SimpleImmutableEntry<K, V>(key, value)); return new HashPMap<K, V>(intMap.plus(key.hashCode(), entries), size - size0 + entries.size()); }