public abstract class AbstractPackage extends AbstractModelElement implements IPackage
IModelElement.ElementTypeOBJECT| Constructor and Description |
|---|
AbstractPackage(String name,
IPackage container)
Create a new package with a name and an optional containing package (can be null)
|
| Modifier and Type | Method and Description |
|---|---|
void |
addElement(IModelElement element) |
List<IModelElement> |
getContents(boolean deep)
Return the contents of this package, a collection of IModelElement
objects.
|
IModelElement |
getElementByName(String name,
boolean deep)
Scan a package and return the model element with a given name.
|
IModelElement.ElementType |
getElementType()
Return an enum indicating what type of element this is, to reduce the need to
sub-cast prematurely.
|
protected int |
getNumberOfElements(String name)
Return the number of elements with a given name in this package or subpackages.
|
int |
getSize()
Return the number of elements and packages in the package
|
boolean |
isAmbiguous(String name)
Returns true if a model element name occurs in multiple sub-packages, and
hence a global reference to the name would be ambiguous.
|
void |
removeElement(IModelElement element) |
addChild, getContainingPackage, getDescendants, getName, getOriginalName, getParent, getQualifiedName, getUserData, isAssignableFrom, isSupplementary, setName, setOriginalName, setParent, setSupplementary, setUserDataclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetContainingPackage, getDescendants, getDocumentation, getName, getOriginalName, getParent, getQualifiedName, getUserData, isAssignableFrom, isSupplementary, setUserDatapublic void addElement(IModelElement element)
public List<IModelElement> getContents(boolean deep)
IPackagegetContents in interface IPackagedeep - if true, return the contents of subpackagespublic IModelElement getElementByName(String name, boolean deep)
IPackage
Note: This returns the first element matching the name if a deep
search is used. Use IPackage.isAmbiguous(String) to determine if multiple
elements with the name exist - and if so, look them up in the right
package instead.
getElementByName in interface IPackagename - the name to look fordeep - scan subpackages if truepublic IModelElement.ElementType getElementType()
IModelElementgetElementType in interface IModelElementpublic int getSize()
IPackagepublic boolean isAmbiguous(String name)
IPackageisAmbiguous in interface IPackagename - the element nameprotected int getNumberOfElements(String name)
name - the name to look forpublic void removeElement(IModelElement element)
Copyright © 2006-2013. All Rights Reserved.