Documentation of 'org.jgap.distr.CultureMemoryCell' Java class
CultureMemoryCell
org.jgap.distr

Class CultureMemoryCell

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable


    public class CultureMemoryCell
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Comparable
    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.

    Since:
    2.3
    See Also:
    Serialized Form
    • Constructor Detail

      • CultureMemoryCell

        public CultureMemoryCell()
        Default constructor.
        Since:
        2.3
      • CultureMemoryCell

        public CultureMemoryCell(java.lang.String a_name)
        Sets history size to 3.
        Parameters:
        a_name - informative name of the memory cell
        Since:
        2.3
      • CultureMemoryCell

        public 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.
        Parameters:
        a_name - informative name of the memory cell
        a_historySize - size of history to keep. Use values less than 1 for turning history logging off
        Since:
        2.3
    • Method Detail

      • setName

        public void setName(java.lang.String a_name)
        Sets the informative name of the memory cell.
        Parameters:
        a_name - informative name
        Since:
        2.3
      • getName

        public java.lang.String getName()
        Returns:
        informative name of the memory cell
        Since:
        2.3
      • setValue

        public void setValue(java.lang.Object a_value)
        Sets a new memory value.
        Parameters:
        a_value - the memory value to set
        Since:
        2.3
      • setDouble

        public void setDouble(double a_value)
        Convenience method to store a primitive double easily.
        Parameters:
        a_value - double value to store
        Since:
        2.3
      • getCurrentValueAsDouble

        public double getCurrentValueAsDouble()
        Convenience method to retrieve a primitive double value from memory easily. Here a ClassCastException could occur!
        Returns:
        double value representing current memory value
        Since:
        2.3
      • getCurrentValue

        public java.lang.Object getCurrentValue()
        Returns:
        current memory value
        Since:
        2.3
      • getHistory

        public java.util.List getHistory()
        Returns:
        list of most recent entries (except current entry). The item at index 0 is the oldest, the item at highest index is the youngest one.
        Since:
        2.3
      • getVersion

        public int getVersion()
        Returns:
        version of memory value, read only
        Since:
        2.3
      • getReadAccessed

        public int getReadAccessed()
        Returns:
        number of times the memory cell has been read accessed
        Since:
        2.3
      • getReadAccessedCurrentVersion

        public int getReadAccessedCurrentVersion()
        Returns:
        number of read accesses since current value has been set. Calculated by subtracting number of read accesses for prior version from total number of read accesses
        Since:
        2.3
      • setHistorySize

        public void setHistorySize(int a_size)
        Sets the size of the history and scales down the history log it is larger than the given size.
        Parameters:
        a_size - new size of the history log = how many entries to store
        Since:
        2.3
      • getHistorySize

        public int getHistorySize()
        Returns:
        size of the history
        Since:
        2.3
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        String representation of the cultural memory cell including all important information (also history log).
        Since:
        2.3
      • getVersionTimeMilliseconds

        public long getVersionTimeMilliseconds()
        Returns:
        time in milliseconds when the current version has been created
        Since:
        3.0
      • equals

        public boolean equals(java.lang.Object a_other)
        The equals-method.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        a_other - the other object to compare
        Returns:
        true if the objects are regarded as equal
        Since:
        3.0
      • compareTo

        public int compareTo(java.lang.Object a_other)
        The compareTo-method.
        Specified by:
        compareTo in interface java.lang.Comparable
        Parameters:
        a_other - the other object to compare
        Returns:
        -1, 0, 1
        Since:
        3.0

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.