Package com.chemaxon.calculations.io
Class MemoizingIterator<E,R>
java.lang.Object
com.google.common.collect.UnmodifiableIterator<T>
com.google.common.collect.AbstractIterator<T>
com.chemaxon.calculations.io.CloseableAbstractIterator<OrderedElement<E>>
com.chemaxon.calculations.io.MemoizingIterator<E,R>
- Type Parameters:
E
- Type of iterated elements from the baseCloseableIterator
R
- Type of transformed elements available for retrieval
- All Implemented Interfaces:
CloseableIterator<OrderedElement<E>>
,MemoizedSparseCollection<R>
,Closeable
,AutoCloseable
,Iterator<OrderedElement<E>>
- Direct Known Subclasses:
SmilesMemoizingMoleculeIterator
@PublicAPI
@Beta
@Deprecated(forRemoval=true)
@SubjectToRemoval(date=JAN_01_2025)
public class MemoizingIterator<E,R>
extends com.chemaxon.calculations.io.CloseableAbstractIterator<OrderedElement<E>>
implements MemoizedSparseCollection<R>
Deprecated, for removal: This API element is subject to removal in a future version.
Will be removed without replacement.
Decorate a
CloseableIterator
with the availability of retrieval of a transformation of the iterated elements.
Typical application is to remember SMILES structure sources of Molecule
s imported with a MolImporter
.
It is recommended to access the memoized items use only after AbstractIterator.hasNext()
is false
. Otherwise new
structure might be collected upon the next AbstractIterator.hasNext()
or AbstractIterator.next()
invocation.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Deprecated, for removal: This API element is subject to removal in a future version.protected OrderedElement<E>
Deprecated, for removal: This API element is subject to removal in a future version.getMemoized
(int i) Deprecated, for removal: This API element is subject to removal in a future version.Get a non-missing memoiozed.Deprecated, for removal: This API element is subject to removal in a future version.Function
to access captured non-missing memoizeds.getMemoizedIfPresent
(int i) Deprecated, for removal: This API element is subject to removal in a future version.Get item when present.getMemoizedOrDefault
(int i, R defaultValue) Deprecated, for removal: This API element is subject to removal in a future version.Get item when present or a default value when missing.getMemoizedOrDefaultFunction
(R defaultValue) Deprecated, for removal: This API element is subject to removal in a future version.Function
to access present items with a default value for missing items.int
size()
Deprecated, for removal: This API element is subject to removal in a future version.Collected items count.Methods inherited from class com.google.common.collect.AbstractIterator
endOfData, hasNext, next, peek
Methods inherited from class com.google.common.collect.UnmodifiableIterator
remove
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.chemaxon.calculations.io.CloseableIterator
forward, limit, limit, transform, transformIterator, transformMultipleElements
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
Method Details
-
computeNext
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
computeNext
in classcom.google.common.collect.AbstractIterator<OrderedElement<E>>
-
close
public void close()Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceCloseableIterator<E>
-
size
public int size()Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:MemoizedSparseCollection
Collected items count.Including missing items.
- Specified by:
size
in interfaceMemoizedSparseCollection<E>
- Returns:
- collected items count
-
getMemoizedIfPresent
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:MemoizedSparseCollection
Get item when present.- Specified by:
getMemoizedIfPresent
in interfaceMemoizedSparseCollection<E>
- Parameters:
i
- Index which refers to either a missing or a present element- Returns:
- Collected remembered element
-
getMemoized
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:MemoizedSparseCollection
Get a non-missing memoiozed.- Specified by:
getMemoized
in interfaceMemoizedSparseCollection<E>
- Parameters:
i
- Index of an item which is not missing- Returns:
- Collected remembered item
-
getMemoizedFunction
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:MemoizedSparseCollection
Function
to access captured non-missing memoizeds.- Specified by:
getMemoizedFunction
in interfaceMemoizedSparseCollection<E>
- Returns:
- A
Function
ofInteger
to the memoized typeT
which delegates toMemoizedSparseCollection.getMemoized(int)
-
getMemoizedOrDefault
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:MemoizedSparseCollection
Get item when present or a default value when missing.- Specified by:
getMemoizedOrDefault
in interfaceMemoizedSparseCollection<E>
- Parameters:
i
- Index which refers to either a missing or a present elementdefaultValue
- value for return when missing- Returns:
- Collected remembered element or default when missing
-
getMemoizedOrDefaultFunction
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:MemoizedSparseCollection
Function
to access present items with a default value for missing items.- Specified by:
getMemoizedOrDefaultFunction
in interfaceMemoizedSparseCollection<E>
- Parameters:
defaultValue
- Value to return for missing items.- Returns:
- A
Function
ofInteger
to the memoized typeT
which delegates toMemoizedSparseCollection.getMemoizedOrDefault(int, java.lang.Object)
-