Package mil.nga.geopackage.features.user
Class FeatureCache
- java.lang.Object
-
- mil.nga.geopackage.features.user.FeatureCache
-
public class FeatureCache extends Object
Feature Row Cache for a single feature table- Since:
- 3.2.0
- Author:
- osbornb
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_CACHE_MAX_SIZE
Default max number of feature rows to retain in cache
-
Constructor Summary
Constructors Constructor Description FeatureCache()
Constructor, created with cache max size ofDEFAULT_CACHE_MAX_SIZE
FeatureCache(int size)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear the cachevoid
clearAndResize(int maxSize)
Clear and resize the cacheFeatureRow
get(long featureId)
Get the cached feature row by feature idint
getMaxSize()
Get the cache max sizeint
getSize()
Get the current cache size, number of feature rows cachedFeatureRow
put(FeatureRow featureRow)
Cache the feature rowFeatureRow
remove(long featureId)
Remove the cached feature row by idFeatureRow
remove(FeatureRow featureRow)
Remove the cached feature rowvoid
resize(int maxSize)
Resize the cache
-
-
-
Field Detail
-
DEFAULT_CACHE_MAX_SIZE
public static final int DEFAULT_CACHE_MAX_SIZE
Default max number of feature rows to retain in cache- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FeatureCache
public FeatureCache()
Constructor, created with cache max size ofDEFAULT_CACHE_MAX_SIZE
-
FeatureCache
public FeatureCache(int size)
Constructor- Parameters:
size
- max feature rows to retain in the cache
-
-
Method Detail
-
getMaxSize
public int getMaxSize()
Get the cache max size- Returns:
- max size
-
getSize
public int getSize()
Get the current cache size, number of feature rows cached- Returns:
- cache size
-
get
public FeatureRow get(long featureId)
Get the cached feature row by feature id- Parameters:
featureId
- feature row id- Returns:
- feature row or null
-
put
public FeatureRow put(FeatureRow featureRow)
Cache the feature row- Parameters:
featureRow
- feature row- Returns:
- previous cached feature row or null
-
remove
public FeatureRow remove(FeatureRow featureRow)
Remove the cached feature row- Parameters:
featureRow
- feature row- Returns:
- removed feature row or null
-
remove
public FeatureRow remove(long featureId)
Remove the cached feature row by id- Parameters:
featureId
- feature row id- Returns:
- removed feature row or null
-
clear
public void clear()
Clear the cache
-
resize
public void resize(int maxSize)
Resize the cache- Parameters:
maxSize
- max size
-
clearAndResize
public void clearAndResize(int maxSize)
Clear and resize the cache- Parameters:
maxSize
- max size of the cache
-
-