public NodeId getNodeId(String prevState, long timestamp, int counter, V event) { return mappingContext.get(Tuple2.of(NFAStateNameHandler.getOriginalNameFromInternal(prevState), new ValueTimeWrapper<>(event, timestamp, counter))); }
@Override public boolean equals(Object obj) { if (!(obj instanceof ValueTimeWrapper)) { return false; } @SuppressWarnings("unchecked") ValueTimeWrapper<V> other = (ValueTimeWrapper<V>) obj; return timestamp == other.getTimestamp() && Objects.equals(value, other.getValue()) && counter == other.getCounter(); }
ValueTimeWrapper<V> wrapper = ValueTimeWrapper.deserialize(valueSerializer, source); EventId eventId = values.get(wrapper); if (eventId == null) {
completePath.put(k, values); values.add(currentPathEntry.getValueTime().getValue());
ValueTimeWrapper<V> wrapper = ValueTimeWrapper.deserialize(valueSerializer, source); EventId eventId = values.get(wrapper); if (eventId == null) {
ValueTimeWrapper<V> wrapper = ValueTimeWrapper.deserialize(valueSerializer, source); EventId eventId = values.get(wrapper); if (eventId == null) {
long timestamp = ois.readLong(); ValueTimeWrapper<V> valueTimeWrapper = new ValueTimeWrapper<>(value, timestamp, 0); SharedBufferEntry<K, V> sharedBufferEntry = new SharedBufferEntry<K, V>(valueTimeWrapper, page);
valueSerializer.serialize(valueTimeWrapper.getValue(), target); target.writeLong(valueTimeWrapper.getTimestamp()); target.writeInt(valueTimeWrapper.getCounter());
int counter = source.readInt(); ValueTimeWrapper<V> valueTimeWrapper = new ValueTimeWrapper<>(value, timestamp, counter); SharedBufferEntry<K, V> sharedBufferEntry = new SharedBufferEntry<K, V>(valueTimeWrapper, page);
private int put( final K key, final V value, final long timestamp, final SharedBufferEntry<K, V> previousSharedBufferEntry, final DeweyNumber version) { SharedBufferPage<K, V> page = pages.get(key); if (page == null) { page = new SharedBufferPage<>(key); pages.put(key, page); } // this assumes that elements are processed in order (in terms of time) int counter = 0; if (previousSharedBufferEntry != null) { ValueTimeWrapper<V> prev = previousSharedBufferEntry.getValueTime(); if (prev != null && prev.getTimestamp() == timestamp) { counter = prev.getCounter() + 1; } } page.add(new ValueTimeWrapper<>(value, timestamp, counter), previousSharedBufferEntry, version); return counter; }
@Override public boolean equals(Object obj) { if (obj instanceof SharedBufferEdge) { @SuppressWarnings("unchecked") SharedBufferEdge<K, V> other = (SharedBufferEdge<K, V>) obj; if (version.equals(other.version)) { if (target == null && other.target == null) { return true; } else if (target != null && other.target != null) { return target.getKey().equals(other.target.getKey()) && target.getValueTime().equals(other.target.getValueTime()); } else { return false; } } else { return false; } } else { return false; } }
/** * Removes all entries from the map whose timestamp is smaller than the pruning timestamp. * * @param pruningTimestamp Timestamp for the pruning */ public void prune(long pruningTimestamp) { Iterator<Map.Entry<ValueTimeWrapper<V>, SharedBufferEntry<K, V>>> iterator = entries.entrySet().iterator(); boolean continuePruning = true; while (iterator.hasNext() && continuePruning) { SharedBufferEntry<K, V> entry = iterator.next().getValue(); if (entry.getValueTime().getTimestamp() <= pruningTimestamp) { iterator.remove(); } else { continuePruning = false; } } }
public NodeId getNodeId(String prevState, long timestamp, int counter, V event) { return mappingContext.get(Tuple2.of(NFAStateNameHandler.getOriginalNameFromInternal(prevState), new ValueTimeWrapper<>(event, timestamp, counter))); }
public NodeId getNodeId(String prevState, long timestamp, int counter, V event) { return mappingContext.get(Tuple2.of(NFAStateNameHandler.getOriginalNameFromInternal(prevState), new ValueTimeWrapper<>(event, timestamp, counter))); }
@Override public boolean equals(Object obj) { if (!(obj instanceof ValueTimeWrapper)) { return false; } @SuppressWarnings("unchecked") ValueTimeWrapper<V> other = (ValueTimeWrapper<V>) obj; return timestamp == other.getTimestamp() && Objects.equals(value, other.getValue()) && counter == other.getCounter(); }
@Override public boolean equals(Object obj) { if (!(obj instanceof ValueTimeWrapper)) { return false; } @SuppressWarnings("unchecked") ValueTimeWrapper<V> other = (ValueTimeWrapper<V>) obj; return timestamp == other.getTimestamp() && Objects.equals(value, other.getValue()) && counter == other.getCounter(); }
@Override public boolean equals(Object obj) { if (obj instanceof ValueTimeWrapper) { @SuppressWarnings("unchecked") ValueTimeWrapper<V> other = (ValueTimeWrapper<V>) obj; return timestamp == other.getTimestamp() && value.equals(other.getValue()) && counter == other.getCounter(); } else { return false; } }
private SharedBufferEntry<K, V> get( final K key, final V value, final long timestamp, final int counter) { SharedBufferPage<K, V> page = pages.get(key); return page == null ? null : page.get(new ValueTimeWrapper<V>(value, timestamp, counter)); }
public static <V> ValueTimeWrapper<V> deserialize( final TypeSerializer<V> valueSerializer, final DataInputView source) throws IOException { final V value = valueSerializer.deserialize(source); final long timestamp = source.readLong(); final int counter = source.readInt(); return new ValueTimeWrapper<>(value, timestamp, counter); } }
@Override public boolean equals(Object obj) { if (obj instanceof SharedBufferEntry) { @SuppressWarnings("unchecked") SharedBufferEntry<K, V> other = (SharedBufferEntry<K, V>) obj; return valueTime.equals(other.valueTime) && getKey().equals(other.getKey()) && referenceCounter == other.referenceCounter && edges.equals(other.edges); } else { return false; } }