clarion.system
Class Value

java.lang.Object
  extended by clarion.system.Value
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<Value>
Direct Known Subclasses:
Range

public class Value
extends java.lang.Object
implements java.lang.Cloneable, java.lang.Comparable<Value>

This class implements a value within CLARION. It implements the cloneable and comparable interfaces.

Usage:

The value class is used to define the possible values of a dimension. It is a somewhat meaningless object unless it is defined within a dimension. A coupling of a dimension and a value together is called a dimension-value pair and is the base unit in CLARION for representing information.
Examples of dimension-value pairs:

It is required that you specify a way of identifying the value (eg. name, number, etc) when you initialize this class. Once this ID has been set, it cannot be changed. This ID is used as the key for this value when it is placed inside a dimension.

The activation of a value is 0 by default and (although not required) is usually set to either 0 (the value is not activated) or 1 (the value is activated).

This class contains both global (static) and local constants. The default is to use the local constants. If you want to change any of the global constants, you need to do so before any instances of this class are initialized.

Version:
6.0.4.5
Author:
Nick Wilson

Field Summary
protected  double Activation
          The activation of the value.
 double ACTIVATION_MATCH_EPSILON
          How close two activations must be in order to be considered equal.
 double FULL_ACTIVATION_THRESHOLD
          The threshold a dimension-value pair must be activated to in order to be considered fully activated.
static double GLOBAL_ACTIVATION_EPSILON
          How close two activations must be in order to be considered equal.
static double GLOBAL_FULL_ACTIVATION_THRESHOLD
          The threshold a dimension-value pair must be activated to in order to be considered fully activated.
static double GLOBAL_MINIMUM_ACTIVATION_THRESHOLD
          The minimum threshold a dimension-value pair activation must be above to be considered activated.
protected  int hash
          The hash for this object.
protected  java.lang.Object ID
          Identifies the value.
 double MINIMUM_ACTIVATION_THRESHOLD
          The minimum threshold a dimension-value pair activation must be above to be considered activated.
 
Constructor Summary
Value(java.lang.Object id)
          Initializes the value with the minimum activation and sets the ID to the object specified.
Value(java.lang.Object id, double act)
          Initializes the value with the activation and ID specified.
 
Method Summary
 Value clone()
          Clones the value.
 int compareTo(Value val)
          Compares the activation of this value to the specified value.
 boolean equals(java.lang.Object val)
          Checks to see if the specified object is a value and if the ID and activation of the specified value is the same as this value.
 boolean equalsID(java.lang.Object val)
          Checks to see if the specified value has the same ID as this value.
 double getActivation()
          Gets the activation level for this value.
 java.lang.Object getID()
          Gets the ID of this value.
 int hashCode()
           
 boolean isActivated()
          Checks to see if the activation of the value is greater than the minimum activation threshold.
 boolean isFullyActivated()
          Checks to see if the activation of the value is greater than or equal to the full activation threshold.
 void resetActivation()
          Resets the activation.
 void setActivation(double act)
          Sets the activation level for this value.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ID

protected java.lang.Object ID
Identifies the value. A name (in the form of a string) is simply one option for identifying a value.


hash

protected int hash
The hash for this object. When this item is cloned, so is this hash.


Activation

protected double Activation
The activation of the value.


GLOBAL_MINIMUM_ACTIVATION_THRESHOLD

public static double GLOBAL_MINIMUM_ACTIVATION_THRESHOLD
The minimum threshold a dimension-value pair activation must be above to be considered activated.


GLOBAL_FULL_ACTIVATION_THRESHOLD

public static double GLOBAL_FULL_ACTIVATION_THRESHOLD
The threshold a dimension-value pair must be activated to in order to be considered fully activated.


GLOBAL_ACTIVATION_EPSILON

public static double GLOBAL_ACTIVATION_EPSILON
How close two activations must be in order to be considered equal. Needed due to the nature of double precision arithmetic.


MINIMUM_ACTIVATION_THRESHOLD

public double MINIMUM_ACTIVATION_THRESHOLD
The minimum threshold a dimension-value pair activation must be above to be considered activated.


FULL_ACTIVATION_THRESHOLD

public double FULL_ACTIVATION_THRESHOLD
The threshold a dimension-value pair must be activated to in order to be considered fully activated.


ACTIVATION_MATCH_EPSILON

public double ACTIVATION_MATCH_EPSILON
How close two activations must be in order to be considered equal. Needed due to the nature of double precision arithmetic.

Constructor Detail

Value

public Value(java.lang.Object id)
Initializes the value with the minimum activation and sets the ID to the object specified.

Parameters:
id - The ID of the value.

Value

public Value(java.lang.Object id,
             double act)
Initializes the value with the activation and ID specified.

Parameters:
id - The ID of the value.
act - The activation level.
Method Detail

getID

public java.lang.Object getID()
Gets the ID of this value.

Returns:
The ID of this value.

getActivation

public double getActivation()
Gets the activation level for this value.

Returns:
The activation level.

setActivation

public void setActivation(double act)
Sets the activation level for this value.

Parameters:
act - The activation level to set.

resetActivation

public void resetActivation()
Resets the activation.


isActivated

public boolean isActivated()
Checks to see if the activation of the value is greater than the minimum activation threshold.

Returns:
True if the value is at least minimally activated, otherwise false.

isFullyActivated

public boolean isFullyActivated()
Checks to see if the activation of the value is greater than or equal to the full activation threshold.

Returns:
True if the value is fully activated, otherwise false.

equalsID

public boolean equalsID(java.lang.Object val)
Checks to see if the specified value has the same ID as this value.

Parameters:
val - The value whose ID you want to compare to this value's ID.
Returns:
True if the specified value has the same ID as this value, otherwise false.

equals

public boolean equals(java.lang.Object val)
Checks to see if the specified object is a value and if the ID and activation of the specified value is the same as this value.

Overrides:
equals in class java.lang.Object
Parameters:
val - The object to compare to this value.
Returns:
True if the two values are equal, otherwise false.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

clone

public Value clone()
Clones the value.

Overrides:
clone in class java.lang.Object
Returns:
A copy of the value.

compareTo

public int compareTo(Value val)
              throws java.lang.ClassCastException
Compares the activation of this value to the specified value. The two values must have the same ID to be comparable. If the specified value does not have the same ID as this value, this method will throw and exception.

Specified by:
compareTo in interface java.lang.Comparable<Value>
Parameters:
val - The value to compare.
Returns:
A negative integer, 0, or positive integer if the activation of this value is less than, equal to, or greater than the activation of the specified value.
Throws:
java.lang.ClassCastException - if the specified value does not have the same ID as this value.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object