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 int
Size 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 void
added
(WorldFileResource image) Invoked after an image has been added to the image file.protected boolean
exists
(int index) Returnstrue
if 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 void
removed
(int index) Invoked after an image has been removed from the image file.int
size()
Returns the number of images in this list.protected int
Returns 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, toArray
Methods inherited from class java.util.AbstractSequentialList
add, addAll, iterator, set
Methods inherited from class java.util.AbstractList
add, clear, hashCode, indexOf, lastIndexOf, listIterator, removeRange, subList
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, remove, retainAll, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods 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 benull
if 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:
size
in interfaceCollection<WorldFileResource>
- Specified by:
size
in interfaceList<WorldFileResource>
- Overrides:
size
in 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 byListOfUnknownSize
for optimizing some operations.- Overrides:
sizeIfKnown
in 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) Returnstrue
if an element exists at the given index. Current implementations is not more efficient thanget(int)
.- Specified by:
exists
in classListOfUnknownSize<WorldFileResource>
- Parameters:
index
- the index where to verify if an element exists.- Returns:
true
if an element exists at the given index.
-
get
Returns the image at the given index. New instances are created when first requested.- Specified by:
get
in interfaceList<WorldFileResource>
- Specified by:
get
in 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:
remove
in interfaceList<WorldFileResource>
- Overrides:
remove
in classAbstractSequentialList<WorldFileResource>
-