Package net.ssehub.easy.varModel.model
Class ContainableModelElementList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<ContainableModelElement>
-
- net.ssehub.easy.varModel.model.ContainableModelElementList
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<ContainableModelElement>,java.util.Collection<ContainableModelElement>,java.util.List<ContainableModelElement>,java.util.RandomAccess,IResolutionScope
public class ContainableModelElementList extends java.util.ArrayList<ContainableModelElement> implements IResolutionScope
A list of containable model elements which acts asIResolutionScope. Note that such a list does neither provides imports nor a name and is more or less intended to be considered for searching specific elements inModelQuery.- Author:
- Holger Eichelberger
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private IModelElementparentprivate static longserialVersionUIDIdentification for serialization.
-
Constructor Summary
Constructors Constructor Description ContainableModelElementList(int initialCapacity, IModelElement parent)Creates a new model element list.ContainableModelElementList(IModelElement parent)Creates a new model element list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContainableModelElementgetElement(int index)Returns a contained model element specified byindex.ContainableModelElementgetElement(java.lang.String name)Returns a contained model element specified by itsname.intgetElementCount()Returns the number of contained elements.ProjectImportgetImport(int index)Returns the project import specified byindex.intgetImportsCount()Returns the number of imports.java.lang.StringgetName()Returns the (unqualified) name of the scope.IModelElementgetParent()Returns the parent model element.booleanhasInterfaces()Returns whether this project has interfaces.booleanisInterface()Returns whether this scope is an interfaces.-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Identification for serialization.- See Also:
- Constant Field Values
-
parent
private IModelElement parent
-
-
Constructor Detail
-
ContainableModelElementList
public ContainableModelElementList(IModelElement parent)
Creates a new model element list.- Parameters:
parent- the parent (scope, may be null)
-
ContainableModelElementList
public ContainableModelElementList(int initialCapacity, IModelElement parent)Creates a new model element list.- Parameters:
initialCapacity- the initial capacity of the listparent- the parent (scope, may be null)
-
-
Method Detail
-
getElement
public ContainableModelElement getElement(int index)
Description copied from interface:IResolutionScopeReturns a contained model element specified byindex.- Specified by:
getElementin interfaceIResolutionScope- Parameters:
index- a 0-based index specifying the operation to be returned- Returns:
- the contained element
-
getElementCount
public int getElementCount()
Description copied from interface:IResolutionScopeReturns the number of contained elements.- Specified by:
getElementCountin interfaceIResolutionScope- Returns:
- the number of contained elements
-
getImportsCount
public int getImportsCount()
Description copied from interface:IResolutionScopeReturns the number of imports.- Specified by:
getImportsCountin interfaceIResolutionScope- Returns:
- the number of imports
-
getImport
public ProjectImport getImport(int index)
Description copied from interface:IResolutionScopeReturns the project import specified byindex.- Specified by:
getImportin interfaceIResolutionScope- Parameters:
index- a 0-based index specifying the import to be returned- Returns:
- the project import
-
getParent
public IModelElement getParent()
Description copied from interface:IResolutionScopeReturns the parent model element.- Specified by:
getParentin interfaceIResolutionScope- Returns:
- the parent model element (may be null)
-
getName
public java.lang.String getName()
Returns the (unqualified) name of the scope.- Specified by:
getNamein interfaceIResolutionScope- Returns:
- the unqualified name of the scope
-
hasInterfaces
public boolean hasInterfaces()
Returns whether this project has interfaces.- Specified by:
hasInterfacesin interfaceIResolutionScope- Returns:
trueif it has interfaces,falseelse
-
isInterface
public boolean isInterface()
Description copied from interface:IResolutionScopeReturns whether this scope is an interfaces.- Specified by:
isInterfacein interfaceIResolutionScope- Returns:
trueif it is an interface,falseelse
-
getElement
public ContainableModelElement getElement(java.lang.String name)
Description copied from interface:IResolutionScopeReturns a contained model element specified by itsname.- Specified by:
getElementin interfaceIResolutionScope- Parameters:
name- the qualified or unqualified name to search for- Returns:
- the related element or null if no such element is known
-
-