ve
Class Factor

java.lang.Object
  |
  +--ve.Factor
Direct Known Subclasses:
FactorAssign, FactorExpand, FactorNormalise, FactorObserved, FactorPlus, FactorStored, FactorTimes

public abstract class Factor
extends java.lang.Object

A factor is a table that given a tuple of values returns a value. This is an abstract class that can be instantiated in many ways, for example the FactorTimes factor that is the product of other factors.


Field Summary
static int BY_MULTIPLYING
           
static int BY_SUM_OUT
           
static int BY_V_ELIM
           
static int BY_V_OBS
           
static int FROM_NODE
           
 int howCreated
           
 
Constructor Summary
Factor(Variable[] Vars)
          constructs a factor for the variables given.
 
Method Summary
 boolean allOnes()
          Is true if the factor consists entirely of ones.
 boolean contains(Variable v)
          returns true if the factor contains variable v.
 void display()
          displays the resultant factor.
 java.lang.String getName()
          returns string the variables this is a factor on.
 Variable[] getVariables()
          returns the tuple of variables, in order.
 boolean isRedundant(Variable var)
          is true if the variable is redundant in the factor.
abstract  EltsIterator iterator()
          Returns an iterator over the values of the factor.
 void print()
          prints the Factor in a table form.
 void print(java.lang.String indent)
          prints the Factor in a table form, with a string that is printed at the start of each line.
 void printVariables()
          prints the variables
 int size()
          returns the size of a factor table.
 java.lang.String toString()
          returns a string representation of the Factor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FROM_NODE

public static final int FROM_NODE

BY_V_ELIM

public static final int BY_V_ELIM

BY_V_OBS

public static final int BY_V_OBS

BY_SUM_OUT

public static final int BY_SUM_OUT

BY_MULTIPLYING

public static final int BY_MULTIPLYING

howCreated

public int howCreated
Constructor Detail

Factor

public Factor(Variable[] Vars)
constructs a factor for the variables given.
Method Detail

getName

public java.lang.String getName()
returns string the variables this is a factor on.

getVariables

public Variable[] getVariables()
returns the tuple of variables, in order.

iterator

public abstract EltsIterator iterator()
Returns an iterator over the values of the factor.

size

public int size()
returns the size of a factor table.

contains

public boolean contains(Variable v)
returns true if the factor contains variable v. This should probably do a binary search, although hopefully the factors aren't too big!
Parameters:
v - a variables
Returns:
true if v is in the current factor.

toString

public java.lang.String toString()
returns a string representation of the Factor.
Overrides:
toString in class java.lang.Object

printVariables

public void printVariables()
prints the variables

print

public void print()
prints the Factor in a table form.

print

public void print(java.lang.String indent)
prints the Factor in a table form, with a string that is printed at the start of each line.

allOnes

public boolean allOnes()
Is true if the factor consists entirely of ones.

isRedundant

public boolean isRedundant(Variable var)
is true if the variable is redundant in the factor. It is redundant if the function represented by the factor has the same value for all of the values of the other variables.

display

public void display()
displays the resultant factor.