public Long getRelativePosition ( Long position ) { long relativePosition = 0L ; for ( Location location : locations ) { if ( location instanceof RemoteLocation ) { relativePosition += location . getLength ( ) ; } else { if ( position < location . getBeginPosition ( ) || position > location . getEndPosition ( ) ) { relativePosition += location . getLength ( ) ; } else { if ( location . isComplement ( ) ) { relativePosition += ( location . getEndPosition ( ) - position + 1 ) ; } else { relativePosition += ( position - location . getBeginPosition ( ) + 1 ) ; } if ( isComplement ( ) ) { relativePosition = getLength ( ) - relativePosition + 1 ; } return relativePosition ; } } } return null ; }
Returns the sequence position relative to the compound location .