Class NodeMapper<T>

  • Type Parameters:
    T - the generic type, e.g. TreeNode or DocumentNode

    public class NodeMapper<T>
    extends Object
    The Class NodeMapper maps Strings to nodes. Intended to map unique labels (e.g. node id => node). T is usually TreeNode or DocumentNode.
    Author:
    Martin Scharm
    See Also:
    TreeNode, DocumentNode, TextNode
    • Constructor Detail

      • NodeMapper

        public NodeMapper()
        Instantiate a new mapper.
    • Method Detail

      • getIds

        public Set<String> getIds()
        Gets the known identifiers.
        Returns:
        the known identifiers
      • putNode

        public void putNode​(String id,
                            T node)
        Inserts a new node.
        Parameters:
        id - the identifier
        node - the node
      • rmNode

        public void rmNode​(String id)
        Removes a node.
        Parameters:
        id - the identifier
      • getNode

        public T getNode​(String id)
        Gets a node that is stored for a certain identifier.
        Parameters:
        id - the identifier
        Returns:
        the node