All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class net.strandberg.util.IntIntervalSet

java.lang.Object
   |
   +----net.strandberg.util.IntIntervalSet

public class IntIntervalSet
extends Object
Class IntIntervalSet represents a set of intervals.

Version:
$Revision: 0.0 $
Author:
Mats Strandberg

Constructor Index

 o IntIntervalSet()
Constructs an "empty" IntIntervalSet.

Method Index

 o add(int, int)
Adds an IntInterval to this set.
 o add(IntInterval)
Adds an IntInterval to this set.
 o create(String)
Creates an IntIntervalSet by parsing the string given as input.
 o includes(int)
Checks if the given integer is inside the interval set.
 o main(String[])
Tests the class.
 o toString()
Returns a string representation of the object.

Constructors

 o IntIntervalSet
 public IntIntervalSet()
Constructs an "empty" IntIntervalSet.

Methods

 o main
 public static void main(String args[])
Tests the class.

 o create
 public static IntIntervalSet create(String s)
Creates an IntIntervalSet by parsing the string given as input. The string should be on the format
integerInterval[,integerInterval]*
i.e. one or many integer intervals; separated by commas.
The integerInterval is on the form integer or integer-integer. Examples of valid input strings are then:
125
7-125
5,7-125
There's no support for parsing negative values

Parameters:
s - the string to be parsed
Returns:
an IntIntervalSet or null if the string couldn't be parsed
See Also:
IntInterval
 o add
 public void add(IntInterval ii)
Adds an IntInterval to this set.

Parameters:
ii - IntInterval to add
 o add
 public void add(int lower,
                 int upper)
Adds an IntInterval to this set.

Parameters:
lower - lower limit for the interval (inclusive)
upper - upper limit for the interval (inclusive)
 o includes
 public boolean includes(int i)
Checks if the given integer is inside the interval set.

Parameters:
i - the integer to check against the interval set
Returns:
true if the integer is inside the interval set
 o toString
 public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index