public Edge findEdgeInSameDirection(Coordinate p0,Coordinate p1){
  for (int i=0; i < edges.size(); i++) {
    Edge e=(Edge)edges.get(i);
    Coordinate[] eCoord=e.getCoordinates();
    if (matchInSameDirection(p0,p1,eCoord[0],eCoord[1]))     return e;
    if (matchInSameDirection(p0,p1,eCoord[eCoord.length - 1],eCoord[eCoord.length - 2]))     return e;
  }
  return null;
}

public Edge findEdgeInSameDirection ( Coordinate p0 , Coordinate p1 ) { for ( int i = 0 ; i < edges . size ( ) ; i ++ ) { Edge e = ( Edge ) edges . get ( i ) ; Coordinate [ ] eCoord = e . getCoordinates ( ) ; if ( matchInSameDirection ( p0 , p1 , eCoord [ 0 ] , eCoord [ 1 ] ) ) return e ; if ( matchInSameDirection ( p0 , p1 , eCoord [ eCoord . length - 1 ] , eCoord [ eCoord . length - 2 ] ) ) return e ; } return null ; }
returns the edge which starts at p0 and whose first segment is parallel to p1
