private void recacheFactors () { numNodes = 0; for (Iterator it = factors.iterator (); it.hasNext ();) { Factor ptl = (Factor) it.next (); VarSet vs = ptl.varSet (); addVarsIfNecessary (vs); cacheFactor (vs, ptl); } }
private void recacheFactors () { numNodes = 0; for (Iterator it = factors.iterator (); it.hasNext ();) { Factor ptl = (Factor) it.next (); VarSet vs = ptl.varSet (); addVarsIfNecessary (vs); cacheFactor (vs, ptl); } }
private void recacheFactors () { numNodes = 0; for (Iterator it = factors.iterator (); it.hasNext ();) { Factor ptl = (Factor) it.next (); VarSet vs = ptl.varSet (); addVarsIfNecessary (vs); cacheFactor (vs, ptl); } }
/** * Adds a factor to the model. * <P> * If a factor has already been added for the variables in the * given clique, the effects of this method are (currently) * undefined. * <p> * All convenience methods for adding factors eventually call through * to this one, so this is the method for subclasses to override if they * wish to perform additional actions when a factor is added to the graph. * * @param factor A factor over the variables in clique. */ public void addFactor (Factor factor) { beforeFactorAdd (factor); VarSet varSet = factor.varSet (); addVarsIfNecessary (varSet); factors.add (factor); factorsAlphabet.lookupIndex (factor); addToListMap (clique2ptl, varSet, factor); // cache the factor cacheFactor (varSet, factor); afterFactorAdd (factor); }
/** * Adds a factor to the model. * <P> * If a factor has already been added for the variables in the * given clique, the effects of this method are (currently) * undefined. * <p> * All convenience methods for adding factors eventually call through * to this one, so this is the method for subclasses to override if they * wish to perform additional actions when a factor is added to the graph. * * @param factor A factor over the variables in clique. */ public void addFactor (Factor factor) { beforeFactorAdd (factor); VarSet varSet = factor.varSet (); addVarsIfNecessary (varSet); factors.add (factor); factorsAlphabet.lookupIndex (factor); addToListMap (clique2ptl, varSet, factor); // cache the factor cacheFactor (varSet, factor); afterFactorAdd (factor); }
/** * Adds a factor to the model. * <P> * If a factor has already been added for the variables in the * given clique, the effects of this method are (currently) * undefined. * <p> * All convenience methods for adding factors eventually call through * to this one, so this is the method for subclasses to override if they * wish to perform additional actions when a factor is added to the graph. * * @param factor A factor over the variables in clique. */ public void addFactor (Factor factor) { beforeFactorAdd (factor); VarSet varSet = factor.varSet (); addVarsIfNecessary (varSet); factors.add (factor); factorsAlphabet.lookupIndex (factor); addToListMap (clique2ptl, varSet, factor); // cache the factor cacheFactor (varSet, factor); afterFactorAdd (factor); }