EDU.utwente.CoCompose.translate
Class FlattenVisitor

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

public class FlattenVisitor
extends ModelVisitor

Flattens the model using available solution patterns.

Version:
0.1.16, 31 October 2003
Author:
Dennis Wagelaar

Field Summary
protected  boolean flattenNeeded
          When false, flattening did not change model, so it was not needed.
 
Fields inherited from class EDU.utwente.CoCompose.lang.ModelVisitor
log
 
Constructor Summary
FlattenVisitor()
          Constructs a FlattenVisitor.
 
Method Summary
protected  void addDontFlatten(Composite composite)
          Adds a composite to the set of composites that should not be flattened.
protected  void addDontFlattenType(java.lang.String type)
          Adds a composite type to the set of composite types that should not be flattened.
protected  void addFlatModel(Model flatModel)
          Adds a flattened model to the collection of flattened models.
protected  boolean dontFlatten(Composite composite)
          Checks whether a composite should be flattened based on the set of composites that need not be flattened.
protected  java.util.Set getDontFlatten()
          Gets the set of composites that should not be flattened.
protected  java.util.Set getDontFlattenTypes()
          Gets the set of composite types that should not be flattened.
 java.util.Collection getFlatModels()
          Gets the flattened models so far.
protected  boolean getFull()
          Gets full flattening.
protected  void setDontFlatten(java.util.Set composites)
          Sets the set of composites that should not be flattened.
protected  void setDontFlattenTypes(java.util.Set types)
          Sets the set of composite types that should not be flattened.
protected  void setFlatModels(java.util.Collection flatModels)
          Sets the flattened models so far.
 void setFull(boolean full)
          Sets full flattening.
 void setLogger(Logger logger)
          Sets the logger object.
 void visitComposite(Composite composite)
          Flattens a Composite object.
 void visitModel(Model model)
          Flattens the model.
 
Methods inherited from class EDU.utwente.CoCompose.lang.ModelVisitor
getUpdate, run, setErrorReporter, setUpdate, startModel, visitAbstractConcept, visitCompositePartConcept, visitCompositeRole, visitConcept, visitConstrainedConcept, visitImplementation, visitImplementationGenerator, visitImplementationRolePart, visitLink, visitPublishedConcept, visitSolutionPattern, visitSolutionRole
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

flattenNeeded

protected boolean flattenNeeded
When false, flattening did not change model, so it was not needed.
Constructor Detail

FlattenVisitor

public FlattenVisitor()
Constructs a FlattenVisitor.
Method Detail

getFull

protected boolean getFull()
Gets full flattening.
Returns:
If true, does full flattening, otherwise one level flattening.

setFlatModels

protected void setFlatModels(java.util.Collection flatModels)
Sets the flattened models so far.
Parameters:
flatModels - The collection of flattened models.

addFlatModel

protected void addFlatModel(Model flatModel)
Adds a flattened model to the collection of flattened models.
Parameters:
flatModel - The flattened model to add.

dontFlatten

protected boolean dontFlatten(Composite composite)
Checks whether a composite should be flattened based on the set of composites that need not be flattened.
Parameters:
composite - The composite
Returns:
True if and only if the composite should be flattened.

getDontFlatten

protected java.util.Set getDontFlatten()
Gets the set of composites that should not be flattened.
Returns:
The set of composites.

addDontFlatten

protected void addDontFlatten(Composite composite)
Adds a composite to the set of composites that should not be flattened. This option is used to prevent infinite loops in flattening.
Parameters:
composite - The composite that should not be flattened.

setDontFlatten

protected void setDontFlatten(java.util.Set composites)
Sets the set of composites that should not be flattened. This option is used to prevent infinite loops in flattening.
Parameters:
composites - The set of composites that should not be flattened.

getDontFlattenTypes

protected java.util.Set getDontFlattenTypes()
Gets the set of composite types that should not be flattened.
Returns:
The set of composite types.

addDontFlattenType

protected void addDontFlattenType(java.lang.String type)
Adds a composite type to the set of composite types that should not be flattened.
Parameters:
type - The composite type that should not be flattened.

setDontFlattenTypes

protected void setDontFlattenTypes(java.util.Set types)
Sets the set of composite types that should not be flattened.
Parameters:
types - The set of composite types that should not be flattened.

setLogger

public void setLogger(Logger logger)
Sets the logger object.
Overrides:
setLogger in class ModelVisitor
Parameters:
logger - The object to log to

setFull

public void setFull(boolean full)
Sets full flattening.
Parameters:
full - If true, does full flattening, otherwise one level flattening.

getFlatModels

public java.util.Collection getFlatModels()
Gets the flattened models so far.
Returns:
The collection of flattened models.

visitModel

public void visitModel(Model model)
                throws CoComposeException
Flattens the model.
Overrides:
visitModel in class ModelVisitor
Parameters:
model - The model to flatten.
Throws:
CoComposeException - if one of the model's constraints are not fulfilled or if the model could not be flattened.

visitComposite

public void visitComposite(Composite composite)
                    throws CoComposeException
Flattens a Composite object.
Overrides:
visitComposite in class ModelVisitor
Parameters:
composite - - the composite to flatten.
Throws:
CoComposeException - - if the composite cannot be flattened for the target language of the model.