package edu.umich.soar.hpp;

/**
 * Unit of a CPT value distribution - (value, probability) pair
 */
public class HPPCPTValue implements Comparable<HPPCPTValue> {
	
	/**
	 * Supports read-only access to the value
	 * 
	 * @return value's value
	 */
	public String getValue() {
		return myValue;
	}	
	
	/**
	 * Supports read-only access to the value probability
	 * 
	 * @return value's probability
	 */
	public Double getProbability() {
		return myProbability;
	}
		
	/**
	 * Constructor to set (value, probability) pair
	 * 
	 * @param value symbolic value
	 * @param probability value probability
	 */
	public HPPCPTValue(String value, double probability) {
		myValue = value;
		myProbability = probability;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return ( myValue + "=" + myProbability );
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Comparable#compareTo(java.lang.Object)
	 */
	public int compareTo(HPPCPTValue v) {
		return ( ( getValue().compareTo(v.getValue())==0 )?(0):(1) );
	}
	
	private final String myValue;
	private final Double myProbability;	
}
