EDU.utwente.CoCompose.translate
Class OrderCompositesVisitor

java.lang.Object
  |
  +--EDU.utwente.CoCompose.lang.ModelVisitor
        |
        +--EDU.utwente.CoCompose.translate.OrderCompositesVisitor
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Runnable

public class OrderCompositesVisitor
extends ModelVisitor
implements java.lang.Cloneable

Orders the composites in a list based on the composite interdependencies. If a published concept of one composite fills a role of another compose, for instance, that composite should be flattened first.

Version:
0.1.11, 6 October 2003
Author:
Dennis Wagelaar

Fields inherited from class EDU.utwente.CoCompose.lang.ModelVisitor
log
 
Constructor Summary
OrderCompositesVisitor()
          Constructs a OrderCompositesVisitor.
 
Method Summary
protected  void addComposite(Composite composite)
          Adds a composite to the list.
protected  void addVisited(Composite composite)
          Adds the composite to the visited set.
protected  java.lang.Object clone()
          Create a shallow copy of this.
protected  boolean containsComposite(AbstractConcept composite)
          Checks whether the list contains the composite.
 java.util.List getComposites()
          Retrieves the list of composites.
 void reset()
          Resets the object to the state as it was just after object creation.
 void visitComposite(Composite composite)
          Determines the composite dependencies and inserts the composite in the list at the appropriate index.
PRE: The model must be defined for this concept.
protected  boolean visited(Composite composite)
          Checks whether the composite is already being visited.
 void visitModel(Model model)
          Determines the dependencies of the composites in the model.
 
Methods inherited from class EDU.utwente.CoCompose.lang.ModelVisitor
getUpdate, run, setErrorReporter, setLogger, setUpdate, startModel, visitAbstractConcept, visitCompositePartConcept, visitCompositeRole, visitConcept, visitConstrainedConcept, visitImplementation, visitImplementationGenerator, visitImplementationRolePart, visitLink, visitPublishedConcept, visitSolutionPattern, visitSolutionRole
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrderCompositesVisitor

public OrderCompositesVisitor()
Constructs a OrderCompositesVisitor.
Method Detail

addComposite

protected void addComposite(Composite composite)
Adds a composite to the list.
Parameters:
composite - The composite to add.

containsComposite

protected boolean containsComposite(AbstractConcept composite)
Checks whether the list contains the composite.
Parameters:
composite - The composite to check for.
Returns:
True if and only if the list contains the composite.

visited

protected boolean visited(Composite composite)
Checks whether the composite is already being visited.
Parameters:
The - composite to check for.
Returns:
True if and only if the composite visit operation has already been invoked for the given composite.

addVisited

protected void addVisited(Composite composite)
Adds the composite to the visited set.
Parameters:
The - composite to add.

clone

protected java.lang.Object clone()
Create a shallow copy of this.
Overrides:
clone in class java.lang.Object
Returns:
The copy.

getComposites

public java.util.List getComposites()
Retrieves the list of composites.
Returns:
The ordered list of composites.

reset

public void reset()
Resets the object to the state as it was just after object creation.

visitModel

public void visitModel(Model model)
                throws CoComposeException
Determines the dependencies of the composites in the model.
Overrides:
visitModel in class ModelVisitor
Parameters:
model - The model to visit.
Throws:
CoComposeException - if a dependency cycle is detected.

visitComposite

public void visitComposite(Composite composite)
                    throws CoComposeException
Determines the composite dependencies and inserts the composite in the list at the appropriate index.
PRE: The model must be defined for this concept.
Overrides:
visitComposite in class ModelVisitor
Parameters:
composite - The composite to visit.
Throws:
CoComposeException - if a dependency cycle is detected.