agg.util.csp
Class Variable

java.lang.Object
  extended by agg.util.csp.Variable

public class Variable
extends java.lang.Object

A class for the variables of a CSP.


Constructor Summary
Variable()
           
 
Method Summary
protected  void addConstraint(BinaryConstraint c)
          Let me know of a new constraint which I'm involved in.
protected  void addIncomingQuery(Query q)
          Let me know of a query for which I am the target variable.
 void addInstantiationHook(InstantiationHook hook)
          Add hook to the set of my InstantiationHooks.
protected  void addOutgoingQuery(Query q)
          Let me know of a query for which I am a source variable.
 void addWeight(int w)
           
 java.util.Enumeration<?> checkConstraints()
          Check all my applicable constraints, i.e., check the consistency of my current instantiation with all previously instantiated variables.
 void clear()
           
 java.util.Enumeration<?> getConstraints()
          Return an eneration of all the constraints I'm involved in.
 java.util.Enumeration<?> getDomainEnum()
          Return the eneration of my domain.
 int getDomainSize()
           
 Variable getEdgeSourceVariable()
           
 Variable getEdgeTargetVariable()
           
 java.lang.Object getGraphObject()
          Get the object for which this variable was defind.
 java.util.Enumeration<?> getIncomingQueries()
          Return an enumeration of all my incoming queries.
 int getIncomingQueriesCount()
           
 java.util.Vector<Variable> getIncomingVariables()
           
 java.lang.Object getInstance()
          Return my current value, null if uninstantiated.
 int getKind()
          Returns 0, if the object behind this variable is of type Node, returns 1, if the object behind this variable is of type Arc, otherwise -1.
 java.util.Enumeration<?> getOutgoingQueries()
          Return an eneration of all my outgoing queries.
 int getOutgoingQueriesCount()
           
 java.util.Vector<Variable> getOutgoingVariables()
           
 Query_Type getTypeQuery()
           
 int getWeight()
          Return my weight.
 boolean isEnabled()
           
 void setDomainEnum(java.util.Enumeration<?> dom)
          Set my domain in an eneration representation.
 void setDomainEnumWithoutRandom(java.util.Enumeration<?> dom)
           
 void setDomainSize(int size)
           
 void setEdgeSourceInstance(java.lang.Object srcInst)
           
 void setEdgeSourceVariable(Variable v)
           
 void setEdgeTargetInstance(java.lang.Object tarInst)
           
 void setEdgeTargetVariable(Variable v)
           
 void setEnabled(boolean e)
           
 void setGraphObject(java.lang.Object go)
          Set the object for which this variable is defined.
 void setInstance(java.lang.Object value)
          Instantiate me with the given value.
 void setKind(int kind)
          Set 0, if an object behind this variable is of type Node, set 1, if an object behind this variable is of type Arc, otherwise -1.
 void setRandomizedDomain(boolean randomized)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Variable

public Variable()
Method Detail

clear

public void clear()

setEdgeSourceVariable

public void setEdgeSourceVariable(Variable v)

setEdgeTargetVariable

public void setEdgeTargetVariable(Variable v)

getEdgeSourceVariable

public Variable getEdgeSourceVariable()

getEdgeTargetVariable

public Variable getEdgeTargetVariable()

setEdgeSourceInstance

public void setEdgeSourceInstance(java.lang.Object srcInst)

setEdgeTargetInstance

public void setEdgeTargetInstance(java.lang.Object tarInst)

getInstance

public final java.lang.Object getInstance()
Return my current value, null if uninstantiated.


setInstance

public final void setInstance(java.lang.Object value)
Instantiate me with the given value. To uninstantiate, use setInstance() with value == null.


checkConstraints

public final java.util.Enumeration<?> checkConstraints()
Check all my applicable constraints, i.e., check the consistency of my current instantiation with all previously instantiated variables.

Pre: getInstance() != null.

Returns:
An Enumeration of all the Variables whose instantiations conflict with my current instantiation. If all applicable constraints are satisfied, the Enumeration is empty. Enumeration elements are of type Variable.

addInstantiationHook

public final void addInstantiationHook(InstantiationHook hook)
Add hook to the set of my InstantiationHooks. I will call the encapsulated operations at the respective times of instantiation/uninstantiation, with myself as an argument.

See Also:
InstantiationHook

getDomainEnum

public final java.util.Enumeration<?> getDomainEnum()
Return the eneration of my domain. This eneration continues at the position where a previous access left off. The type of eneration elements is dependent on the concrete domain.


setDomainEnum

public final void setDomainEnum(java.util.Enumeration<?> dom)
Set my domain in an eneration representation. This very same eneration is returned from a subsequent call of getDomainEnum().


setDomainEnumWithoutRandom

public final void setDomainEnumWithoutRandom(java.util.Enumeration<?> dom)

setRandomizedDomain

public void setRandomizedDomain(boolean randomized)

setDomainSize

public void setDomainSize(int size)

getDomainSize

public int getDomainSize()

getWeight

public final int getWeight()
Return my weight. It is computed as the sum of the weights of all constraints attached and of all outgoing queries.


addWeight

public final void addWeight(int w)

getConstraints

public final java.util.Enumeration<?> getConstraints()
Return an eneration of all the constraints I'm involved in. Enumeration elements are of type BinaryConstraint.

See Also:
BinaryConstraint

getOutgoingQueries

public final java.util.Enumeration<?> getOutgoingQueries()
Return an eneration of all my outgoing queries. Enumeration elements are of type Query.

See Also:
Query

getOutgoingQueriesCount

public final int getOutgoingQueriesCount()

getIncomingQueries

public final java.util.Enumeration<?> getIncomingQueries()
Return an enumeration of all my incoming queries. Enumeration elements are of type Query.

See Also:
Query

getIncomingQueriesCount

public final int getIncomingQueriesCount()

getIncomingVariables

public final java.util.Vector<Variable> getIncomingVariables()

getOutgoingVariables

public final java.util.Vector<Variable> getOutgoingVariables()

addConstraint

protected final void addConstraint(BinaryConstraint c)
Let me know of a new constraint which I'm involved in.


addOutgoingQuery

protected final void addOutgoingQuery(Query q)
Let me know of a query for which I am a source variable.


addIncomingQuery

protected final void addIncomingQuery(Query q)
Let me know of a query for which I am the target variable.


getTypeQuery

public Query_Type getTypeQuery()

setGraphObject

public void setGraphObject(java.lang.Object go)
Set the object for which this variable is defined.


getGraphObject

public java.lang.Object getGraphObject()
Get the object for which this variable was defind.


setKind

public void setKind(int kind)
Set 0, if an object behind this variable is of type Node, set 1, if an object behind this variable is of type Arc, otherwise -1. Default is -1.


getKind

public int getKind()
Returns 0, if the object behind this variable is of type Node, returns 1, if the object behind this variable is of type Arc, otherwise -1.


setEnabled

public void setEnabled(boolean e)

isEnabled

public boolean isEnabled()