private Grammar getEqualGrammar ( Grammar gr ) { for ( Grammar gx : this . grammars ) { if ( gr == gx ) { // System.out.println("Exactly the same grammar found: " + gx); return gx ; } if ( isSameGrammarType ( gr , gx ) ) { // type of grammar the same if ( gr . getNumberOfEvents ( ) == gx . getNumberOfEvents ( ) ) { List < Grammar > handled = new ArrayList < Grammar > ( ) ; if ( isEqualGrammar ( gr , gx , handled ) ) { // the same grammar found // System.out.println("Same grammar found for: " + gx + // " == " + gr); return gx ; } } } } return null ; }
! = null ... found equal grammar