public class DoubleLinkedPoiCategory extends Object implements PoiCategory
| Constructor and Description |
|---|
DoubleLinkedPoiCategory(String title,
PoiCategory parent)
Creates a new category without knowing its position in the final category tree.
|
DoubleLinkedPoiCategory(String title,
PoiCategory parent,
int id)
Creates a new category.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
calculateCategoryIDs(DoubleLinkedPoiCategory rootNode,
int maxValue)
This method calculates a unique ID for all nodes in the tree.
|
Collection<PoiCategory> |
deepChildren() |
Collection<PoiCategory> |
getChildren() |
static String |
getGraphVizString(DoubleLinkedPoiCategory rootNode)
Generates a GraphViz source representation as a tree having the current node as its root.
|
int |
getID()
Make sure you call
calculateCategoryIDs(DoubleLinkedPoiCategory, int) first. |
PoiCategory |
getParent() |
String |
getTitle() |
void |
setParent(PoiCategory parent)
Sets the category's parent category.
|
String |
toString() |
public DoubleLinkedPoiCategory(String title, PoiCategory parent)
calculateCategoryIDs(DoubleLinkedPoiCategory, int) to
assign the IDs.title - The category's unique title.parent - The category's parent category. For creating a root node, set the parent to null.public DoubleLinkedPoiCategory(String title, PoiCategory parent, int id)
PoiCategoryManager
when reading a category configuration from a database or XML file. Otherwise call
DoubleLinkedPoiCategory(String, PoiCategory).title - The category's unique title.parent - The category's parent category. For creating a root node, set the parent to null.id - The category's position in the tree determined by left-order-dfs-traversal.public static int calculateCategoryIDs(DoubleLinkedPoiCategory rootNode, int maxValue)
rootNode - The tree's root node. (Any other node will result in invalid IDs!)maxValue - Global maximum ID.public Collection<PoiCategory> deepChildren()
deepChildren in interface PoiCategorypublic Collection<PoiCategory> getChildren()
getChildren in interface PoiCategorypublic static String getGraphVizString(DoubleLinkedPoiCategory rootNode)
rootNode - The resulting graph's root node. (You can use any sub node to get a sub-graph).public int getID()
calculateCategoryIDs(DoubleLinkedPoiCategory, int) first.getID in interface PoiCategorypublic PoiCategory getParent()
getParent in interface PoiCategorypublic String getTitle()
getTitle in interface PoiCategorypublic void setParent(PoiCategory parent)
setParent in interface PoiCategoryparent - The category to be set as parent.Copyright © 2016 mapsforge.org