pt.tumba.ngram.bayes
Class ProbabilityVariable

java.lang.Object
  extended by pt.tumba.ngram.bayes.DiscreteVariable
      extended by pt.tumba.ngram.bayes.ProbabilityVariable
All Implemented Interfaces:
java.io.Serializable

public class ProbabilityVariable
extends DiscreteVariable
implements java.io.Serializable

***************************************************************

See Also:
Serialized Form

Field Summary
protected  BayesNet bn
           
static int CHANCE
           
protected  int explanation_index
           
(package private) static java.lang.String explanation_property_name
           
protected  int observed_index
           
(package private) static java.lang.String observed_property_name
           
protected  java.util.Vector properties
           
static int TRANSPARENT
           
protected  int type
           
 
Fields inherited from class pt.tumba.ngram.bayes.DiscreteVariable
index, name, values
 
Constructor Summary
ProbabilityVariable()
          Default constructor for a ProbabilityVariable.
ProbabilityVariable(BayesNet b_n, ProbabilityVariable pv)
          Constructor for ProbabilityVariable.
ProbabilityVariable(BayesNet b_n, java.lang.String n_vb, int vi, java.lang.String[] vl, java.util.Vector p)
          Constructor for ProbabilityVariable.
ProbabilityVariable(BayesNet b_n, java.lang.String n_vb, java.util.Vector p)
          Constructor for ProbabilityVariable.
ProbabilityVariable(ProbabilityVariable pv)
          Constructor for ProbabilityVariable.
 
Method Summary
 void add_property(java.lang.String prop)
          Add a property to the current ProbabilityVariable.
 java.util.Enumeration get_enumerated_properties()
          Get an Enumeration with the properties.
 int get_explanation_index()
          Get the index of the assigned value in the variable.
 int get_observed_index()
          Get the index of the observed value.
 java.util.Vector get_properties()
          Get the properties.
 int get_type()
          Get the type of the ProbabilityVariable.
 boolean is_explanation()
          Indicate whether the current ProbabilityVariable is an explanatory variable or not.
 boolean is_observed()
          Indicate whether the current ProbabilityVariable has been observed or not.
 void print(java.io.PrintStream out)
          Print method for ProbabilityVariable.
(package private)  void process_properties()
          Determine: 1) whether a variable is observed 2) whether a variable is a explanation variable
 void remove_property(int i)
          Remove a property from the current ProbabilityVariable given the position of the property.
 void remove_property(java.lang.String prop)
          Remove a property from the current ProbabilityVariable.
 void save_xml_0_3(java.io.PrintStream out)
          Save the contents of a ProbabilityVariable object into a PrintStream using the XMLBIF v0.3 format.
 void save_xml(java.io.PrintStream out)
          Save the contents of a ProbabilityVariable object into a PrintStream.
 void set_explanation_value(int i)
          Set the variable as explanatory with a given value.
 void set_index(int ind)
          Set the index of the variable.
 void set_invalid_index()
          Set the index of the current ProbabilityVariable as invalid (variable is not observed).
 void set_invalid_observed_index()
          Set the ProbabilityVariable as not observed..
 void set_observed_value(java.lang.String v)
          Set a value of the current ProbabilityVariable as observed.
 void set_properties(java.util.Vector prop)
          Set the properties.
 void set_type(int t)
          Set the type of the current ProbabilityVariable.
 
Methods inherited from class pt.tumba.ngram.bayes.DiscreteVariable
get_index, get_name, get_numeric_values, get_value, get_values, index_of_value, number_values, print, set_name, set_values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

protected int type

observed_index

protected int observed_index

explanation_index

protected int explanation_index

properties

protected java.util.Vector properties

bn

protected BayesNet bn

CHANCE

public static final int CHANCE
See Also:
Constant Field Values

TRANSPARENT

public static final int TRANSPARENT
See Also:
Constant Field Values

observed_property_name

static final java.lang.String observed_property_name
See Also:
Constant Field Values

explanation_property_name

static final java.lang.String explanation_property_name
See Also:
Constant Field Values
Constructor Detail

ProbabilityVariable

public ProbabilityVariable()
Default constructor for a ProbabilityVariable.


ProbabilityVariable

public ProbabilityVariable(BayesNet b_n,
                           java.lang.String n_vb,
                           java.util.Vector p)
Constructor for ProbabilityVariable.


ProbabilityVariable

public ProbabilityVariable(BayesNet b_n,
                           java.lang.String n_vb,
                           int vi,
                           java.lang.String[] vl,
                           java.util.Vector p)
Constructor for ProbabilityVariable.


ProbabilityVariable

public ProbabilityVariable(ProbabilityVariable pv)
Constructor for ProbabilityVariable.


ProbabilityVariable

public ProbabilityVariable(BayesNet b_n,
                           ProbabilityVariable pv)
Constructor for ProbabilityVariable.

Method Detail

process_properties

void process_properties()
Determine: 1) whether a variable is observed 2) whether a variable is a explanation variable


save_xml_0_3

public void save_xml_0_3(java.io.PrintStream out)
Save the contents of a ProbabilityVariable object into a PrintStream using the XMLBIF v0.3 format.


save_xml

public void save_xml(java.io.PrintStream out)
Save the contents of a ProbabilityVariable object into a PrintStream.


print

public void print(java.io.PrintStream out)
Print method for ProbabilityVariable.

Overrides:
print in class DiscreteVariable

get_type

public int get_type()
Get the type of the ProbabilityVariable.


is_explanation

public boolean is_explanation()
Indicate whether the current ProbabilityVariable is an explanatory variable or not.


is_observed

public boolean is_observed()
Indicate whether the current ProbabilityVariable has been observed or not.


set_observed_value

public void set_observed_value(java.lang.String v)
Set a value of the current ProbabilityVariable as observed.

Parameters:
v - Observed value.

set_explanation_value

public void set_explanation_value(int i)
Set the variable as explanatory with a given value.

Parameters:
i - Index of the value that is assigned to the variable.

add_property

public void add_property(java.lang.String prop)
Add a property to the current ProbabilityVariable.


remove_property

public void remove_property(java.lang.String prop)
Remove a property from the current ProbabilityVariable.


remove_property

public void remove_property(int i)
Remove a property from the current ProbabilityVariable given the position of the property.


get_observed_index

public int get_observed_index()
Get the index of the observed value.


get_explanation_index

public int get_explanation_index()
Get the index of the assigned value in the variable.


get_properties

public java.util.Vector get_properties()
Get the properties.


set_properties

public void set_properties(java.util.Vector prop)
Set the properties.


get_enumerated_properties

public java.util.Enumeration get_enumerated_properties()
Get an Enumeration with the properties.


set_index

public void set_index(int ind)
Set the index of the variable.


set_invalid_index

public void set_invalid_index()
Set the index of the current ProbabilityVariable as invalid (variable is not observed).


set_invalid_observed_index

public void set_invalid_observed_index()
Set the ProbabilityVariable as not observed..


set_type

public void set_type(int t)
Set the type of the current ProbabilityVariable.