|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmodhelxs.state_management.Value<T>
modhelxs.state_management.Attribute<T>
public class Attribute<T>
An Attribute is a storage with commit and revert operations.
An attribute has a permanent value, which is set at initialization time,
and by the commit operation. It also has a transient value,
which is set by the setValue operation. The transient value
becomes the permanent value when commit is called.
The transient value if forgotten when revert is called.
The current value of an attribute is its transient value if it is set,
or its permanent value otherwise.
| Field Summary | |
|---|---|
private T |
trans_value_
The transient value of the attribute, which will become its value after committing. |
private boolean |
was_set_
|
| Constructor Summary | |
|---|---|
Attribute(java.lang.Class<T> type)
Create an attribute for storing a value of type type. |
|
Attribute(java.lang.Class<T> type,
boolean giveInitWarning)
Create an attribute for storing a value of type type. |
|
| Method Summary | |
|---|---|
void |
commit()
Commit the transient value into the permanent value. |
T |
getValue()
Get the value of the attribute. |
void |
revert()
Revert to the last committed value by forgetting the transient value. |
void |
setValue(T val)
Set the transient value of the attribute. |
void |
setValue(Value<T> val)
Set the transient value of the attribute. |
java.lang.String |
toString()
|
| Methods inherited from class modhelxs.state_management.Value |
|---|
getType, init, initFromProperty |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private T trans_value_
private boolean was_set_
| Constructor Detail |
|---|
public Attribute(java.lang.Class<T> type,
boolean giveInitWarning)
type.
public Attribute(java.lang.Class<T> type)
type.
| Method Detail |
|---|
public T getValue()
setValue was called since the last call of commit,
or the last committed (or initialized) value.
getValue in class Value<T>public void setValue(T val)
setValue in class Value<T>public void setValue(Value<T> val)
setValue in class Value<T>public void commit()
commit in interface StateValuepublic void revert()
revert in interface StateValuepublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||