ve
Class FactorStoreRandom

java.lang.Object
  |
  +--ve.FactorStore
        |
        +--ve.FactorStoreRandom

public class FactorStoreRandom
extends FactorStore

a place to store factors during computation. This is a naive implementation. A better implementation would do better indexing.


Inner Class Summary
private  class FactorStoreRandom.FacItr
           
 
Field Summary
private  int factorMaxSize
           
private  Variable last
           
private  int numFactors
           
private  int numVariables
           
private  Factor[] theFactors
           
private  Variable[] theVariables
           
 
Constructor Summary
FactorStoreRandom(Variable[] toSumOut, Factor[] initialFactors, int numInitFactors)
          generate a factor store containing the given initial factors and initial variables.
 
Method Summary
 void addFactor(Factor newFactor)
           
 FactorIterator emunFactorsRemaining()
          Returns an iterator over the the remaining factors.
 FactorIterator emunFactorsRemoved()
          Returns an iterator over the factors that contain the variable var.
 boolean hasNext()
           
 Variable next()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

theFactors

private Factor[] theFactors

numFactors

private int numFactors

theVariables

private Variable[] theVariables

numVariables

private int numVariables

factorMaxSize

private int factorMaxSize

last

private Variable last
Constructor Detail

FactorStoreRandom

public FactorStoreRandom(Variable[] toSumOut,
                         Factor[] initialFactors,
                         int numInitFactors)
generate a factor store containing the given initial factors and initial variables.
Method Detail

hasNext

public boolean hasNext()
Overrides:
hasNext in class FactorStore

next

public Variable next()
Overrides:
next in class FactorStore

addFactor

public void addFactor(Factor newFactor)
Overrides:
addFactor in class FactorStore

emunFactorsRemoved

public FactorIterator emunFactorsRemoved()
Returns an iterator over the factors that contain the variable var. Note that we remove the factors as we access them. We should really index properly so that this can be done in time proportional to the number of factors that contain the variable, not linear in the total number of factors.
Overrides:
emunFactorsRemoved in class FactorStore

emunFactorsRemaining

public FactorIterator emunFactorsRemaining()
Returns an iterator over the the remaining factors.
Overrides:
emunFactorsRemaining in class FactorStore