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, ModelTransformation, OrConstraint, Property, RefinedElement, Refinement, RelationElement, Role, SimpleProperty, SolutionPattern
All Known Implementing Classes:
DefaultAndConstraint, DefaultCompositeConstraint, DefaultConcept, DefaultConstraint, DefaultElementConstraint, DefaultImplementationGenerator, DefaultImplementationPattern, DefaultImplementationRolePart, DefaultModel, DefaultModelProperty, DefaultModelTransformation, 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.10, 07/05/2004
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.
 ModelElement getDeepOwnedElement(ModelElement copy)
          Retrieves an owned element in this namespace or a nested 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.
 List getOwnedElements()
          Returns the elements within this namespace.
 List getOwnedElements(Class elementClass)
          Returns the elements of a given class within this namespace.
 Map getOwnedIds()
          Returns the global ids for the root 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, getRootNamespace, 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()
Returns the elements within this namespace.

Returns:
the List of owned elements.

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.

getDeepOwnedElement

public ModelElement getDeepOwnedElement(ModelElement copy)
Retrieves an owned element in this namespace or a nested namespace.

Parameters:
copy - - the (remote) copy of the element to retrieve.
Returns:
the owned element 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.

getOwnedIds

public Map getOwnedIds()
Returns the global ids for the root namespace. Each id points at its corresponding ModelElement.

Returns:
the global ids for the root namespace.