Class EPatternFeed.AbstractMatchFrame

  • Enclosing class:
    EPatternFeed

    protected abstract static class EPatternFeed.AbstractMatchFrame
    extends Object
    A match frame tracks an in-progress match. When a frame contains a complete pattern match the frame is used to generate the MatchEvent posted to the subscriber. Match frames are kept until either an event violates the pattern or the match completes.

    Base class for EOrderPatternFeed.MatchFrame and EUnorderedPatternFeed.MatchFrame.

    • Field Detail

      • mPatternName

        protected final String mPatternName
        Match frame created by this pattern. Used for logging purposes.
      • mAllEvents

        protected final List<ENotificationMessage> mAllEvents
        Contains all events matching the pattern so far. Since these events are repeatedly referenced by the matching algorithm, this list is kept for quick reference.
      • mUserCache

        protected final Map<Object,​Object> mUserCache
        Cache for storing interim, user-defined data calculated while performing a MatchCondition.
      • mIsExclusive

        protected final boolean mIsExclusive
        true if this match frame is for an exclusive pattern. That means events may not be used for multiple matches within the same pattern.
      • mIsDefunct

        protected boolean mIsDefunct
        Set to true when a match frame is 1) used for an exclusive pattern, 2) the pattern is completely matched, and 3) this frame contains common events with the completely matched frame. Otherwise, will be false. Marking a match frame as defunct allows for "lazy removal" from the frames queue.
    • Constructor Detail

      • AbstractMatchFrame

        protected AbstractMatchFrame​(String patternName,
                                     boolean isExclusive)
        Creates a new match frame for the given pattern and exclusivity flag.
        Parameters:
        patternName - pattern name.
        isExclusive - true if the pattern is exclusive.
      • AbstractMatchFrame

        protected AbstractMatchFrame​(EPatternFeed.AbstractMatchFrame frame)
        Copies the given frame data into this frame.
        Parameters:
        frame - copy this frame.
    • Method Detail

      • groupMap

        protected abstract Map<String,​List<ENotificationMessage>> groupMap()
        Returns a read-only copy of the group map. This is necessary since the returned map is passed to the client-defined match condition and the client is not allowed to modify this map.
        Returns:
        group map read-only copy.
      • patternName

        public final String patternName()
        Returns the pattern name.
        Returns:
        pattern name.
      • frameId

        public final int frameId()
        Returns the unique match frame identifier.
        Returns:
        match frame identifier.
      • isExclusive

        public final boolean isExclusive()
        Returns true if this is an exclusive feed; false otherwise.
        Returns:
        true if this is an exclusive feed;
      • allEvents

        public final List<ENotificationMessage> allEvents()
        Returns the "all events" collection as an unmodifiable list.
        Returns:
        unmodifiable all events list.
      • userCache

        public final Map<Object,​Object> userCache()
        Returns the user-defined match data cache.
        Returns:
        user match data cache.
      • isDefunct

        public final boolean isDefunct()
        Returns true if this match frame is defunct due to a prior exclusive matching and, therefore, may no longer be used.
        Returns:
        true if defunct.
      • setDefunct

        public final void setDefunct()
        Marks this match frame as defunct. Next time this frame is removed from the frame queue, it will be ignored.