org.quattor.pan.utils
Class Range

java.lang.Object
  extended by org.quattor.pan.utils.Range

public class Range
extends java.lang.Object

Represents a range associated with a type.

Author:
loomis

Constructor Summary
Range(long minimum, long maximum)
          Constructs an inclusive Range from the two values given.
Range(java.lang.String minimum, java.lang.String maximum)
          A convenience constructor which takes two longs encoded as strings and creates a Range.
 
Method Summary
 boolean isInRange(double test)
          Test whether the given double value is within this range.
 boolean isInRange(long test)
          Test whether the given long value is within this range.
 java.lang.String toString()
          Provide a formatted String describing this Range.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Range

public Range(java.lang.String minimum,
             java.lang.String maximum)
A convenience constructor which takes two longs encoded as strings and creates a Range. An IllegalArgumentException will be thrown if either string does not contain a valid long value. It will also throw an IllegalArgumentException if the minimum value is less than zero or the minimum value is greater than the maximum value.

Parameters:
minimum -
maximum -

Range

public Range(long minimum,
             long maximum)
Constructs an inclusive Range from the two values given. It will throw an IllegalArgumentException if the minimum value is less than zero or the minimum value is greater than the maximum. Use Long.MAX_VALUE for the maximum if you want an unbounded range.

Parameters:
minimum -
maximum -
Method Detail

isInRange

public boolean isInRange(long test)
Test whether the given long value is within this range.

Parameters:
test -

isInRange

public boolean isInRange(double test)
Test whether the given double value is within this range. *

Parameters:
test -

toString

public java.lang.String toString()
Provide a formatted String describing this Range.

Overrides:
toString in class java.lang.Object


Copyright © 2011 Quattor. All Rights Reserved.