be.ac.vub.cocompose.lang.core
Interface Namespace

All Superinterfaces:
Cloneable, Element, ModelElement, VisitedElement
All Known Subinterfaces:
AndConstraint, CompositeConstraint, Concept, Constraint, ElementConstraint, ImplementationGenerator, ImplementationPattern, ImplementationRolePart, Model, ModelProperty, OrConstraint, Property, RefinedElement, Refinement, RelationElement, Role, SimpleProperty, SolutionPattern
All Known Implementing Classes:
DefaultAndConstraint, DefaultCompositeConstraint, DefaultConcept, DefaultConstraint, DefaultElementConstraint, DefaultImplementationGenerator, DefaultImplementationPattern, DefaultImplementationRolePart, DefaultModel, DefaultModelProperty, DefaultNamespace, DefaultOrConstraint, DefaultProperty, DefaultRefinedElement, DefaultRefinement, DefaultRelationElement, DefaultRole, DefaultSimpleProperty, DefaultSolutionPattern

public interface Namespace
extends ModelElement

Default container and namespace mechanism interface for all CoCompose language elements.

Since:
0.2.0
Version:
0.2.0, 12/12/2003
Author:
Dennis Wagelaar

Method Summary
 void addOwnedElement(int index, ModelElement modelElement)
          Adds an element to this namespace.
 void addOwnedElement(ModelElement modelElement)
          Adds an element to this namespace.
 List getDeepOwnedElements(Class elementClass)
          Returns the elements of a given class within this namespace and nested namespaces.
 ModelElement getOwnedElement(String name)
          Retrieves an owned element by its name.
 String getOwnedElementId(ModelElement modelElement)
          Returns the Id of the given ModelElement or "orphan" if the element is not contained within this namespace.
 List getOwnedElements()
           
 List getOwnedElements(Class elementClass)
          Returns the elements of a given class within this namespace.
 boolean isRegistered(String name)
          Checks whether a name is already registered within this namespace.
 void registerNameChange(String oldName, String newName)
          Registers an element name within this namespace.
 void removeOwnedElement(ModelElement modelElement)
          Removes a element from this namespace.
 
Methods inherited from interface be.ac.vub.cocompose.lang.core.ModelElement
getId, getModel, getName, getNamespace, setId, setName, setNamespace
 
Methods inherited from interface be.ac.vub.cocompose.lang.Element
addPropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface be.ac.vub.cocompose.lang.VisitedElement
accept
 

Method Detail

getOwnedElements

public List getOwnedElements()

getOwnedElements

public List getOwnedElements(Class elementClass)
Returns the elements of a given class within this namespace.

Parameters:
elementClass - the element class.
Returns:
the List of owned elements.

getDeepOwnedElements

public List getDeepOwnedElements(Class elementClass)
Returns the elements of a given class within this namespace and nested namespaces.

Parameters:
elementClass - the element class.
Returns:
the List of owned elements.

addOwnedElement

public void addOwnedElement(ModelElement modelElement)
                     throws ModelElementException
Adds an element to this namespace.

Parameters:
modelElement - - the element to add.
Throws:
ModelElementException - - if the name of the element is already used within this namespace.

addOwnedElement

public void addOwnedElement(int index,
                            ModelElement modelElement)
                     throws ModelElementException
Adds an element to this namespace.

Parameters:
index - - the index at which to add the element.
modelElement - - the element to add.
Throws:
ModelElementException - - if the name of the element is already used within this namespace.

removeOwnedElement

public void removeOwnedElement(ModelElement modelElement)
Removes a element from this namespace.

Parameters:
modelElement - - the element to remove.

getOwnedElement

public ModelElement getOwnedElement(String name)
Retrieves an owned element by its name.

Parameters:
name - - the name of the element to retrieve.
Returns:
the element with the given name or null if it doesn't exist.

isRegistered

public boolean isRegistered(String name)
Checks whether a name is already registered within this namespace.

Parameters:
name - - the name to check.
Returns:
true if and only if the name is already registered.

registerNameChange

public void registerNameChange(String oldName,
                               String newName)
                        throws ModelElementException
Registers an element name within this namespace. This method should be called by contained ModelElements that want to change their name.

Parameters:
oldName - - the name to change.
newName - - the name to change into.
Throws:
ModelElementException - - if the new name is already used or if the old name does not exist in this namespace.

getOwnedElementId

public String getOwnedElementId(ModelElement modelElement)
Returns the Id of the given ModelElement or "orphan" if the element is not contained within this namespace.

Parameters:
modelElement - - the element to get the Id for.
Returns:
The element Id or null.