edu.stanford.nlp.stats
Class HashObservation

java.lang.Object
  |
  +--edu.stanford.nlp.stats.HashObservation
All Implemented Interfaces:
Observation

public class HashObservation
extends Object
implements Observation

Observation Represents an observation, or a specification of values for random variables. Observation represents a possibly partial state of the world. It contains a map between random variables and their values.


Constructor Summary
HashObservation()
          Default constructor.
HashObservation(int size)
          Constructor which allows specification of the initial number of random variables expected.
 
Method Summary
 boolean equals(Object o)
           
 int hashCode()
           
 boolean isEmpty()
          Checks if this is the empty observation which specifies the value of no random variables.
 void setValue(String randomVariable, String value)
          Sets the value of a single RandomVariable in this observation.
 int size()
          Get the number of random variables specified in this observation.
 List toListOver(List randomVariables)
          Transforms the observation into a List of values.
 String toString()
           
 String value(String randomVariable)
          Gets the value of a given RandomVariable.
 Set variables()
          Gets a set view of all the random variables specified in this observation.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HashObservation

public HashObservation()
Default constructor.


HashObservation

public HashObservation(int size)
Constructor which allows specification of the initial number of random variables expected.

Parameters:
size - the initial size of the internal Map
Method Detail

setValue

public void setValue(String randomVariable,
                     String value)
Sets the value of a single RandomVariable in this observation.

Specified by:
setValue in interface Observation
Parameters:
randomVariable - a RandomVariable
value - the value for randomVariable

value

public String value(String randomVariable)
Gets the value of a given RandomVariable.

Specified by:
value in interface Observation
Parameters:
randomVariable - a RandomVariable to look up
Returns:
the value of randomVariable in this observation

variables

public Set variables()
Gets a set view of all the random variables specified in this observation.

Specified by:
variables in interface Observation
Returns:
a Set of random variables

size

public int size()
Get the number of random variables specified in this observation.

Returns:
the number of random variables specified

isEmpty

public boolean isEmpty()
Checks if this is the empty observation which specifies the value of no random variables.

Returns:
true if and only if this observation is empty.

toListOver

public List toListOver(List randomVariables)
Transforms the observation into a List of values.

Parameters:
randomVariables - a List of Strings specifying which random variables' values are to be included in the returned List.
Returns:
a List over the specified random variables.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Stanford NLP Group