protected PhysicalEntity [ ] fillArray ( PhysicalEntity parent , PhysicalEntity target , int depth , int dir ) { if ( parent == target ) { PhysicalEntity [ ] pes = new PhysicalEntity [ depth ] ; pes [ 0 ] = target ; return pes ; } if ( parent instanceof Complex ) { for ( PhysicalEntity mem : ( ( Complex ) parent ) . getComponent ( ) ) { PhysicalEntity [ ] pes = fillArray ( mem , target , depth + 1 , 0 ) ; if ( pes != null ) { pes [ pes . length - depth ] = parent ; return pes ; } } } if ( dir <= 0 ) for ( PhysicalEntity mem : parent . getMemberPhysicalEntity ( ) ) { PhysicalEntity [ ] pes = fillArray ( mem , target , depth + 1 , - 1 ) ; if ( pes != null ) { pes [ pes . length - depth ] = parent ; return pes ; } } if ( dir >= 0 ) for ( PhysicalEntity grand : parent . getMemberPhysicalEntityOf ( ) ) { PhysicalEntity [ ] pes = fillArray ( grand , target , depth + 1 , 1 ) ; if ( pes != null ) { pes [ pes . length - depth ] = parent ; return pes ; } } return null ; }
Creates the chain that links the given endpoints .