|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jgap.distr.CultureMemoryCell
public class CultureMemoryCell
Represents a memory cell used within Culture, a
special form of memory.
CultureMemoryCell also stores metadata along with the value-to-store, like date/time of setting a value, change history.
| Constructor Summary | |
|---|---|
CultureMemoryCell()
Default constructor. |
|
CultureMemoryCell(java.lang.String a_name)
Sets history size to 3. |
|
CultureMemoryCell(java.lang.String a_name,
int a_historySize)
Allows to freely specify informative name of memory cell as well as size of history to keep. |
|
| Method Summary | |
|---|---|
int |
compareTo(java.lang.Object a_other)
The compareTo-method. |
boolean |
equals(java.lang.Object a_other)
The equals-method. |
java.lang.Object |
getCurrentValue()
|
double |
getCurrentValueAsDouble()
Convenience method to retrieve a primitive double value from memory easily. |
java.util.List |
getHistory()
|
int |
getHistorySize()
|
java.lang.String |
getName()
|
protected CultureMemoryCell |
getNewInstance(java.lang.Object a_value,
int a_version,
java.lang.String a_name)
Creates a new instance of CultureMemoryCell preset with the given parameters. |
int |
getReadAccessed()
|
int |
getReadAccessedCurrentVersion()
|
int |
getVersion()
|
long |
getVersionTimeMilliseconds()
|
protected void |
incrementVersion()
Increment version number and keep track of current time. |
protected void |
keepHistory(java.lang.Object a_value,
int a_version,
java.lang.String a_name)
Puts an entry into history. |
void |
setDouble(double a_value)
Convenience method to store a primitive double easily. |
void |
setHistorySize(int a_size)
Sets the size of the history and scales down the history log it is larger than the given size. |
void |
setName(java.lang.String a_name)
Sets the informative name of the memory cell. |
void |
setValue(java.lang.Object a_value)
Sets a new memory value. |
java.lang.String |
toString()
|
protected void |
toStringRecursive(java.lang.StringBuffer a_result,
int a_historySize)
Recursive part of toString(). |
protected void |
trimHistory(int a_size)
Trims the history to the given size. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CultureMemoryCell()
public CultureMemoryCell(java.lang.String a_name)
a_name - informative name of the memory cell
public CultureMemoryCell(java.lang.String a_name,
int a_historySize)
a_name - informative name of the memory cella_historySize - size of history to keep. Use values less than 1 for
turning history logging off| Method Detail |
|---|
public void setName(java.lang.String a_name)
a_name - informative namepublic java.lang.String getName()
public void setValue(java.lang.Object a_value)
a_value - the memory value to setpublic void setDouble(double a_value)
a_value - double value to storepublic double getCurrentValueAsDouble()
public java.lang.Object getCurrentValue()
public java.util.List getHistory()
public int getVersion()
protected void incrementVersion()
protected void keepHistory(java.lang.Object a_value,
int a_version,
java.lang.String a_name)
a_value - memory value to storea_version - version of the valuea_name - name to store
protected CultureMemoryCell getNewInstance(java.lang.Object a_value,
int a_version,
java.lang.String a_name)
a_value - memory value to storea_version - version of the valuea_name - name to store
public int getReadAccessed()
public int getReadAccessedCurrentVersion()
public void setHistorySize(int a_size)
a_size - new size of the history log = how many entries to storeprotected void trimHistory(int a_size)
a_size - new size of historypublic int getHistorySize()
public java.lang.String toString()
toString in class java.lang.Object
protected void toStringRecursive(java.lang.StringBuffer a_result,
int a_historySize)
a_result - gathered result so far and modified herea_historySize - history size just for information purposepublic long getVersionTimeMilliseconds()
public boolean equals(java.lang.Object a_other)
equals in class java.lang.Objecta_other - the other object to compare
public int compareTo(java.lang.Object a_other)
compareTo in interface java.lang.Comparablea_other - the other object to compare
|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||