@ Override public Collection < BioPAXElement > generate ( Match match , int ... ind ) { PhysicalEntity pe = ( PhysicalEntity ) match . get ( ind [ 0 ] ) ; Conversion conv = ( Conversion ) match . get ( ind [ 1 ] ) ; if ( ! ( ( peType == RelType . INPUT && getConvParticipants ( conv , RelType . INPUT ) . contains ( pe ) ) || ( peType == RelType . OUTPUT && getConvParticipants ( conv , RelType . OUTPUT ) . contains ( pe ) ) ) ) throw new IllegalArgumentException ( "peType = " + peType + ", and related participant set does not contain this PE. Conv dir = " + getDirection ( conv ) + " conv.id=" + conv . getUri ( ) + " pe.id=" + pe . getUri ( ) ) ; boolean rightContains = conv . getRight ( ) . contains ( pe ) ; boolean leftContains = conv . getLeft ( ) . contains ( pe ) ; assert rightContains || leftContains : "PE is not a participant." ; Set < BioPAXElement > result = new HashSet < BioPAXElement > ( ) ; ConversionDirectionType avoidDir = ( leftContains && rightContains ) ? null : peType == RelType . OUTPUT ? ( leftContains ? ConversionDirectionType . LEFT_TO_RIGHT : ConversionDirectionType . RIGHT_TO_LEFT ) : ( rightContains ? ConversionDirectionType . LEFT_TO_RIGHT : ConversionDirectionType . RIGHT_TO_LEFT ) ; for ( Object o : controlledOf . getValueFromBean ( conv ) ) { Control ctrl = ( Control ) o ; ConversionDirectionType dir = getDirection ( conv , ctrl ) ; if ( avoidDir != null && dir == avoidDir ) continue ; // don't collect this if the pe is ubique in the context of this control if ( blacklist != null && blacklist . isUbique ( pe , conv , dir , peType ) ) continue ; result . add ( ctrl ) ; } return result ; }
According to the relation between PhysicalEntity and the Conversion checks of the Control is relevant . If relevant it is retrieved .