cve
Class RuleCollection

java.lang.Object
  |
  +--cve.RuleCollection
Direct Known Subclasses:
CoveringRuleCollection, RuleCollectionFromBeliefNetwork, RuleCollectionFromEntropySplit

public class RuleCollection
extends java.lang.Object

A rule collection is a collection of generalised rules. This is much like a Vector, however we probably want to add more indexing at some time.


Inner Class Summary
private  class RuleCollection.Itr
           
 
Field Summary
private  int defaultInitialMaxSize
           
private static int maxContextSize
           
private static int maxNumRules
           
private  int maxSize
           
private static int maxTableSize
           
private  int size
           
private  GenRule[] theRules
           
 
Constructor Summary
(package private) RuleCollection()
          generate an empty rule collection.
(package private) RuleCollection(int initialSize)
          generate an empty rule collection with the given initial size.
 
Method Summary
 void add(GenRule newrule)
          add a new element to the collection.
 RuleCollection combineRemainingRules()
           
private static boolean disjoint(Variable[] vs1, Variable[] vs2)
           
 RuleCollection eliminate(Variable var)
          eliminates the variable from the current collection of rules.
 RuleCollection eliminatePretend(Variable var)
          pretends to eliminates the variable from the current collection of rules.
protected static Factor factorSet(Factor fac, Context con)
          set the variables in fac to the context con
 int getMaxContextSize()
           
 int getMaxNumRules()
           
 int getMaxTableSize()
           
 int getNumRules()
           
 int getSize()
          returns the number of parameters in the rule collection
 RuleIterator iterator()
           
 RuleCollection observe(Variable[] observedVars, int[] observedVals)
          update the factors to make the appropriate observations.
 void print()
          prints the rule collection.
 void printBrief()
          prints the summary of the rule collection.
private static Variable[] removeVar(Variable[] vars, Variable var)
          removes variable var from the list of variables vars.
static void resetMaxTableSize()
           
private static RuleCollection ruleCollectionSum(RuleCollection c1, RuleCollection c2)
          constructs a new rule collection by adding two other rule collections.
static Variable[] unionVariableArrays(Variable[] a1, Variable[] a2)
          returns the union of the two variable arrays.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

theRules

private GenRule[] theRules

size

private int size

maxSize

private int maxSize

defaultInitialMaxSize

private final int defaultInitialMaxSize

maxTableSize

private static int maxTableSize

maxNumRules

private static int maxNumRules

maxContextSize

private static int maxContextSize
Constructor Detail

RuleCollection

RuleCollection()
generate an empty rule collection.

RuleCollection

RuleCollection(int initialSize)
generate an empty rule collection with the given initial size.
Method Detail

getMaxTableSize

public int getMaxTableSize()

getMaxNumRules

public int getMaxNumRules()

getMaxContextSize

public int getMaxContextSize()

resetMaxTableSize

public static void resetMaxTableSize()

getNumRules

public int getNumRules()

add

public void add(GenRule newrule)
add a new element to the collection.

iterator

public RuleIterator iterator()

eliminate

public RuleCollection eliminate(Variable var)
eliminates the variable from the current collection of rules.

eliminatePretend

public RuleCollection eliminatePretend(Variable var)
pretends to eliminates the variable from the current collection of rules.

combineRemainingRules

public RuleCollection combineRemainingRules()

observe

public RuleCollection observe(Variable[] observedVars,
                              int[] observedVals)
update the factors to make the appropriate observations. This assumes that the observed variables are sorted, and we only observe variables that are in the store.

removeVar

private static Variable[] removeVar(Variable[] vars,
                                    Variable var)
removes variable var from the list of variables vars. This assumes that var is a member of vars.

ruleCollectionSum

private static RuleCollection ruleCollectionSum(RuleCollection c1,
                                                RuleCollection c2)
constructs a new rule collection by adding two other rule collections.

unionVariableArrays

public static Variable[] unionVariableArrays(Variable[] a1,
                                             Variable[] a2)
returns the union of the two variable arrays.

print

public void print()
prints the rule collection.

printBrief

public void printBrief()
prints the summary of the rule collection.

getSize

public int getSize()
returns the number of parameters in the rule collection

factorSet

protected static Factor factorSet(Factor fac,
                                  Context con)
set the variables in fac to the context con

disjoint

private static boolean disjoint(Variable[] vs1,
                                Variable[] vs2)