Package org.mapsforge.poi.storage
Class AbstractPoiCategoryManager
- java.lang.Object
-
- org.mapsforge.poi.storage.AbstractPoiCategoryManager
-
- All Implemented Interfaces:
PoiCategoryManager
public abstract class AbstractPoiCategoryManager extends java.lang.Object implements PoiCategoryManager
Abstract implementation for thePoiCategoryManagerinterface. This implementation provides functionality for getting categories by their ID / name.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.Integer,PoiCategory>categoryMapMaps category IDs to categories.protected PoiCategoryrootCategoryThe hierarchies root category.protected static java.lang.StringSELECT_STATEMENT
-
Constructor Summary
Constructors Constructor Description AbstractPoiCategoryManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PoiCategorygetPoiCategoryByID(int id)Returns a category given by its ID or throws an exception if this category does not exist.PoiCategorygetPoiCategoryByTitle(java.lang.String title)Returns a category given by unique title or throws an exception if this category does not exist.PoiCategorygetRootCategory()Returns the category tree's root.
-
-
-
Field Detail
-
SELECT_STATEMENT
protected static final java.lang.String SELECT_STATEMENT
- See Also:
- Constant Field Values
-
rootCategory
protected PoiCategory rootCategory
The hierarchies root category.
-
categoryMap
protected java.util.Map<java.lang.Integer,PoiCategory> categoryMap
Maps category IDs to categories.
-
-
Method Detail
-
getPoiCategoryByID
public PoiCategory getPoiCategoryByID(int id) throws UnknownPoiCategoryException
Returns a category given by its ID or throws an exception if this category does not exist.- Specified by:
getPoiCategoryByIDin interfacePoiCategoryManager- Parameters:
id- The category's ID.- Returns:
- The category having this ID or null.
- Throws:
UnknownPoiCategoryException- if the category has not been added to thePoiCategoryManager.
-
getPoiCategoryByTitle
public PoiCategory getPoiCategoryByTitle(java.lang.String title) throws UnknownPoiCategoryException
Returns a category given by unique title or throws an exception if this category does not exist.- Specified by:
getPoiCategoryByTitlein interfacePoiCategoryManager- Parameters:
title- The category's title- Returns:
- The category c with
c.title.equalsIgnoreCase(title). - Throws:
UnknownPoiCategoryException- if the category has not been added to thePoiCategoryManager.
-
getRootCategory
public PoiCategory getRootCategory() throws UnknownPoiCategoryException
Returns the category tree's root.- Specified by:
getRootCategoryin interfacePoiCategoryManager- Returns:
- The tree's root category or null if the tree is empty.
- Throws:
UnknownPoiCategoryException- if the category has not been added to thePoiCategoryManager.
-
-