private void processTree ( final GroupElement ce , boolean [ ] result ) throws InvalidPatternException { boolean hasChildOr = false ; // first we elimininate any redundancy ce . pack ( ) ; for ( Object child : ce . getChildren ( ) . toArray ( ) ) { if ( child instanceof GroupElement ) { final GroupElement group = ( GroupElement ) child ; processTree ( group , result ) ; if ( ( group . isOr ( ) || group . isAnd ( ) ) && group . getType ( ) == ce . getType ( ) ) { group . pack ( ce ) ; } else if ( group . isOr ( ) ) { hasChildOr = true ; } } else if ( child instanceof NamedConsequence ) { result [ 0 ] = true ; } else if ( child instanceof Pattern && ( ( Pattern ) child ) . getObjectType ( ) . isEvent ( ) ) { result [ 1 ] = true ; } } if ( hasChildOr ) { applyOrTransformation ( ce ) ; } }
Traverses a Tree during the process it transforms Or nodes moving the upwards and it removes duplicate logic statement this does not include Not nodes .