public void offer ( Event event ) { sequence += event . toString ( ) ; //check pattern matching if ( patterns != null && sequence . length ( ) > 0 ) { for ( int i = 0 ; i < patterns . length ; i ++ ) { if ( sequence . matches ( patterns [ i ] ) ) { listener . patternMatches ( i , sequence ) ; //nullify sequence; sequence = "" ; return ; } } } //check the amount of detected event and notify listener //if limit reached. if ( count > 0 && sequence . length ( ) == count ) { listener . countMatches ( sequence ) ; sequence = "" ; count = - 1 ; } }
Queues next event to the buffer .