edu.jhu.cs.cisst.algorithms.optimize.fmg.util
Class IntRange1D

java.lang.Object
  extended by edu.jhu.cs.cisst.algorithms.optimize.fmg.util.IntRange1D

public class IntRange1D
extends java.lang.Object

A class to represent a one-diensional range of integer values.

Author:
Gerald Loeffler (Gerald.Loeffler@univie.ac.at)

Constructor Summary
IntRange1D(int lower, int upper)
          construct from lower and upper boundary.
 
Method Summary
 int from()
          return lower boundary.
 int size()
          return the number of integer values lying in the range.
 int to()
          return upper boundary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntRange1D

public IntRange1D(int lower,
                  int upper)
construct from lower and upper boundary.

It is perfectly legal for lower boundary value to be greater then the upper boundary value.

The upper boundary is considered being part of the range.

Parameters:
lower - the lower boundary of the range
upper - the upper boundary of the range
Method Detail

from

public int from()
return lower boundary.

Returns:
the lower boundary of the range

to

public int to()
return upper boundary.

Returns:
the upper boundary of the range

size

public int size()
return the number of integer values lying in the range.

The size is defined as lower - upper + 1, i.e. the upper boundary is part of the range.

Returns:
the size of the range which is upper - lower + 1