|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jstatcom.model.AbstractJSCData com.jstatcom.model.JSCInt
public final class JSCInt
An integer representation that conforms to the JSCData
interface. Values are stored as Integer
objects.
Whenever the value of this data object changes, registered
JSCDataListeners
are notified via a JSCDataEvent
.
If not otherwise stated, the event objects always contain the values before
the change and after the change.
This class is thread-safe. All access to mutable data is synchronized. All events are fired outside the synchronized blocks.
Field Summary | |
---|---|
static javolution.xml.XmlFormat<JSCInt> |
JSCInt_XML
XML format field for (de)serialization. |
Constructor Summary | |
---|---|
JSCInt(java.lang.String name)
Creates an empty JSCInt . |
|
JSCInt(java.lang.String name,
boolean value)
Creates a JSCInt from a boolean value. |
|
JSCInt(java.lang.String name,
int value)
Creates a JSCInt from an integer value. |
|
JSCInt(java.lang.String name,
java.lang.Integer value)
Creates a JSCInt from value . |
Method Summary | |
---|---|
void |
clear()
Clears this data object. |
JSCInt |
copy()
Gets a copy of the current object. |
double |
doubleVal()
Gets the stored integer as a double . |
java.lang.Integer |
getInt()
Gets the stored Integer value. |
int |
intVal()
Gets the stored integer. |
boolean |
isEmpty()
Gets whether this is empty. |
boolean |
isEqual(JSCData o)
Gets whether the values of this data object and other are
logically equal. |
boolean |
isNonZero()
Gets whether the stored value is not zero. |
java.lang.String |
name()
Gets the name of the data object. |
void |
setInt(java.lang.Integer newValue)
Sets the value of this to newValue and fires a
JSCDataEvent of type:
JSCDataEventTypes.VALUE_CHANGED if
! |
void |
setVal(int newInt)
Sets the value of this to newInt . |
JSCTypes |
type()
Gets the type of this JSCData object. |
java.lang.Object |
value()
Gets the underlying value, which is stored as a Double . |
Methods inherited from class com.jstatcom.model.AbstractJSCData |
---|
addJSCDataListener, display, getJSCProperty, removeJSCDataListener, removeJSCProperty, setJSCProperty, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final javolution.xml.XmlFormat<JSCInt> JSCInt_XML
Constructor Detail |
---|
public JSCInt(java.lang.String name)
JSCInt
.
name
- the identifier of that object
java.lang.IllegalArgumentException
- if name
is not valid or
if (name == null)
JSCConstants.isValidName(java.lang.String)
public JSCInt(java.lang.String name, int value)
JSCInt
from an integer value.
name
- the identifier of that objectvalue
- the int
to be used as value
java.lang.IllegalArgumentException
- if name
is not valid or
if (name == null)
JSCConstants.isValidName(java.lang.String)
public JSCInt(java.lang.String name, boolean value)
JSCInt
from a boolean value.
name
- the identifier of that objectvalue
- if true
, set integer value to 1, if
false
set integer value to 0
java.lang.IllegalArgumentException
- if name
is not valid or
if (name == null)
JSCConstants.isValidName(java.lang.String)
public JSCInt(java.lang.String name, java.lang.Integer value)
JSCInt
from value
.
name
- the identifier of that objectvalue
- the Integer
to be used as value
java.lang.IllegalArgumentException
- if name
is not valid or
if (name == null)
JSCConstants.isValidName(java.lang.String)
Method Detail |
---|
public void clear()
this
data object. Fires:
JSCDataEventTypes.EMPTY_STATE
event
JSCDataEventTypes.VALUE_CHANGED
event
isEmpty
returns true
.
public JSCInt copy()
JSCData
a.isEqual(a.copy())
- compares values
a.getName().equals(a.copy().getName())
- compares
name
JSCDataListeners
attached to the original object should
not be copied.
JSCData
public double doubleVal()
double
.
double
java.lang.IllegalStateException
- if object is emptypublic java.lang.Integer getInt()
Integer
value.
Integer
or null
if emptypublic int intVal()
java.lang.IllegalStateException
- if object is emptypublic boolean isEmpty()
this
is empty. This method returns
true
, if value
returns null
.
true
if emptypublic boolean isEqual(JSCData o)
JSCData
other
are
logically equal.
true
if considered equal according to the logic of
the representationJSCData
public java.lang.String name()
JSCData
JSCConstants
.
JSCData
public void setInt(java.lang.Integer newValue)
newValue
and fires a
JSCDataEvent
of type:
JSCDataEventTypes.VALUE_CHANGED
if
!newValue.equals(getNumber())
JSCDataEventTypes.EMPTY_STATE
if
newValue != null
and this was empty before
JSCDataEventTypes.EMPTY_STATE
if
newValue == null
and this was not empty before
newValue
- the new valuepublic void setVal(int newInt)
newInt
. Fires a
JSCDataEvent
of type:
JSCDataEventTypes.VALUE_CHANGED
if the new value is
not equal to the previous
JSCDataEventTypes.EMPTY_STATE
if this was empty
before
newInt
- the new int
public JSCTypes type()
JSCData
object.
JSCTypes.INT
JSCTypes
public java.lang.Object value()
Double
.
null
if this
is
emptypublic boolean isNonZero()
true
if not equal to zero, false
otherwise
java.lang.IllegalStateException
- if object is empty
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |