org.cumt.model
Class Model

java.lang.Object
  extended by org.cumt.model.IdentifiedObject
      extended by org.cumt.model.PropertyAwareObject
          extended by org.cumt.model.BaseModelNode
              extended by org.cumt.model.Model
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Container<BaseModelNode>

public class Model
extends BaseModelNode
implements Container<BaseModelNode>

Represents an UML model

Author:
Carlos Descalzi
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.cumt.model.BaseModelNode
ATTRIBUTES, DESCRIPTION, IGNORED_ON_GENERATION, NAME
 
Constructor Summary
Model()
           
 
Method Summary
 void add(BaseModelNode node)
          Adds a new node
 void addContainerListener(ContainerListener listener)
           
 void addStereotype(Stereotype stereotype)
           
 void addStereotypes(java.util.List<Stereotype> added)
           
 void deleteVariable(java.lang.String name)
           
 java.util.Set<Stereotype> findStereotypesForType(java.lang.Class<? extends BaseModelNode> type)
           
 java.util.List<BaseModelNode> getContents()
          Returns all the children
static Model getModelFrom(BaseModelNode node)
          Convenience method used to search for the model from any child node
 java.util.Set<Stereotype> getStereotypes()
           
 java.lang.String getVariable(java.lang.String variable)
           
 java.util.Set<java.lang.String> getVariableNames()
           
 java.util.Map<java.lang.String,java.lang.String> getVariables()
           
 void remove(BaseModelNode node)
          Removes a node
 void removeContainerListener(ContainerListener listener)
           
 void removeStereotypes(java.util.List<Stereotype> removed)
           
<T extends ModelObject>
java.util.List<T>
search(java.lang.Class<T> type)
          Search for any object of a given type, including subclases of that type
<T extends BaseModelNode>
java.util.List<T>
search(java.lang.Class<T> type, java.lang.String name)
          FIXME Include wildcards in name pattern Search for any object of a given type, including subclases of that type, and a given name
static
<T extends BaseModelNode>
java.util.List<T>
search(java.lang.Class<T> type, java.lang.String name, Container<BaseModelNode> container)
          Searches for objects of a given type and name in a container
 void setVariable(java.lang.String variable, java.lang.String value)
           
 void setVariables(java.util.Map<java.lang.String,java.lang.String> newModelVariables)
           
 
Methods inherited from class org.cumt.model.BaseModelNode
clone, getAttribute, getAttributeNames, getAttributes, getCreationDate, getDefaultName, getDescription, getName, getParent, isIgnoredOnGeneration, removeAttribute, setAttribute, setAttributes, setDescription, setIgnoredOnGeneration, setName, setParent, toString
 
Methods inherited from class org.cumt.model.PropertyAwareObject
addPropertyChangeListener, firePropertyChange, removePropertyChangeListener
 
Methods inherited from class org.cumt.model.IdentifiedObject
equals, getId, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Model

public Model()
Method Detail

getStereotypes

public java.util.Set<Stereotype> getStereotypes()

findStereotypesForType

public java.util.Set<Stereotype> findStereotypesForType(java.lang.Class<? extends BaseModelNode> type)

addStereotype

public void addStereotype(Stereotype stereotype)

addStereotypes

public void addStereotypes(java.util.List<Stereotype> added)

removeStereotypes

public void removeStereotypes(java.util.List<Stereotype> removed)

add

public void add(BaseModelNode node)
Description copied from interface: Container
Adds a new node

Specified by:
add in interface Container<BaseModelNode>

remove

public void remove(BaseModelNode node)
Description copied from interface: Container
Removes a node

Specified by:
remove in interface Container<BaseModelNode>

getContents

public java.util.List<BaseModelNode> getContents()
Description copied from interface: Container
Returns all the children

Specified by:
getContents in interface Container<BaseModelNode>
Returns:

addContainerListener

public void addContainerListener(ContainerListener listener)
Specified by:
addContainerListener in interface Container<BaseModelNode>

removeContainerListener

public void removeContainerListener(ContainerListener listener)
Specified by:
removeContainerListener in interface Container<BaseModelNode>

getModelFrom

public static Model getModelFrom(BaseModelNode node)
Convenience method used to search for the model from any child node

Parameters:
node - the child node where to start to look for. It has to be directly or indirectly inside the model
Returns:
the model instance

search

public <T extends ModelObject> java.util.List<T> search(java.lang.Class<T> type)
Search for any object of a given type, including subclases of that type

Parameters:
type - the object type
Returns:
a list of all objects which are instance of the given type

search

public <T extends BaseModelNode> java.util.List<T> search(java.lang.Class<T> type,
                                                          java.lang.String name)
FIXME Include wildcards in name pattern Search for any object of a given type, including subclases of that type, and a given name

Parameters:
type - the object type
name - the name to look for
Returns:
a list of all objects which are instance of the given type and name

search

public static <T extends BaseModelNode> java.util.List<T> search(java.lang.Class<T> type,
                                                                 java.lang.String name,
                                                                 Container<BaseModelNode> container)
Searches for objects of a given type and name in a container

Parameters:
type - the type to look for, includes subclasses
name - the name to look for
container - the container where to look for
Returns:
a list of results

getVariables

public java.util.Map<java.lang.String,java.lang.String> getVariables()

setVariable

public void setVariable(java.lang.String variable,
                        java.lang.String value)

getVariable

public java.lang.String getVariable(java.lang.String variable)

getVariableNames

public java.util.Set<java.lang.String> getVariableNames()

deleteVariable

public void deleteVariable(java.lang.String name)

setVariables

public void setVariables(java.util.Map<java.lang.String,java.lang.String> newModelVariables)


Copyright © 2006 null. All Rights Reserved.