void ensureListExtended() { if (!uninstVars.isEmpty()) { // Try extending the list of uninstantiated vars by // increasing maxInt. increaseMaxInt(); } }
/** * set the value of the variable will potentially add new random variables into the possible world * if this variable is number variable * * @param var * @param value */ public void setValue(VarWithDistrib var, Object value) { super.setValue(var, value); if (var instanceof NumberVar) { int varDepth = getVarDepth(var); NumberVar nv = (NumberVar) var; if ((depthBound < 0) || (varDepth < depthBound)) { if (getVarDepth(var) >= maxInt) { // We're creating non-guaranteed objects of greater depth, // so increase maxInt as well increaseMaxInt(); } // Add objects generated by this number variable addObjects(nv.pop().type(), getSatisfiers(nv)); } Type ty = nv.pop().type(); Integer t = restNumberVars.get(ty) - 1; restNumberVars.put(ty, t); } if (var != lastVar) { Util.debug("Fatal error: last variable sampled is not the same as var"); } else { lastIter.remove(); } }
/** * Returns true if every basic random variable whose arguments necessarily exist in this world is * instantiated. */ public boolean isComplete() { if (uninstVars.isEmpty()) { increaseMaxInt(); } return uninstVars.isEmpty(); // no uninstantiated vars -> complete }