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>
externalMap
Map 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 boolean
add(Object element)
boolean
addAll(Collection<? extends Object> c)
void
clear()
boolean
contains(Object o)
boolean
containsAll(Collection<?> c)
IModelStore
getModelStore()
String
getObjectUri()
PropertyDescriptor
getPropertyDescriptor()
boolean
isEmpty()
Iterator<Object>
iterator()
boolean
remove(Object element)
boolean
removeAll(Collection<?> c)
boolean
retainAll(Collection<?> c)
int
size()
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:
size
in interfaceCollection<T>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceCollection<T>
-
contains
public boolean contains(Object o)
- Specified by:
contains
in interfaceCollection<T>
-
toImmutableList
public List<Object> toImmutableList()
- Returns:
- a list of objects for the model collection
-
toArray
public Object[] toArray()
- Specified by:
toArray
in interfaceCollection<T>
-
toArray
public <T1> T1[] toArray(T1[] a)
- Specified by:
toArray
in interfaceCollection<T>
-
add
public boolean add(Object element)
- Specified by:
add
in interfaceCollection<T>
-
remove
public boolean remove(Object element)
- Specified by:
remove
in interfaceCollection<T>
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll
in interfaceCollection<T>
-
addAll
public boolean addAll(Collection<? extends Object> c)
- Specified by:
addAll
in interfaceCollection<T>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interfaceCollection<T>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll
in interfaceCollection<T>
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<T>
-
getModelStore
public IModelStore getModelStore()
- Returns:
- the modelStore
-
getObjectUri
public String getObjectUri()
- Returns:
- the objectUri
-
getPropertyDescriptor
public PropertyDescriptor getPropertyDescriptor()
- Returns:
- the propertyDescriptor
-
-