Class WorldFileStore.Components
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.AbstractSequentialList<E>
org.apache.sis.internal.util.ListOfUnknownSize<WorldFileResource>
org.apache.sis.internal.storage.image.WorldFileStore.Components
- All Implemented Interfaces:
Iterable<WorldFileResource>,Collection<WorldFileResource>,List<WorldFileResource>
- Enclosing class:
- WorldFileStore
A list of images where each
WorldFileResource instance is initialized when first needed.
Fetching the list size may be a costly operation and will be done only if requested.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate WorldFileResource[]All elements in this list.private intSize of this list, or any negative value if unknown.Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) final voidadded(WorldFileResource image) Invoked after an image has been added to the image file.protected booleanexists(int index) Returnstrueif an element exists at the given index.get(int index) Returns the image at the given index.remove(int index) Removes the element at the specified position in this list.(package private) final voidremoved(int index) Invoked after an image has been removed from the image file.intsize()Returns the number of images in this list.protected intReturns the number of images if this information is known, or any negative value otherwise.Methods inherited from class org.apache.sis.internal.util.ListOfUnknownSize
equals, isEmpty, listIterator, removeAll, spliterator, toArray, toArrayMethods inherited from class java.util.AbstractSequentialList
add, addAll, iterator, setMethods inherited from class java.util.AbstractList
add, clear, hashCode, indexOf, lastIndexOf, listIterator, removeRange, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, remove, retainAll, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, streamMethods inherited from interface java.util.List
addAll, contains, containsAll, remove, replaceAll, retainAll, sort
-
Field Details
-
size
private int sizeSize of this list, or any negative value if unknown. -
images
All elements in this list. Some array elements may benullif the image has never been requested.
-
-
Constructor Details
-
Components
private Components(int numImages) Creates a new list of images.- Parameters:
numImages- number of images, or any negative value if unknown.
-
-
Method Details
-
size
public int size()Returns the number of images in this list. This method may be costly when invoked for the first time.- Specified by:
sizein interfaceCollection<WorldFileResource>- Specified by:
sizein interfaceList<WorldFileResource>- Overrides:
sizein classListOfUnknownSize<WorldFileResource>- Returns:
- the number of elements in this list.
-
sizeIfKnown
protected int sizeIfKnown()Returns the number of images if this information is known, or any negative value otherwise. This is used byListOfUnknownSizefor optimizing some operations.- Overrides:
sizeIfKnownin classListOfUnknownSize<WorldFileResource>- Returns:
ListOfUnknownSize.size()if its value is already known, or any negative value if it still costly to compute.
-
exists
protected boolean exists(int index) Returnstrueif an element exists at the given index. Current implementations is not more efficient thanget(int).- Specified by:
existsin classListOfUnknownSize<WorldFileResource>- Parameters:
index- the index where to verify if an element exists.- Returns:
trueif an element exists at the given index.
-
get
Returns the image at the given index. New instances are created when first requested.- Specified by:
getin interfaceList<WorldFileResource>- Specified by:
getin classListOfUnknownSize<WorldFileResource>- Parameters:
index- index of the image for which to get a resource.- Returns:
- resource for the image identified by the given index.
- Throws:
IndexOutOfBoundsException- if the image index is out of bounds.
-
added
Invoked after an image has been added to the image file. This method adds in this list a reference to the newly added file.- Parameters:
image- the image to add to this list.
-
removed
Invoked after an image has been removed from the image file. This method performs no bounds check (it must be done by the caller).- Parameters:
index- index of the image that has been removed.- Throws:
DataStoreException
-
remove
Removes the element at the specified position in this list.- Specified by:
removein interfaceList<WorldFileResource>- Overrides:
removein classAbstractSequentialList<WorldFileResource>
-