edu.northwestern.at.monk.model
Class LongRange

java.lang.Object
  extended by edu.northwestern.at.monk.model.NumericRange
      extended by edu.northwestern.at.monk.model.LongRange
All Implemented Interfaces:
java.lang.Comparable<LongRange>

public class LongRange
extends NumericRange
implements java.lang.Comparable<LongRange>

A range of non-negative longs.

See Also:
MONK Datastore Overview, Licensing Agreement

Constructor Summary
LongRange(long value)
          Creates a new range of non-negative longs.
LongRange(java.lang.Long value)
          Creates a new range of non-negative longs.
LongRange(long start, long end)
          Creates a new range of non-negative longs.
LongRange(long start, java.lang.Long end)
          Creates a new range of non-negative longs.
LongRange(java.lang.Long start, long end)
          Creates a new range of non-negative longs.
LongRange(java.lang.Long start, java.lang.Long end)
          Creates a new range of non-negative longs.
 
Method Summary
 int compareTo(LongRange other)
          Compares this instance with another.
 boolean equals(java.lang.Object obj)
          Returns true if this object equals some other object.
 java.lang.Long getEnd()
          Gets the end of the range.
 java.lang.Long getStart()
          Gets the start of the range.
 int hashCode()
          Returns a hash code for this object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LongRange

public LongRange(long value)
          throws ModelException
Creates a new range of non-negative longs.

Parameters:
value - Start and end of range.
Throws:
ModelException -
Should never be thrown

LongRange

public LongRange(java.lang.Long value)
          throws ModelException
Creates a new range of non-negative longs.

Parameters:
value - Start and end of range, or null if none.
Throws:
ModelException -
Should never be thrown

LongRange

public LongRange(long start,
                 long end)
          throws ModelException
Creates a new range of non-negative longs.

Parameters:
start - Start of range.
end - End of range.
Throws:
ModelException -
Start is greater than end in range: start-end. (if start > end)

LongRange

public LongRange(java.lang.Long start,
                 long end)
          throws ModelException
Creates a new range of non-negative longs.

Parameters:
start - Start of range, or null if none.
end - End of range.
Throws:
ModelException -
Start is greater than end in range: start-end. (if start > end)

LongRange

public LongRange(long start,
                 java.lang.Long end)
          throws ModelException
Creates a new range of non-negative longs.

Parameters:
start - Start of range.
end - End of range, or null if none.
Throws:
ModelException -
Start is greater than end in range: start-end. (if start > end)

LongRange

public LongRange(java.lang.Long start,
                 java.lang.Long end)
          throws ModelException
Creates a new range of non-negative longs.

Parameters:
start - Start of range, or null if none.
end - End of range, or null if none.
Throws:
ModelException -
Start is greater than end in range: start-end. (if start > end)
Method Detail

getStart

public java.lang.Long getStart()
Gets the start of the range.

Returns:
Start of range, or null if none.

getEnd

public java.lang.Long getEnd()
Gets the end of the range.

Returns:
End of range, or null if none.

equals

public boolean equals(java.lang.Object obj)
Returns true if this object equals some other object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - Other object.
Returns:
True if this object equals the other object.

hashCode

public int hashCode()
Returns a hash code for this object.

Overrides:
hashCode in class java.lang.Object
Returns:
Hash code.

compareTo

public int compareTo(LongRange other)
Compares this instance with another.

Long ranges are ordered first by start, then by end, with null less than all non-nulls.

Specified by:
compareTo in interface java.lang.Comparable<LongRange>
Parameters:
other - The other instance to be compared.
Returns:
A negative integer, zero, or a positive integer as this instance is less than, equal to, or greater than the specified instance.