MarkerSegment findMarkerSegment(Class cls,boolean first){
  if (first) {
    Iterator iter=markerSequence.iterator();
    while (iter.hasNext()) {
      MarkerSegment seg=(MarkerSegment)iter.next();
      if (cls.isInstance(seg)) {
        return seg;
      }
    }
  }
 else {
    ListIterator iter=markerSequence.listIterator(markerSequence.size());
    while (iter.hasPrevious()) {
      MarkerSegment seg=(MarkerSegment)iter.previous();
      if (cls.isInstance(seg)) {
        return seg;
      }
    }
  }
  return null;
}

MarkerSegment findMarkerSegment ( Class cls , boolean first ) { if ( first ) { Iterator iter = markerSequence . iterator ( ) ; while ( iter . hasNext ( ) ) { MarkerSegment seg = ( MarkerSegment ) iter . next ( ) ; if ( cls . isInstance ( seg ) ) { return seg ; } } } else { ListIterator iter = markerSequence . listIterator ( markerSequence . size ( ) ) ; while ( iter . hasPrevious ( ) ) { MarkerSegment seg = ( MarkerSegment ) iter . previous ( ) ; if ( cls . isInstance ( seg ) ) { return seg ; } } } return null ; }
returns the first or last markersegment object in the list of the given class , or null if none is found .
