Class LinkedForestMap.TreeEntryNode<K,V>

java.lang.Object
org.miaixz.bus.core.center.map.LinkedForestMap.TreeEntryNode<K,V>
Type Parameters:
K - key类型
All Implemented Interfaces:
Map.Entry<K,V>, TreeEntry<K,V>
Enclosing class:
LinkedForestMap<K,V>

public static class LinkedForestMap.TreeEntryNode<K,V> extends Object implements TreeEntry<K,V>
树节点
  • Constructor Details

    • TreeEntryNode

      public TreeEntryNode(LinkedForestMap.TreeEntryNode<K,V> parent, K key)
      创建一个节点
      Parameters:
      parent - 节点的父节点
      key - 节点的key
    • TreeEntryNode

      public TreeEntryNode(LinkedForestMap.TreeEntryNode<K,V> parent, K key, V value)
      创建一个节点
      Parameters:
      parent - 节点的父节点
      key - 节点的key
      value - 节点的value
  • Method Details

    • getKey

      public K getKey()
      获取当前节点的key
      Specified by:
      getKey in interface Map.Entry<K,V>
      Returns:
      节点的key
    • getWeight

      public int getWeight()
      获取当前节点与根节点的距离
      Specified by:
      getWeight in interface TreeEntry<K,V>
      Returns:
      当前节点与根节点的距离
    • getValue

      public V getValue()
      获取节点的value
      Specified by:
      getValue in interface Map.Entry<K,V>
      Returns:
      节点的value
    • setValue

      public V setValue(V value)
      设置节点的value
      Specified by:
      setValue in interface Map.Entry<K,V>
      Parameters:
      value - 节点的value
      Returns:
      节点的旧value
    • isRoot

      public boolean isRoot()
      当前节点是否为根节点
      Returns:
      当前节点是否为根节点
    • getRoot

      public LinkedForestMap.TreeEntryNode<K,V> getRoot()
      获取以当前节点作为叶子节点的树结构,然后获取该树结构的根节点
      Specified by:
      getRoot in interface TreeEntry<K,V>
      Returns:
      根节点
    • getDeclaredParent

      public LinkedForestMap.TreeEntryNode<K,V> getDeclaredParent()
      获取当前节点直接关联的父节点
      Specified by:
      getDeclaredParent in interface TreeEntry<K,V>
      Returns:
      父节点,当节点不存在对应父节点时返回null
    • getParent

      public LinkedForestMap.TreeEntryNode<K,V> getParent(K key)
      获取以当前节点作为叶子节点的树结构,然后获取该树结构中当前节点的指定父节点
      Specified by:
      getParent in interface TreeEntry<K,V>
      Parameters:
      key - 指定父节点的key
      Returns:
      指定父节点,当不存在时返回null
    • forEachChild

      public void forEachChild(boolean includeSelf, Consumer<TreeEntry<K,V>> nodeConsumer)
      获取以当前节点作为根节点的树结构,然后遍历所有节点
      Specified by:
      forEachChild in interface TreeEntry<K,V>
      Parameters:
      includeSelf - 是否处理当前节点
      nodeConsumer - 对节点的处理
    • equalsKey

      public boolean equalsKey(K key)
      指定key与当前节点的key是否相等
      Parameters:
      key - 要比较的key
      Returns:
      是否key一致
    • getChild

      public LinkedForestMap.TreeEntryNode<K,V> getChild(K key)
      获取以当前节点作为根节点的树结构,然后获取该树结构中的当前节点的指定子节点
      Specified by:
      getChild in interface TreeEntry<K,V>
      Parameters:
      key - 指定子节点的key
      Returns:
      节点
    • getDeclaredChildren

      public Map<K,TreeEntry<K,V>> getDeclaredChildren()
      获取当前节点直接关联的子节点
      Specified by:
      getDeclaredChildren in interface TreeEntry<K,V>
      Returns:
      节点
    • getChildren

      public Map<K,TreeEntry<K,V>> getChildren()
      获取以当前节点作为根节点的树结构,然后按广度优先获取该树结构中的当前节点的全部子节点
      Specified by:
      getChildren in interface TreeEntry<K,V>
      Returns:
      节点
    • equals

      public boolean equals(Object o)
      比较目标对象与当前TreeEntry是否相等。 默认只要Map.Entry.getKey()的返回值相同,即认为两者相等
      Specified by:
      equals in interface Map.Entry<K,V>
      Overrides:
      equals in class Object
      Parameters:
      o - 目标对象
      Returns:
      是否
    • hashCode

      public int hashCode()
      返回当前TreeEntry的哈希值。 默认总是返回Map.Entry.getKey()的哈希值
      Specified by:
      hashCode in interface Map.Entry<K,V>
      Overrides:
      hashCode in class Object
      Returns:
      哈希值