@Override public SharedBufferNode createInstance() { return new SharedBufferNode(new ArrayList<>()); }
@Override public SharedBufferNode deserialize(DataInputView source) throws IOException { List<SharedBufferEdge> edges = edgesSerializer.deserialize(source); return new SharedBufferNode(edges); }
@Override public SharedBufferNode copy(SharedBufferNode from) { return new SharedBufferNode(edgesSerializer.copy(from.edges)); }
int refCount = source.readInt(); entries.add(Tuple2.of(nodeId, new Lockable<>(new SharedBufferNode(), refCount))); mappingContext.put(Tuple2.of((String) stateName, wrapper), nodeId);
/** * Stores given value (value + timestamp) under the given state. It assigns a preceding element * relation to the previous entry. * * @param stateName name of the state that the event should be assigned to * @param eventId unique id of event assigned by this SharedBuffer * @param previousNodeId id of previous entry (might be null if start of new run) * @param version Version of the previous relation * @return assigned id of this element */ public NodeId put( final String stateName, final EventId eventId, @Nullable final NodeId previousNodeId, final DeweyNumber version) { if (previousNodeId != null) { lockNode(previousNodeId); } NodeId currentNodeId = new NodeId(eventId, getOriginalNameFromInternal(stateName)); Lockable<SharedBufferNode> currentNode = sharedBuffer.getEntry(currentNodeId); if (currentNode == null) { currentNode = new Lockable<>(new SharedBufferNode(), 0); lockEvent(eventId); } currentNode.getElement().addEdge(new SharedBufferEdge( previousNodeId, version)); sharedBuffer.upsertEntry(currentNodeId, currentNode); return currentNodeId; }
@Override public SharedBufferNode createInstance() { return new SharedBufferNode(new ArrayList<>()); }
@Override public SharedBufferNode createInstance() { return new SharedBufferNode(new ArrayList<>()); }
@Override public SharedBufferNode copy(SharedBufferNode from) { return new SharedBufferNode(edgesSerializer.copy(from.edges)); }
@Override public SharedBufferNode deserialize(DataInputView source) throws IOException { List<SharedBufferEdge> edges = edgesSerializer.deserialize(source); return new SharedBufferNode(edges); }
@Override public SharedBufferNode deserialize(DataInputView source) throws IOException { List<SharedBufferEdge> edges = edgesSerializer.deserialize(source); return new SharedBufferNode(edges); }
@Override public SharedBufferNode copy(SharedBufferNode from) { return new SharedBufferNode(edgesSerializer.copy(from.edges)); }
int refCount = source.readInt(); entries.add(Tuple2.of(nodeId, new Lockable<>(new SharedBufferNode(), refCount))); mappingContext.put(Tuple2.of((String) stateName, wrapper), nodeId);
int refCount = source.readInt(); entries.add(Tuple2.of(nodeId, new Lockable<>(new SharedBufferNode(), refCount))); mappingContext.put(Tuple2.of((String) stateName, wrapper), nodeId);
/** * Stores given value (value + timestamp) under the given state. It assigns a preceding element * relation to the previous entry. * * @param stateName name of the state that the event should be assigned to * @param eventId unique id of event assigned by this SharedBuffer * @param previousNodeId id of previous entry (might be null if start of new run) * @param version Version of the previous relation * @return assigned id of this element */ public NodeId put( final String stateName, final EventId eventId, @Nullable final NodeId previousNodeId, final DeweyNumber version) { if (previousNodeId != null) { lockNode(previousNodeId); } NodeId currentNodeId = new NodeId(eventId, getOriginalNameFromInternal(stateName)); Lockable<SharedBufferNode> currentNode = sharedBuffer.getEntry(currentNodeId); if (currentNode == null) { currentNode = new Lockable<>(new SharedBufferNode(), 0); lockEvent(eventId); } currentNode.getElement().addEdge(new SharedBufferEdge( previousNodeId, version)); sharedBuffer.upsertEntry(currentNodeId, currentNode); return currentNodeId; }
/** * Stores given value (value + timestamp) under the given state. It assigns a preceding element * relation to the previous entry. * * @param stateName name of the state that the event should be assigned to * @param eventId unique id of event assigned by this SharedBuffer * @param previousNodeId id of previous entry (might be null if start of new run) * @param version Version of the previous relation * @return assigned id of this element */ public NodeId put( final String stateName, final EventId eventId, @Nullable final NodeId previousNodeId, final DeweyNumber version) { if (previousNodeId != null) { lockNode(previousNodeId); } NodeId currentNodeId = new NodeId(eventId, getOriginalNameFromInternal(stateName)); Lockable<SharedBufferNode> currentNode = sharedBuffer.getEntry(currentNodeId); if (currentNode == null) { currentNode = new Lockable<>(new SharedBufferNode(), 0); lockEvent(eventId); } currentNode.getElement().addEdge(new SharedBufferEdge( previousNodeId, version)); sharedBuffer.upsertEntry(currentNodeId, currentNode); return currentNodeId; }