Package adams.gui.core
Class NumberTextField.BoundedNumberCheckModel
- java.lang.Object
-
- adams.gui.core.CheckedTextField.AbstractCheckModel
-
- adams.gui.core.NumberTextField.NumberCheckModel
-
- adams.gui.core.NumberTextField.BoundedNumberCheckModel
-
- All Implemented Interfaces:
Serializable
- Enclosing class:
- NumberTextField
public static class NumberTextField.BoundedNumberCheckModel extends NumberTextField.NumberCheckModel
A check model for numbers. The type of number to check for can be specified.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Numberm_LowerBoundthe lower bound (null for unbounded).protected Numberm_UpperBoundthe upper bound (null for unbounded).-
Fields inherited from class adams.gui.core.NumberTextField.NumberCheckModel
m_Type
-
Fields inherited from class adams.gui.core.CheckedTextField.AbstractCheckModel
m_DefaultValue
-
-
Constructor Summary
Constructors Constructor Description BoundedNumberCheckModel(NumberTextField.Type type, Number lower, Number upper)Initializes the model with 0 as default value.BoundedNumberCheckModel(NumberTextField.Type type, Number lower, Number upper, Number defValue)Initializes the model with the specified default value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NumbergetLowerBound()Returns the lower bound, if any.NumbergetUpperBound()Returns the upper bound, if any.booleanisValid(String text)Checks whether the content is valid.StringtoString()Returns a short string representation.-
Methods inherited from class adams.gui.core.NumberTextField.NumberCheckModel
getType
-
Methods inherited from class adams.gui.core.CheckedTextField.AbstractCheckModel
getDefaultValue, setDefaultValue
-
-
-
-
Constructor Detail
-
BoundedNumberCheckModel
public BoundedNumberCheckModel(NumberTextField.Type type, Number lower, Number upper)
Initializes the model with 0 as default value.- Parameters:
type- the type of number to handlelower- the lower bound (null for unbounded)upper- the upper bound (null for unbounded)
-
BoundedNumberCheckModel
public BoundedNumberCheckModel(NumberTextField.Type type, Number lower, Number upper, Number defValue)
Initializes the model with the specified default value.- Parameters:
type- the type of number to handlelower- the lower bound (null for unbounded)upper- the upper bound (null for unbounded)defValue- the default value, use "null" to use as null
-
-
Method Detail
-
isValid
public boolean isValid(String text)
Checks whether the content is valid.- Overrides:
isValidin classNumberTextField.NumberCheckModel- Parameters:
text- the string to check- Returns:
- true if valid
-
getLowerBound
public Number getLowerBound()
Returns the lower bound, if any.- Returns:
- the lower bound, null if unbounded
-
getUpperBound
public Number getUpperBound()
Returns the upper bound, if any.- Returns:
- the upper bound, null if unbounded
-
toString
public String toString()
Returns a short string representation.- Overrides:
toStringin classNumberTextField.NumberCheckModel- Returns:
- the string representation
-
-