/** * Extracts all the sequences of events from the start to the given computation state. An event * sequence is returned as a map which contains the events and the names of the states to which * the events were mapped. * * @param sharedBufferAccessor The accessor to {@link SharedBuffer} from which to extract the matches * @param computationState The end computation state of the extracted event sequences * @return Collection of event sequences which end in the given computation state * @throws Exception Thrown if the system cannot access the state. */ private Map<String, List<EventId>> extractCurrentMatches( final SharedBufferAccessor<T> sharedBufferAccessor, final ComputationState computationState) throws Exception { if (computationState.getPreviousBufferEntry() == null) { return new HashMap<>(); } List<Map<String, List<EventId>>> paths = sharedBufferAccessor.extractPatterns( computationState.getPreviousBufferEntry(), computationState.getVersion()); if (paths.isEmpty()) { return new HashMap<>(); } // for a given computation state, we cannot have more than one matching patterns. Preconditions.checkState(paths.size() == 1); return paths.get(0); }
nfaState.getCompletedMatches().poll(); List<Map<String, List<EventId>>> matchedResult = sharedBufferAccessor.extractPatterns(earliestMatch.getPreviousBufferEntry(), earliestMatch.getVersion());
Map<String, List<T>> materializedMatch = sharedBufferAccessor.materializeMatch( sharedBufferAccessor.extractPatterns( match.getPreviousBufferEntry(), match.getVersion()).get(0)
NodeId c = sharedBufferAccessor.put("c", eventIds[4], bb, DeweyNumber.fromString("1.0.0.0.0")); Map<String, List<Event>> patternsResult = sharedBufferAccessor.materializeMatch(sharedBufferAccessor.extractPatterns(c, DeweyNumber.fromString("1.0.0.0.0")).get(0));
NodeId b3 = sharedBufferAccessor.put("b", eventIds[7], aLoop5, DeweyNumber.fromString("1.1.0")); List<Map<String, List<EventId>>> patterns3 = sharedBufferAccessor.extractPatterns(b3, DeweyNumber.fromString("1.1.0")); assertEquals(1L, patterns3.size()); sharedBufferAccessor.releaseNode(b3); List<Map<String, List<EventId>>> patterns4 = sharedBufferAccessor.extractPatterns(b3, DeweyNumber.fromString("1.1.0")); assertEquals(0L, patterns4.size()); assertTrue(patterns4.isEmpty()); List<Map<String, List<EventId>>> patterns1 = sharedBufferAccessor.extractPatterns(b1, DeweyNumber.fromString("2.0.0")); assertEquals(1L, patterns1.size()); assertEquals(expectedPattern1, sharedBufferAccessor.materializeMatch(patterns1.get(0))); List<Map<String, List<EventId>>> patterns2 = sharedBufferAccessor.extractPatterns(b0, DeweyNumber.fromString("1.0.0")); assertEquals(1L, patterns2.size());
/** * Extracts all the sequences of events from the start to the given computation state. An event * sequence is returned as a map which contains the events and the names of the states to which * the events were mapped. * * @param sharedBufferAccessor The accessor to {@link SharedBuffer} from which to extract the matches * @param computationState The end computation state of the extracted event sequences * @return Collection of event sequences which end in the given computation state * @throws Exception Thrown if the system cannot access the state. */ private Map<String, List<EventId>> extractCurrentMatches( final SharedBufferAccessor<T> sharedBufferAccessor, final ComputationState computationState) throws Exception { if (computationState.getPreviousBufferEntry() == null) { return new HashMap<>(); } List<Map<String, List<EventId>>> paths = sharedBufferAccessor.extractPatterns( computationState.getPreviousBufferEntry(), computationState.getVersion()); if (paths.isEmpty()) { return new HashMap<>(); } // for a given computation state, we cannot have more than one matching patterns. Preconditions.checkState(paths.size() == 1); return paths.get(0); }
/** * Extracts all the sequences of events from the start to the given computation state. An event * sequence is returned as a map which contains the events and the names of the states to which * the events were mapped. * * @param sharedBufferAccessor The accessor to {@link SharedBuffer} from which to extract the matches * @param computationState The end computation state of the extracted event sequences * @return Collection of event sequences which end in the given computation state * @throws Exception Thrown if the system cannot access the state. */ private Map<String, List<EventId>> extractCurrentMatches( final SharedBufferAccessor<T> sharedBufferAccessor, final ComputationState computationState) throws Exception { if (computationState.getPreviousBufferEntry() == null) { return new HashMap<>(); } List<Map<String, List<EventId>>> paths = sharedBufferAccessor.extractPatterns( computationState.getPreviousBufferEntry(), computationState.getVersion()); if (paths.isEmpty()) { return new HashMap<>(); } // for a given computation state, we cannot have more than one matching patterns. Preconditions.checkState(paths.size() == 1); return paths.get(0); }
nfaState.getCompletedMatches().poll(); List<Map<String, List<EventId>>> matchedResult = sharedBufferAccessor.extractPatterns(earliestMatch.getPreviousBufferEntry(), earliestMatch.getVersion());
nfaState.getCompletedMatches().poll(); List<Map<String, List<EventId>>> matchedResult = sharedBufferAccessor.extractPatterns(earliestMatch.getPreviousBufferEntry(), earliestMatch.getVersion());
Map<String, List<T>> materializedMatch = sharedBufferAccessor.materializeMatch( sharedBufferAccessor.extractPatterns( match.getPreviousBufferEntry(), match.getVersion()).get(0)
Map<String, List<T>> materializedMatch = sharedBufferAccessor.materializeMatch( sharedBufferAccessor.extractPatterns( match.getPreviousBufferEntry(), match.getVersion()).get(0)