Package com.e1c.langtool.generatestring
Class TempFileFeatureCollection
java.lang.Object
com.e1c.langtool.generatestring.TempFileFeatureCollection
- All Implemented Interfaces:
Iterable<FeatureValue>,Collection<FeatureValue>
Temp file storage for collection of
FeatureValue, using MapDB. It is necessary to use temp storage
while collecting huge number of objects, such as "all object of a project".
This collection allows to store fast in memory small amount of data with evicting this data to temp-file storage.-
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new temp-file feature collection. -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(FeatureValue e) booleanaddAll(Collection<? extends FeatureValue> c) voidclear()booleanbooleancontainsAll(Collection<?> c) voiddispose()protected voidfinalize()Deprecated.getResourceBucket(long id) Gets the resource bucket of collectedFeatureValue.booleanisEmpty()iterator()voidputResourceBucket(long id, Collection<FeatureValue> bucket) Put resource bucket back to cache.booleanbooleanremoveAll(Collection<?> c) The iterator of TOP-object resources.booleanretainAll(Collection<?> c) intsize()Object[]toArray()<T> T[]toArray(T[] a) voidupdateValue(FeatureValue value) Update given value in the MapDB.Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
TempFileFeatureCollection
public TempFileFeatureCollection()Instantiates a new temp-file feature collection.
-
-
Method Details
-
dispose
public void dispose() -
finalize
Deprecated. -
size
public int size()- Specified by:
sizein interfaceCollection<FeatureValue>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<FeatureValue>
-
contains
- Specified by:
containsin interfaceCollection<FeatureValue>
-
resourceIterator
The iterator of TOP-object resources.- Returns:
- the iterator, cannot be
null. - See Also:
-
#getResourceBucket(Long)#putResourceBucket(Long, Collection)
-
iterator
- Specified by:
iteratorin interfaceCollection<FeatureValue>- Specified by:
iteratorin interfaceIterable<FeatureValue>
-
toArray
- Specified by:
toArrayin interfaceCollection<FeatureValue>
-
toArray
public <T> T[] toArray(T[] a) - Specified by:
toArrayin interfaceCollection<FeatureValue>
-
add
- Specified by:
addin interfaceCollection<FeatureValue>
-
remove
- Specified by:
removein interfaceCollection<FeatureValue>
-
updateValue
Update given value in the MapDB. MapDB expect keys and values to be immutable. If we violate this assertion we should explicitly update value in the map.- Parameters:
value- Value to be updated, cannot benull.
-
containsAll
- Specified by:
containsAllin interfaceCollection<FeatureValue>
-
addAll
- Specified by:
addAllin interfaceCollection<FeatureValue>
-
removeAll
- Specified by:
removeAllin interfaceCollection<FeatureValue>
-
retainAll
- Specified by:
retainAllin interfaceCollection<FeatureValue>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<FeatureValue>
-
getResourceBucket
Gets the resource bucket of collectedFeatureValue. Warning! Callers should not modify this resource collection itself. Otherwise should calladd(FeatureValue)andremove(Object).- Parameters:
id- the id of resource, that gets fromresourceIterator()- Returns:
- the resource bucket
-
putResourceBucket
Put resource bucket back to cache.- Parameters:
id- the id of the resource, cannot be {@link null}bucket- the bucket of collected features from the resource, cannot be {@link null}
-