private PriorityQueue<ComputationState> deserializeComputationStates(DataInputView source) throws IOException { PriorityQueue<ComputationState> computationStates = new PriorityQueue<>(NFAState.COMPUTATION_STATE_COMPARATOR); int computationStateNo = source.readInt(); for (int i = 0; i < computationStateNo; i++) { String state = STATE_NAME_SERIALIZER.deserialize(source); NodeId prevState = NODE_ID_SERIALIZER.deserialize(source); DeweyNumber version = VERSION_SERIALIZER.deserialize(source); long startTimestamp = TIMESTAMP_SERIALIZER.deserialize(source); byte isNull = source.readByte(); EventId startEventId = null; if (isNull == 1) { startEventId = EVENT_ID_SERIALIZER.deserialize(source); } computationStates.add(ComputationState.createState(state, prevState, version, startTimestamp, startEventId)); } return computationStates; }
private void serializeComputationStates(Queue<ComputationState> states, DataOutputView target) throws IOException { target.writeInt(states.size()); for (ComputationState computationState : states) { STATE_NAME_SERIALIZER.serialize(computationState.getCurrentStateName(), target); NODE_ID_SERIALIZER.serialize(computationState.getPreviousBufferEntry(), target); VERSION_SERIALIZER.serialize(computationState.getVersion(), target); TIMESTAMP_SERIALIZER.serialize(computationState.getStartTimestamp(), target); if (computationState.getStartEventID() != null) { target.writeByte(1); EVENT_ID_SERIALIZER.serialize(computationState.getStartEventID(), target); } else { target.writeByte(0); } } }
private void copyStates(DataInputView source, DataOutputView target) throws IOException { int computationStateNo = source.readInt(); target.writeInt(computationStateNo); for (int i = 0; i < computationStateNo; i++) { String state = STATE_NAME_SERIALIZER.deserialize(source); STATE_NAME_SERIALIZER.serialize(state, target); NodeId prevState = NODE_ID_SERIALIZER.deserialize(source); NODE_ID_SERIALIZER.serialize(prevState, target); DeweyNumber version = VERSION_SERIALIZER.deserialize(source); VERSION_SERIALIZER.serialize(version, target); long startTimestamp = TIMESTAMP_SERIALIZER.deserialize(source); TIMESTAMP_SERIALIZER.serialize(startTimestamp, target); byte isNull = source.readByte(); target.writeByte(isNull); if (isNull == 1) { EventId startEventId = EVENT_ID_SERIALIZER.deserialize(source); EVENT_ID_SERIALIZER.serialize(startEventId, target); } } }
private void copyStates(DataInputView source, DataOutputView target) throws IOException { int computationStateNo = source.readInt(); target.writeInt(computationStateNo); for (int i = 0; i < computationStateNo; i++) { String state = STATE_NAME_SERIALIZER.deserialize(source); STATE_NAME_SERIALIZER.serialize(state, target); NodeId prevState = NODE_ID_SERIALIZER.deserialize(source); NODE_ID_SERIALIZER.serialize(prevState, target); DeweyNumber version = VERSION_SERIALIZER.deserialize(source); VERSION_SERIALIZER.serialize(version, target); long startTimestamp = TIMESTAMP_SERIALIZER.deserialize(source); TIMESTAMP_SERIALIZER.serialize(startTimestamp, target); byte isNull = source.readByte(); target.writeByte(isNull); if (isNull == 1) { EventId startEventId = EVENT_ID_SERIALIZER.deserialize(source); EVENT_ID_SERIALIZER.serialize(startEventId, target); } } }
private PriorityQueue<ComputationState> deserializeComputationStates(DataInputView source) throws IOException { PriorityQueue<ComputationState> computationStates = new PriorityQueue<>(NFAState.COMPUTATION_STATE_COMPARATOR); int computationStateNo = source.readInt(); for (int i = 0; i < computationStateNo; i++) { String state = STATE_NAME_SERIALIZER.deserialize(source); NodeId prevState = NODE_ID_SERIALIZER.deserialize(source); DeweyNumber version = VERSION_SERIALIZER.deserialize(source); long startTimestamp = TIMESTAMP_SERIALIZER.deserialize(source); byte isNull = source.readByte(); EventId startEventId = null; if (isNull == 1) { startEventId = EVENT_ID_SERIALIZER.deserialize(source); } computationStates.add(ComputationState.createState(state, prevState, version, startTimestamp, startEventId)); } return computationStates; }
private void serializeComputationStates(Queue<ComputationState> states, DataOutputView target) throws IOException { target.writeInt(states.size()); for (ComputationState computationState : states) { STATE_NAME_SERIALIZER.serialize(computationState.getCurrentStateName(), target); NODE_ID_SERIALIZER.serialize(computationState.getPreviousBufferEntry(), target); VERSION_SERIALIZER.serialize(computationState.getVersion(), target); TIMESTAMP_SERIALIZER.serialize(computationState.getStartTimestamp(), target); if (computationState.getStartEventID() != null) { target.writeByte(1); EVENT_ID_SERIALIZER.serialize(computationState.getStartEventID(), target); } else { target.writeByte(0); } } }
@Override public EventId deserialize(EventId reuse, DataInputView source) throws IOException { return deserialize(source); }
@Override public EventId copy(EventId from, EventId reuse) { return copy(from); }
@Override public NodeId deserialize(DataInputView source) throws IOException { byte b = source.readByte(); if (b == 0) { return null; } EventId eventId = EventId.EventIdSerializer.INSTANCE.deserialize(source); String pageName = StringSerializer.INSTANCE.deserialize(source); return new NodeId(eventId, pageName); }
@Override public void serialize(NodeId record, DataOutputView target) throws IOException { if (record != null) { target.writeByte(1); EventId.EventIdSerializer.INSTANCE.serialize(record.eventId, target); StringSerializer.INSTANCE.serialize(record.pageName, target); } else { target.writeByte(0); } }
@Override public EventId deserialize(EventId reuse, DataInputView source) throws IOException { return deserialize(source); }
@Override public EventId copy(EventId from, EventId reuse) { return copy(from); }
@Override public void serialize(NodeId record, DataOutputView target) throws IOException { if (record != null) { target.writeByte(1); EventId.EventIdSerializer.INSTANCE.serialize(record.eventId, target); StringSerializer.INSTANCE.serialize(record.pageName, target); } else { target.writeByte(0); } }
@Override public NodeId deserialize(DataInputView source) throws IOException { byte b = source.readByte(); if (b == 0) { return null; } EventId eventId = EventId.EventIdSerializer.INSTANCE.deserialize(source); String pageName = StringSerializer.INSTANCE.deserialize(source); return new NodeId(eventId, pageName); }
@Override public EventId deserialize(EventId reuse, DataInputView source) throws IOException { return deserialize(source); }
@Override public EventId copy(EventId from, EventId reuse) { return copy(from); }