|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.nrl.parser.model.AbstractModelElement net.sourceforge.nrl.parser.model.AbstractPackage
public abstract class AbstractPackage
Abstract implementation of a package. Provides basic content management.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface net.sourceforge.nrl.parser.model.IModelElement |
---|
IModelElement.ElementType |
Constructor Summary | |
---|---|
AbstractPackage(String name,
IPackage container)
Create a new package with a name and an optional containing package (can be null) |
Method Summary | |
---|---|
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. |
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)
|
Methods inherited from class net.sourceforge.nrl.parser.model.AbstractModelElement |
---|
addChild, getContainingPackage, getDescendants, getName, getOriginalName, getParent, getQualifiedName, getUserData, isAssignableFrom, isSupplementary, setName, setOriginalName, setParent, setSupplementary, setUserData |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sourceforge.nrl.parser.model.IModelElement |
---|
getContainingPackage, getDescendants, getDocumentation, getName, getOriginalName, getParent, getQualifiedName, getUserData, isAssignableFrom, isSupplementary, setUserData |
Constructor Detail |
---|
public AbstractPackage(String name, IPackage container)
name
- the namecontainer
- the containing packageMethod Detail |
---|
public void addElement(IModelElement element)
public List<IModelElement> getContents(boolean deep)
IPackage
getContents
in interface IPackage
deep
- if true, return the contents of subpackages
public 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 IPackage
name
- the name to look fordeep
- scan subpackages if true
public IModelElement.ElementType getElementType()
IModelElement
getElementType
in interface IModelElement
public int getSize()
IPackage
getSize
in interface IPackage
public boolean isAmbiguous(String name)
IPackage
isAmbiguous
in interface IPackage
name
- the element name
public void removeElement(IModelElement element)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |