jpaul.Constraints
Class Var<Info>

java.lang.Object
  extended by jpaul.Constraints.Var<Info>
Direct Known Subclasses:
SVar

public abstract class Var<Info>
extends java.lang.Object

Var models a variable from a system of constraints. A system of constraints may involve variables that take values in different lattices (all of them subclasses of Info). Hence, the value lattice is an attribute of each variable. Ideally, we would encapsulate the operations of each lattice into an object that is pointed to from relevant variables. Instead, for simplicity, we have the lattice-related operations (copy(Info) and join(Info, Info)) as methods of each variable.

Version:
$Id: Var.java,v 1.5 2006/03/14 02:29:29 salcianu Exp $
Author:
Alexandru Salcianu - salcianu@alum.mit.edu

Field Summary
protected  int id
           
 
Constructor Summary
Var()
           
 
Method Summary
abstract  Info copy(Info x)
          Returns a clone of the information x.
abstract  boolean join(Info x, Info y)
          Joins two values from the domain this variable takes values from.
 java.lang.String toString()
          String representation of this variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected int id
Constructor Detail

Var

public Var()
Method Detail

toString

public java.lang.String toString()
String representation of this variable. The default implementation returns "Vid" where id is a unique integer id.

Overrides:
toString in class java.lang.Object

copy

public abstract Info copy(Info x)
Returns a clone of the information x. Mutation on the returned object should not affect the original information x. The constraint solver will invoke this method only with non-null values for x.


join

public abstract boolean join(Info x,
                             Info y)
Joins two values from the domain this variable takes values from. This mutate mutates parameter x by joining to it the parameter y. It does not mutate y. The constraint solver will invoke this method only with non-null values for x and y.

Returns:
true iff the x changed after y was joined to it. A false result means that x was already bigger than y. Hence, this operation implictly defines the order relation in the lattice where this variable takes values.


Copyright 2005 Alexandru Salcianu - salcianu@alum.mit.edu