|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.common.model.FreeColObject
net.sf.freecol.common.option.AbstractOption<java.lang.Integer>
net.sf.freecol.common.option.IntegerOption
public class IntegerOption
Represents an option where the valid choice is an integer.
| Field Summary | |
|---|---|
private static java.util.logging.Logger |
logger
|
private int |
maximumValue
|
private int |
minimumValue
|
private int |
value
|
| Fields inherited from class net.sf.freecol.common.option.AbstractOption |
|---|
isDefined |
| Fields inherited from class net.sf.freecol.common.model.FreeColObject |
|---|
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, NO_ID, PARTIAL_ATTRIBUTE, UNDEFINED, VALUE_TAG |
| Constructor Summary | |
|---|---|
IntegerOption(Specification specification)
Creates a new IntegerOption. |
|
IntegerOption(java.lang.String id)
Creates a new IntegerOption. |
|
IntegerOption(java.lang.String id,
Specification specification)
Creates a new IntegerOption. |
|
| Method Summary | |
|---|---|
IntegerOption |
clone()
|
int |
getMaximumValue()
Returns the maximum allowed value. |
int |
getMinimumValue()
Returns the minimum allowed value. |
protected java.lang.String |
getStringValue()
Gets a String representation of the current value. |
java.lang.Integer |
getValue()
Gets the current value of this IntegerOption. |
static java.lang.String |
getXMLElementTagName()
Gets the tag name of the root element representing this object. |
protected void |
readAttributes(javax.xml.stream.XMLStreamReader in)
Reads the attributes of this object from an XML stream. |
void |
setMaximumValue(int maximumValue)
Sets the maximum allowed value. |
void |
setMinimumValue(int minimumValue)
Sets the minimum allowed value. |
void |
setValue(java.lang.Integer value)
Sets the value of this IntegerOption. |
protected void |
setValue(java.lang.String value)
Converts the given String to an Integer and calls
setValue(Integer). |
protected void |
setValue(java.lang.String valueString,
java.lang.String defaultValueString)
Sets the value of this Option from the given string representation. |
java.lang.String |
toString()
Returns a textual representation of this object. |
protected void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out)
This method writes an XML-representation of this object to the given stream. |
protected void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out,
java.lang.String tag)
|
| Methods inherited from class net.sf.freecol.common.option.AbstractOption |
|---|
generateChoices, getGroup, isNullValueOK, readFromXMLImpl, readOption, setGroup, setValues |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.sf.freecol.common.option.Option |
|---|
getId, readFromXML, toXML |
| Field Detail |
|---|
private static java.util.logging.Logger logger
private int value
private int minimumValue
private int maximumValue
| Constructor Detail |
|---|
public IntegerOption(java.lang.String id)
IntegerOption.
id - The identifier for this option. This is used when the object
should be found in an OptionGroup.public IntegerOption(Specification specification)
IntegerOption.
specification - The specification this option belongs
to. May be null.
public IntegerOption(java.lang.String id,
Specification specification)
IntegerOption.
id - The identifier for this option. This is used when the object
should be found in an OptionGroup.specification - The specification this option belongs
to. May be null.| Method Detail |
|---|
public IntegerOption clone()
clone in interface Option<java.lang.Integer>clone in class AbstractOption<java.lang.Integer>public int getMinimumValue()
public void setMinimumValue(int minimumValue)
minimumValue - The minimum value to setpublic int getMaximumValue()
public void setMaximumValue(int maximumValue)
maximumValue - the maximum value to setpublic java.lang.Integer getValue()
IntegerOption.
getValue in interface Option<java.lang.Integer>getValue in class AbstractOption<java.lang.Integer>public void setValue(java.lang.Integer value)
IntegerOption.
setValue in interface Option<java.lang.Integer>setValue in class AbstractOption<java.lang.Integer>value - The value to be set.protected java.lang.String getStringValue()
String representation of the current value.
This method can be overwritten by subclasses to allow a custom save
value, since this method is used by FreeColObject.toXML(XMLStreamWriter).
setValue(String)protected void setValue(java.lang.String value)
String to an Integer and calls
setValue(Integer).
FreeColObject.readFromXML(XMLStreamReader).
value - The String value of the Integer.getStringValue()
protected void setValue(java.lang.String valueString,
java.lang.String defaultValueString)
setValue in class AbstractOption<java.lang.Integer>valueString - the string representation of the value of
this OptiondefaultValueString - the string representation of the
default value of this Option
protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
toXMLImpl in class FreeColObjectout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out,
java.lang.String tag)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected void readAttributes(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readAttributes in class AbstractOption<java.lang.Integer>in - The XML input stream.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.public static java.lang.String getXMLElementTagName()
public java.lang.String toString()
Option
toString in interface Option<java.lang.Integer>toString in class java.lang.ObjectOption.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||