/** * Prunes matches/partial matches based on the chosen strategy. * * @param matchesToPrune current partial matches * @param matchedResult already completed matches * @param sharedBufferAccessor accessor to corresponding shared buffer * @throws Exception thrown if could not access the state */ public void prune( Collection<ComputationState> matchesToPrune, Collection<Map<String, List<EventId>>> matchedResult, SharedBufferAccessor<?> sharedBufferAccessor) throws Exception { EventId pruningId = getPruningId(matchedResult); if (pruningId != null) { List<ComputationState> discardStates = new ArrayList<>(); for (ComputationState computationState : matchesToPrune) { if (computationState.getStartEventID() != null && shouldPrune(computationState.getStartEventID(), pruningId)) { sharedBufferAccessor.releaseNode(computationState.getPreviousBufferEntry()); discardStates.add(computationState); } } matchesToPrune.removeAll(discardStates); } }
nfaState.getPartialMatches().removeIf(pm -> pm.getStartEventID() != null && !partialMatches.contains(pm));
private void serializeSingleComputationState( ComputationState computationState, DataOutputView target) throws IOException { StringValue.writeString(computationState.getCurrentStateName(), target); nodeIdSerializer.serialize(computationState.getPreviousBufferEntry(), target); versionSerializer.serialize(computationState.getVersion(), target); target.writeLong(computationState.getStartTimestamp()); serializeStartEvent(computationState.getStartEventID(), target); }
version, computationState.getStartTimestamp(), computationState.getStartEventID() ); } else { startTimestamp = computationState.getStartTimestamp(); startEventId = computationState.getStartEventID();
/** * Prunes matches/partial matches based on the chosen strategy. * * @param matchesToPrune current partial matches * @param matchedResult already completed matches * @param sharedBufferAccessor accessor to corresponding shared buffer * @throws Exception thrown if could not access the state */ public void prune( Collection<ComputationState> matchesToPrune, Collection<Map<String, List<EventId>>> matchedResult, SharedBufferAccessor<?> sharedBufferAccessor) throws Exception { EventId pruningId = getPruningId(matchedResult); if (pruningId != null) { List<ComputationState> discardStates = new ArrayList<>(); for (ComputationState computationState : matchesToPrune) { if (computationState.getStartEventID() != null && shouldPrune(computationState.getStartEventID(), pruningId)) { sharedBufferAccessor.releaseNode(computationState.getPreviousBufferEntry()); discardStates.add(computationState); } } matchesToPrune.removeAll(discardStates); } }
/** * Prunes matches/partial matches based on the chosen strategy. * * @param matchesToPrune current partial matches * @param matchedResult already completed matches * @param sharedBufferAccessor accessor to corresponding shared buffer * @throws Exception thrown if could not access the state */ public void prune( Collection<ComputationState> matchesToPrune, Collection<Map<String, List<EventId>>> matchedResult, SharedBufferAccessor<?> sharedBufferAccessor) throws Exception { EventId pruningId = getPruningId(matchedResult); if (pruningId != null) { List<ComputationState> discardStates = new ArrayList<>(); for (ComputationState computationState : matchesToPrune) { if (computationState.getStartEventID() != null && shouldPrune(computationState.getStartEventID(), pruningId)) { sharedBufferAccessor.releaseNode(computationState.getPreviousBufferEntry()); discardStates.add(computationState); } } matchesToPrune.removeAll(discardStates); } }
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 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); } } }
nfaState.getPartialMatches().removeIf(pm -> pm.getStartEventID() != null && !partialMatches.contains(pm));
nfaState.getPartialMatches().removeIf(pm -> pm.getStartEventID() != null && !partialMatches.contains(pm));
version, computationState.getStartTimestamp(), computationState.getStartEventID() ); } else { startTimestamp = computationState.getStartTimestamp(); startEventId = computationState.getStartEventID();
version, computationState.getStartTimestamp(), computationState.getStartEventID() ); } else { startTimestamp = computationState.getStartTimestamp(); startEventId = computationState.getStartEventID();