info.aduna.gee.publication.util
Class Range

java.lang.Object
  extended by info.aduna.gee.publication.util.Range

public class Range
extends Object

A range is a domain of legal values. This domain can both be restricted and unrestricted. In the former case, a range has a minimum and a maximum value and only values between them are valid. In the latter case, any value is valid ('*').


Field Summary
protected  int _maximum
          The maximum of the range
protected  int _minimum
          The minimum of the range - if minimum negative unrestricted
 
Constructor Summary
Range(int min, int max)
          Creates a restricted range.
 
Method Summary
 boolean includes(int value)
          Checks if the range includes a certain value.
 String toString()
          Returns a string representation of the range.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_minimum

protected int _minimum
The minimum of the range - if minimum negative unrestricted


_maximum

protected int _maximum
The maximum of the range

Constructor Detail

Range

public Range(int min,
             int max)
Creates a restricted range. Min and max are swapped if min is greater than max.

Parameters:
min - the minimum of the range.
max - the maximum of the range.
Method Detail

toString

public String toString()
Returns a string representation of the range. An unrestricted range is returned as an asterix ("*"), a restricted range is returned as the valid value ("3") or as the minimum and the maximum separated by a minus ("1-5").

Overrides:
toString in class Object
Returns:
the string representation of the range.

includes

public boolean includes(int value)
Checks if the range includes a certain value.

Parameters:
value - the value to check.
Returns:
true if the value is included, false otherwise.


Copyright © 1997-2008 Aduna. All Rights Reserved.