Algorithm
Development Kit 1.0

algs.model
Interface IInterval

All Known Implementing Classes:
DiscreteInterval, SegmentTreeNode, StoredIntervalsNode

public interface IInterval

A segment has a left and a right index and is understood to represent a semi-closed range [left, right). In otherwords, the value 'left' intersects this segment while the value 'right' does not. To be a proper segment, the left value must be strictly less than the right value. While this is assumed to be an invariant, code that depends upon IInterval may choose to check this assumption where appropriate. Implementations of this class must provide Object.equals(Object), Object.hashCode() and Object.toString().

Since:
1.0
Version:
1.0, 6/15/08
Author:
George Heineman

Method Summary
 int getLeft()
          Return left index.
 int getRight()
          Return right index.
 boolean intersects(int q)
          Determines if the q value is greater than or equal to getLeft() and strictly less than getRight()
 boolean toTheLeft(int q)
          Determines if the q value is strictly less than the getLeft() value.
 boolean toTheRight(int q)
          Determines if the q value is greater than or equal to the getRight() value.
 

Method Detail

getLeft

int getLeft()
Return left index.

Returns:
left index whose value is strictly less than right index

getRight

int getRight()
Return right index.

Returns:
right index whose value is strictly greater than left index

toTheLeft

boolean toTheLeft(int q)
Determines if the q value is strictly less than the getLeft() value.

Parameters:
q -

toTheRight

boolean toTheRight(int q)
Determines if the q value is greater than or equal to the getRight() value.

Parameters:
q -

intersects

boolean intersects(int q)
Determines if the q value is greater than or equal to getLeft() and strictly less than getRight()

Parameters:
q -

Algorithm Development Kit 1.0

This code supports the Algorithms in a Nutshell book, published by O'Reilly Media, Inc. in November 2008. Please visit the book web page to learn of any changes to the code repository or to record a potential defect.