org.jbind.xml.base
Class Range

java.lang.Object
  extended byorg.jbind.xml.base.Range
All Implemented Interfaces:
IRange

public class Range
extends java.lang.Object
implements IRange


Field Summary
static IRange ONE
           
static IRange ZERO
           
static IRange ZERO_TO_UNBOUNDED
           
 
Constructor Summary
Range(int aMinOccurs)
           
Range(int aMinOccurs, int aMaxOccurs)
           
 
Method Summary
 boolean compareMaxOccurs(int anInt)
          Checks if the maxOccurs is equal to the specified integer.
static IRange createRange(int aMin, int aMax, boolean anIsUnbounded)
           
 int getMaxOccurs()
          Gets the maximum number of occurences.
 int getMinOccurs()
          Gets the minimum number of occurences.
 boolean isOne()
          Checks if the range has a minOccurs and a maxOccurs of 1.
 boolean isUnbounded()
          Checks if the range is unbounded, i.e.
 boolean isZero()
          Checks if the range has minOccurs and a maxOccurs of 0.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZERO

public static final IRange ZERO

ONE

public static final IRange ONE

ZERO_TO_UNBOUNDED

public static final IRange ZERO_TO_UNBOUNDED
Constructor Detail

Range

public Range(int aMinOccurs,
             int aMaxOccurs)

Range

public Range(int aMinOccurs)
Method Detail

createRange

public static IRange createRange(int aMin,
                                 int aMax,
                                 boolean anIsUnbounded)

isUnbounded

public boolean isUnbounded()
Description copied from interface: IRange
Checks if the range is unbounded, i.e. has no upper bound.

Specified by:
isUnbounded in interface IRange
Returns:
Returns true iff the range is unbounded.

compareMaxOccurs

public boolean compareMaxOccurs(int anInt)
Description copied from interface: IRange
Checks if the maxOccurs is equal to the specified integer. This check must not be performed using the getMaxOccurs method directly because that method must only be called if the range is not unbounded.

Specified by:
compareMaxOccurs in interface IRange
Returns:
Returns true iff the maxOccurs is equal to the specified integer.

getMinOccurs

public int getMinOccurs()
Description copied from interface: IRange
Gets the minimum number of occurences.

Specified by:
getMinOccurs in interface IRange
Returns:
The minimum number of occurences.

getMaxOccurs

public int getMaxOccurs()
Description copied from interface: IRange
Gets the maximum number of occurences. This method must only be called if the range is not unbounded.

Specified by:
getMaxOccurs in interface IRange
Returns:
The maximum number of occurences.

isZero

public boolean isZero()
Description copied from interface: IRange
Checks if the range has minOccurs and a maxOccurs of 0.

Specified by:
isZero in interface IRange
Returns:
Returns true iff minOccurs and maxOccurs are 0.

isOne

public boolean isOne()
Description copied from interface: IRange
Checks if the range has a minOccurs and a maxOccurs of 1.

Specified by:
isOne in interface IRange
Returns:
Returns true iff the minOccurs and the maxOccurs are 1.