public boolean contains ( int partitionId ) { if ( lowerID < upperID ) { //"Proper" id range return lowerID <= partitionId && upperID > partitionId ; } else { //Id range "wraps around" return ( lowerID <= partitionId && partitionId < idUpperBound ) || ( upperID > partitionId && partitionId >= 0 ) ; } }
Returns true of the given partitionId lies within this partition id range else false .