agg.xt_basis
Class Completion_CSP

java.lang.Object
  extended by agg.xt_basis.MorphCompletionStrategy
      extended by agg.xt_basis.Completion_CSP
All Implemented Interfaces:
StrategyProperties, CompletionPropertyBits, java.lang.Cloneable
Direct Known Subclasses:
Completion_CSP_NoBJ, Completion_InjCSP

public class Completion_CSP
extends MorphCompletionStrategy

An implementation of morphism completion as a Constraint Satisfaction Problem (CSP).


Field Summary
protected static java.util.BitSet itsSupportedProperties
           
protected  java.util.Dictionary<java.lang.Object,Variable> relatedVarMap
           
 
Fields inherited from class agg.xt_basis.MorphCompletionStrategy
itsName, itsProperties
 
Fields inherited from interface agg.xt_basis.CompletionPropertyBits
BITNAME, DANGLING, IDENTIFICATION, INJECTIVE, NAC, PAC
 
Constructor Summary
Completion_CSP()
           
Completion_CSP(boolean nonDeterministicSearch)
           
 
Method Summary
 void clear()
           
protected  SolutionStrategy createSolutionStrategy()
          Template method to enable creation of CSPs with varying solution strategies by subclasses.
 void dispose()
           
 AttrContext getAttrContext()
           
 java.util.Dictionary<java.lang.Object,Variable> getInstanceVarMap()
           
 boolean hasRelatedInstanceVarMap()
           
 void initialize(OrdinaryMorphism morph)
          Initialize the CSP by the specified morphism.
 void initialize(OrdinaryMorphism morph, java.util.Enumeration<Node> nodes, java.util.Enumeration<Arc> edges)
          Initialize the CSP by the specified morphism.
 boolean isDomainOfTypeEmpty(Type t)
           
 boolean isDomainOfTypeEmpty(Type t, Type src, Type tar)
           
protected  boolean next(OrdinaryMorphism morph)
          Compute the next completion of morph.
protected  boolean next(OrdinaryMorphism morph, java.util.Enumeration<Node> varnodes, java.util.Enumeration<Arc> varedges)
          Compute the next completion of morph for the nodes and edges specified by Vector varnodes and Vector varedges.
 void reinitializeSolver(boolean doUpdateQueries)
           
 void removeFromObjectVarMap(GraphObject anObj)
           
protected  void removeFromTypeObjectsMap(GraphObject anObj)
           
protected  void reset()
          Reset my internal state, so that the forthcoming invocation of next() computes the first completion of the given morphism.
 void resetSolver(boolean doUpdateQueries)
           
 void resetSolverVariables()
           
protected  void resetTypeMap(Graph g)
           
protected  void resetTypeMap(java.util.Hashtable<java.lang.String,java.util.Vector<GraphObject>> typeMap)
           
protected  void resetVariableDomain(boolean initInstanceByNull)
           
protected  void resetVariableDomain(GraphObject go)
           
protected  void setPartialMorphism(OrdinaryMorphism morph)
          If an image of the source node or edge exists, set it to be instance of the appropriate CSP variable.
 void setProperties(MorphCompletionStrategy fromStrategy)
           
 void setRelatedInstanceVarMap(java.util.Dictionary<java.lang.Object,Variable> relatedVarMap)
           
protected  void unsetAttrContextVariable()
           
 
Methods inherited from class agg.xt_basis.MorphCompletionStrategy
clone, equals, forceBackState, getName, getProperties, getSize, getSupportedProperties, initialize, isInjective, removeProperty, setProperty, showProperties
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

relatedVarMap

protected java.util.Dictionary<java.lang.Object,Variable> relatedVarMap

itsSupportedProperties

protected static final java.util.BitSet itsSupportedProperties
Constructor Detail

Completion_CSP

public Completion_CSP()

Completion_CSP

public Completion_CSP(boolean nonDeterministicSearch)
Method Detail

setProperties

public void setProperties(MorphCompletionStrategy fromStrategy)

clear

public void clear()

dispose

public void dispose()
Overrides:
dispose in class MorphCompletionStrategy

initialize

public final void initialize(OrdinaryMorphism morph)
                      throws BadMappingException
Initialize the CSP by the specified morphism. The CSP variables are created for each node and edge of the source graph of this morphism.

Overrides:
initialize in class MorphCompletionStrategy
Throws:
BadMappingException

initialize

