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 intDEFAULT_CACHE_MAX_SIZEDefault max number of feature rows to retain in cache
-
Constructor Summary
Constructors Constructor Description FeatureCache()Constructor, created with cache max size ofDEFAULT_CACHE_MAX_SIZEFeatureCache(int size)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear the cachevoidclearAndResize(int maxSize)Clear and resize the cacheFeatureRowget(long featureId)Get the cached feature row by feature idintgetMaxSize()Get the cache max sizeintgetSize()Get the current cache size, number of feature rows cachedFeatureRowput(FeatureRow featureRow)Cache the feature rowFeatureRowremove(long featureId)Remove the cached feature row by idFeatureRowremove(FeatureRow featureRow)Remove the cached feature rowvoidresize(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
-
-