|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--xbn.XBNObject | +--xbn.util.RangeConfig
Defines the legal range for an integer. See Range.
Source code: RangeConfig.java. Unit tests: xbn_junit.JUTRangeConfig.java.
There are four elements of a range:
A range is always inclusive. That is, a number is considered legal when the value is between the minimum and maximum bounds or equal to them. If you need your range to be exclusive, then set the minimum bound to (minimum bound + 1) and maximum bound to (maximum bound - 1).
Fields inherited from class xbn.XBNObject |
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP |
Constructor Summary | |
RangeConfig()
Create a, completely unrestricted, RangeConfig object. |
|
RangeConfig(int i_min,
boolean b_nfrcMin,
int i_max,
boolean b_nfrcMax)
Create a RangeConfig. |
|
RangeConfig(int i_min,
int i_max)
Create a RangeConfig. |
|
RangeConfig(RangeConfig range_config)
Create a copy of the provided RangeConfig. |
Method Summary | |
int |
getMax()
What is the maximum legal value for this range? |
int |
getMin()
What is the minimum legal value for this range? |
boolean |
isMaxEnforced()
Is the maximum bound enforced? |
boolean |
isMinEnforced()
Is the minimum bound enforced? |
boolean |
isRestricted()
Are there any restrictions imposed by this RCLength? |
boolean |
isValid(int i_potential)
Is the potential value valid for this Range? |
String |
toString()
Get some information about this RangeConfig. |
String |
toString(boolean b_className)
Get some information about this RangeConfig. |
Methods inherited from class xbn.XBNObject |
getXMsgPrefix, sop, sopl, sopl, throwAX, throwAXIfBadStr, throwAXIfNull, throwAXSpoof |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public RangeConfig()
Create a, completely unrestricted, RangeConfig object.
Equal to RangeConfig(-1, false, -1, false)
public RangeConfig(int i_min, int i_max)
Create a RangeConfig.
Equal to RangeConfig(i_min, true, i_max, true)
public RangeConfig(int i_min, boolean b_nfrcMin, int i_max, boolean b_nfrcMax)
Create a RangeConfig.
All parameters must be valid according to UtilInt.areRangeBoundsValid(i_min, b_nfrcMin, i_max, b_nfrcMax, true)
i_min
- The minimum bound. See getMin.b_nfrcMin
- The minimum bound. See isMinEnforced.i_max
- The minimum bound. See getMax.b_nfrcMax
- The minimum bound. See isMaxEnforced.public RangeConfig(RangeConfig range_config)
Create a copy of the provided RangeConfig.
range_config
- The range config to copy. May not be null.Method Detail |
public final boolean isMinEnforced()
Is the minimum bound enforced?
public final boolean isMaxEnforced()
Is the maximum bound enforced?
public final int getMin()
What is the minimum legal value for this range?
public final int getMax()
What is the maximum legal value for this range?
public final boolean isValid(int i_potential)
Is the potential value valid for this Range?
Equal to UtilInt.isInRange(i_potential, getMin(), isMinEnforced(), getMax(), isMaxEnforced(), false)
public boolean isRestricted()
Are there any restrictions imposed by this RCLength?
(isMinEnforced() || isMaxEnforced())
public String toString()
Get some information about this RangeConfig.
Equal to toString(true)
toString
in class Object
public String toString(boolean b_className)
Get some information about this RangeConfig.
b_className
- If true, display the class name at the beginning of the returned string. If false, don't.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1997-2003, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.
http://sourceforge.net/projects/xbnjava