public final void initialize(OrdinaryMorphism morph,
                             java.util.Enumeration<Node> nodes,
                             java.util.Enumeration<Arc> edges)
                      throws BadMappingException
Initialize the CSP by the specified morphism. The CSP variables are created for nodes and edge of the specified sets of nodes and edges, only.

Throws:
BadMappingException

setPartialMorphism

protected void setPartialMorphism(OrdinaryMorphism morph)
If an image of the source node or edge exists, set it to be instance of the appropriate CSP variable.

Overrides:
setPartialMorphism in class MorphCompletionStrategy

createSolutionStrategy

protected SolutionStrategy createSolutionStrategy()
Template method to enable creation of CSPs with varying solution strategies by subclasses.


reset

protected final void reset()
Description copied from class: MorphCompletionStrategy
Reset my internal state, so that the forthcoming invocation of next() computes the first completion of the given morphism.

Overrides:
reset in class MorphCompletionStrategy

getAttrContext

public AttrContext getAttrContext()
Overrides:
getAttrContext in class MorphCompletionStrategy

resetSolver

public void resetSolver(boolean doUpdateQueries)
Overrides:
resetSolver in class MorphCompletionStrategy

reinitializeSolver

public void reinitializeSolver(boolean doUpdateQueries)
Overrides:
reinitializeSolver in class MorphCompletionStrategy

resetSolverVariables

public void resetSolverVariables()
Overrides:
resetSolverVariables in class MorphCompletionStrategy

isDomainOfTypeEmpty

public boolean isDomainOfTypeEmpty(Type t)
Overrides:
isDomainOfTypeEmpty in class MorphCompletionStrategy

isDomainOfTypeEmpty

public boolean isDomainOfTypeEmpty(Type t,
                                   Type src,
                                   Type tar)
Overrides:
isDomainOfTypeEmpty in class MorphCompletionStrategy

setRelatedInstanceVarMap

public void setRelatedInstanceVarMap(java.util.Dictionary<java.lang.Object,Variable> relatedVarMap)
Overrides:
setRelatedInstanceVarMap in class MorphCompletionStrategy

hasRelatedInstanceVarMap

public boolean hasRelatedInstanceVarMap()
Overrides:
hasRelatedInstanceVarMap in class MorphCompletionStrategy

getInstanceVarMap

public java.util.Dictionary<java.lang.Object,Variable> getInstanceVarMap()
Overrides:
getInstanceVarMap in class MorphCompletionStrategy

removeFromObjectVarMap

public void removeFromObjectVarMap(GraphObject anObj)
Overrides:
removeFromObjectVarMap in class MorphCompletionStrategy

removeFromTypeObjectsMap

protected void removeFromTypeObjectsMap(GraphObject anObj)
Overrides:
removeFromTypeObjectsMap in class MorphCompletionStrategy

resetTypeMap

protected void resetTypeMap(java.util.Hashtable<java.lang.String,java.util.Vector<GraphObject>> typeMap)
Overrides:
resetTypeMap in class MorphCompletionStrategy

resetTypeMap

protected void resetTypeMap(Graph g)
Overrides:
resetTypeMap in class MorphCompletionStrategy

resetVariableDomain

protected void resetVariableDomain(boolean initInstanceByNull)
Overrides:
resetVariableDomain in class MorphCompletionStrategy

resetVariableDomain

protected void resetVariableDomain(GraphObject go)
Overrides:
resetVariableDomain in class MorphCompletionStrategy

unsetAttrContextVariable

protected void unsetAttrContextVariable()
Overrides:
unsetAttrContextVariable in class MorphCompletionStrategy

next

protected final boolean next(OrdinaryMorphism morph)
Description copied from class: MorphCompletionStrategy
Compute the next completion of morph. Invoke this method successively with the same argument to get all completions of a morphism.

Overrides:
next in class MorphCompletionStrategy
Parameters:
morph - the morphism to totalize.
Returns:
false if there are no more completions.

next

protected final boolean next(OrdinaryMorphism morph,
                             java.util.Enumeration<Node> varnodes,
                             java.util.Enumeration<Arc> varedges)
Description copied from class: MorphCompletionStrategy
Compute the next completion of morph for the nodes and edges specified by Vector varnodes and Vector varedges. Invoke this method successively with the same arguments to get all completions of a morphism.

Overrides:
next in class MorphCompletionStrategy
Returns:
false if there are no more completions.