de.cesr.lara.components
Class LaraProperty<PropType extends LaraProperty<?,ValueType>,ValueType>
java.lang.Object
de.cesr.lara.components.LaraProperty<PropType,ValueType>
- Type Parameters:
ValueType
-
- Direct Known Subclasses:
- LAbstractEnvironmentalProperty, LaraBehaviouralOption, LDoubleProperty, LFloatProperty, LIntProperty, LSelectedBoProperty, MemoryProperty, MyMemoryProperty
public abstract class LaraProperty<PropType extends LaraProperty<?,ValueType>,ValueType>
- extends Object
Common abstract base class for all properties used in environment, memory
etc. These properties are meant to be immutable. Therefore, subclasses of
LaraProperty
will usually need to provide copying/cloning
facilities either by implementing a copy constructor or an equivalent method.
The time-stamp may not be manipulated to ensure correct handling of
properties in memory. Consider wrapping properties in order to handle
'ancient' properties.
LaraProperty
public LaraProperty(String key)
- Parameters:
key
- the property's key
equals
public boolean equals(Object o)
- Two properties are equal if their names and values and timestamps are
equal.
- Overrides:
equals
in class Object
- See Also:
Object.equals(java.lang.Object)
getKey
public final String getKey()
- Returns:
getModifiedProperty
public abstract PropType getModifiedProperty(ValueType value)
- Parameters:
value
-
- Returns:
- a new property with new value and key and current time stamp
getRefreshedProperty
public PropType getRefreshedProperty()
- Returns:
- a property with same value and current time stamp
getTimestamp
public final int getTimestamp()
- Returns:
getValue
public abstract ValueType getValue()
- NOTE: Since
LaraProperty
s are meant to be immutable we avoid a
member in this class which is not private (members other than private
allow implementing a subclass that hurts the immutability). However,
implementing the getValue() method requires a non-private member because
subclasses need the ability to override getValues() and access value in
case they need to return and create a deep copy of value in order to
prevent external changes in the value (which is true for most
non-primitive data types).
- Returns:
- the property's value
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
- See Also:
Object.hashCode()
toString
public String toString()
- Overrides:
toString
in class Object
- See Also:
Object.toString()