nars.entity
Class TruthValue

java.lang.Object
  extended by nars.entity.TruthValue

public class TruthValue
extends java.lang.Object

Frequency and confidence.


Field Summary
protected  ShortFloat confidence
          The confidence factor of the truth value
private static char DELIMITER
          The charactor that marks the two ends of a truth value
protected  ShortFloat frequency
          The frequency factor of the truth value
private static char SEPARATOR
          The charactor that separates the factors in a truth value
 
Constructor Summary
TruthValue(float f, float c)
          Constructor with two ShortFloats
TruthValue(TruthValue v)
          Constructor with a TruthValue to clone
 
Method Summary
 boolean equals(java.lang.Object that)
          Compare two truth values
 float getConfidence()
          Get the confidence value
 float getExpDifAbs(TruthValue t)
          Calculate the absolute difference of the expectation value and that of a given truth value
 float getExpectation()
          Calculate the expectation value of the truth value
 float getFrequency()
          Get the frequency value
 int hashCode()
          The hash code of a TruthValue
 java.lang.String toString()
          The String representation of a TruthValue
 java.lang.String toString2()
          A simplified String representation of a TruthValue, where each factor is accruate to 1%
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DELIMITER

private static final char DELIMITER
The charactor that marks the two ends of a truth value

See Also:
Constant Field Values

SEPARATOR

private static final char SEPARATOR
The charactor that separates the factors in a truth value

See Also:
Constant Field Values

frequency

protected ShortFloat frequency
The frequency factor of the truth value


confidence

protected ShortFloat confidence
The confidence factor of the truth value

Constructor Detail

TruthValue

public TruthValue(float f,
                  float c)
Constructor with two ShortFloats

Parameters:
f - The frequency value
c - The confidence value

TruthValue

public TruthValue(TruthValue v)
Constructor with a TruthValue to clone

Parameters:
v - The truth value to be cloned
Method Detail

getFrequency

public float getFrequency()
Get the frequency value

Returns:
The frequency value

getConfidence

public float getConfidence()
Get the confidence value

Returns:
The confidence value

getExpectation

public float getExpectation()
Calculate the expectation value of the truth value

Returns:
The expectation value

getExpDifAbs

public float getExpDifAbs(TruthValue t)
Calculate the absolute difference of the expectation value and that of a given truth value

Parameters:
t - The given value
Returns:
The absolute difference

equals

public boolean equals(java.lang.Object that)
Compare two truth values

Overrides:
equals in class java.lang.Object
Parameters:
that - The other TruthValue
Returns:
Whether the two are equivalent

hashCode

public int hashCode()
The hash code of a TruthValue

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code

toString

public java.lang.String toString()
The String representation of a TruthValue

Overrides:
toString in class java.lang.Object
Returns:
The String

toString2

public java.lang.String toString2()
A simplified String representation of a TruthValue, where each factor is accruate to 1%

Returns:
The String