//package GregDLLSolver; //Author:Greg Viola //Class: Algos //Version: 3 //Due Date: 4/10/07 //Status: Complete up to specifications import java.util.*; /** * Stores a vector of integers. These integers correspond * to variable assignments. */ public class Assignment { private Vector values; /** * Constructs an assignment of uninitialized variables. * * @param numVars the number of variables. */ public Assignment(int numVars) { values = new Vector (numVars); for (int i=0; i (a.getValues()); } /** * Assigns a variable to true(1), false(0), or unassigned(-1). * * @param var the variable to be assigned. * @param set the integer that the variable will be assigned */ public void assignVar(int var, int set) { values.setElementAt(set,var-1); } /** * Returns the assignment vector. * * @return Vector of values (1, 0, or -1) assigned to the variables. */ protected Vector getValues() { return values; } // !!!!!!!! DEE !!!!!!!!!!!!!!!! /** * Returns the assignment vector. * * @return Vector the list of integers. */ public Vector getAssignment() { return values; } // !!!!!!!! DEE !!!!!!!!!!!!!!!! public int getValue( int i) { return values.get(i); } // !!!!!!!! DEE !!!!!!!!!!!!!!!! public int findFirstUnassignedVar() { int assign = -1; //Used to extract each assignment //This loop used to list all assignments. for (int i=0; i