Class Assignment

java.lang.Object
  extended by Assignment

public class Assignment
extends java.lang.Object

Stores a vector of integers. These integers correspond to variable assignments.


Constructor Summary
Assignment(Assignment a)
          Constructs a clone of a.
Assignment(int numVars)
          Constructs an assignment of uninitialized variables.
 
Method Summary
 void assignVar(int var, int set)
          Assigns a variable to true(1), false(0), or unassigned(-1).
 int findFirstUnassignedVar()
          Find the first unassigned variable
 java.util.Vector getAssignment()
          Returns the assignment vector.
 boolean getNumUnassignedVars()
          Returns the number of unassigned variables
 int getValue(int i)
          Returns the value at the specified position
 java.lang.String toString()
          Prints out the assignment as a string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Assignment

public Assignment(int numVars)
Constructs an assignment of uninitialized variables.

Parameters:
numVars - the number of variables.

Assignment

public Assignment(Assignment a)
Constructs a clone of a.

Parameters:
a - another assignment.
Method Detail

assignVar

public void assignVar(int var,
                      int set)
Assigns a variable to true(1), false(0), or unassigned(-1).

Parameters:
var - the variable to be assigned.
set - the integer that the variable will be assigned

getAssignment

public java.util.Vector getAssignment()
Returns the assignment vector.

Returns:
Vector the list of integers.

getValue

public int getValue(int i)
Returns the value at the specified position

Parameters:
i - the position
Returns:
the value at the specified position

findFirstUnassignedVar

public int findFirstUnassignedVar()
Find the first unassigned variable

Returns:
the first unassigned variable

getNumUnassignedVars

public boolean getNumUnassignedVars()
Returns the number of unassigned variables

Returns:
the number of unassigned variables

toString

public java.lang.String toString()
Prints out the assignment as a string.

Overrides:
toString in class java.lang.Object
Returns:
String the assignment as a string.