Package org.spdx.core
Class ModelCollection<T>
- java.lang.Object
-
- org.spdx.core.ModelCollection<T>
-
- All Implemented Interfaces:
Iterable<Object>,Collection<Object>
- Direct Known Subclasses:
ModelSet
public class ModelCollection<T> extends Object implements Collection<Object>
Collection of elements stored in a ModelStore- Author:
- Gary O'Neall
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,IExternalElementInfo>externalMapMap of URI's of elements referenced but not present in the store
-
Constructor Summary
Constructors Constructor Description ModelCollection(IModelStore modelStore, String objectUri, PropertyDescriptor propertyDescriptor, IModelCopyManager copyManager, Class<?> type, String specVersion, String idPrefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(Object element)booleanaddAll(Collection<? extends Object> c)voidclear()booleancontains(Object o)booleancontainsAll(Collection<?> c)IModelStoregetModelStore()StringgetObjectUri()PropertyDescriptorgetPropertyDescriptor()booleanisEmpty()Iterator<Object>iterator()booleanremove(Object element)booleanremoveAll(Collection<?> c)booleanretainAll(Collection<?> c)intsize()Object[]toArray()<T1> T1[]toArray(T1[] a)List<Object>toImmutableList()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
-
-
-
Field Detail
-
externalMap
protected Map<String,IExternalElementInfo> externalMap
Map of URI's of elements referenced but not present in the store
-
-
Constructor Detail
-
ModelCollection
public ModelCollection(IModelStore modelStore, String objectUri, PropertyDescriptor propertyDescriptor, @Nullable IModelCopyManager copyManager, @Nullable Class<?> type, String specVersion, String idPrefix) throws InvalidSPDXAnalysisException
- Parameters:
modelStore- Storage for the model collectionobjectUri- Object URI or anonymous IDpropertyDescriptor- descriptor for the property use for the model collectionscopyManager- if non-null, use this to copy properties when referenced outside this model storetype- The class of the elements to be stored in the collection if none, null if not knownspecVersion- version of the SPDX spec the object complies withidPrefix- prefix to be used when generating new SPDX IDs- Throws:
InvalidSPDXAnalysisException- on parsing or store errors
-
-
Method Detail
-
size
public int size()
- Specified by:
sizein interfaceCollection<T>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<T>
-
contains
public boolean contains(Object o)
- Specified by:
containsin interfaceCollection<T>
-
toImmutableList
public List<Object> toImmutableList()
- Returns:
- a list of objects for the model collection
-
toArray
public Object[] toArray()
- Specified by:
toArrayin interfaceCollection<T>
-
toArray
public <T1> T1[] toArray(T1[] a)
- Specified by:
toArrayin interfaceCollection<T>
-
add
public boolean add(Object element)
- Specified by:
addin interfaceCollection<T>
-
remove
public boolean remove(Object element)
- Specified by:
removein interfaceCollection<T>
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<T>
-
addAll
public boolean addAll(Collection<? extends Object> c)
- Specified by:
addAllin interfaceCollection<T>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAllin interfaceCollection<T>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAllin interfaceCollection<T>
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<T>
-
getModelStore
public IModelStore getModelStore()
- Returns:
- the modelStore
-
getObjectUri
public String getObjectUri()
- Returns:
- the objectUri
-
getPropertyDescriptor
public PropertyDescriptor getPropertyDescriptor()
- Returns:
- the propertyDescriptor
-
-