boolean removeUntil ( int index , boolean inclusive ) { if ( index >= 0 ) { boolean changed = false ; PT startPoint = this . startingPoint ; ST segment ; int limit = index ; if ( inclusive ) { ++ limit ; } for ( int i = 0 ; i < limit ; ++ i ) { segment = this . segmentList . remove ( 0 ) ; this . length -= segment . getLength ( ) ; if ( this . length < 0 ) { this . length = 0 ; } startPoint = segment . getOtherSidePoint ( startPoint ) ; changed = true ; } if ( changed ) { if ( this . segmentList . isEmpty ( ) ) { this . startingPoint = null ; this . endingPoint = null ; this . isReversable = true ; } else { this . startingPoint = startPoint ; } return true ; } } return false ; }
Package access to avoid compilation error . You must not call this function directly .