@ Override public Collection < BioPAXElement > generate ( Match match , int ... ind ) { assertIndLength ( ind ) ; PhysicalEntity pe1 = ( PhysicalEntity ) match . get ( ind [ 0 ] ) ; Conversion conv = ( Conversion ) match . get ( ind [ 1 ] ) ; Set < PhysicalEntity > parts ; if ( conv . getLeft ( ) . contains ( pe1 ) ) { parts = sideType == Type . OTHER_SIDE ? conv . getRight ( ) : conv . getLeft ( ) ; } else if ( conv . getRight ( ) . contains ( pe1 ) ) { parts = sideType == Type . SAME_SIDE ? conv . getRight ( ) : conv . getLeft ( ) ; } else throw new IllegalArgumentException ( "The PhysicalEntity has to be a participant of the Conversion." ) ; if ( blacklist == null ) return new HashSet < BioPAXElement > ( parts ) ; else { ConversionDirectionType dir = getDirection ( conv ) ; if ( ( dir == ConversionDirectionType . LEFT_TO_RIGHT && ( ( relType == RelType . INPUT && parts != conv . getLeft ( ) ) || ( relType == RelType . OUTPUT && parts != conv . getRight ( ) ) ) ) || ( dir == ConversionDirectionType . RIGHT_TO_LEFT && ( ( relType == RelType . INPUT && parts != conv . getRight ( ) ) || ( relType == RelType . OUTPUT && parts != conv . getLeft ( ) ) ) ) ) return Collections . emptySet ( ) ; return new HashSet < BioPAXElement > ( blacklist . getNonUbiques ( parts , relType ) ) ; } }
Checks which side is the first PhysicalEntity and gathers participants on either the other side or the same side .