E
- Type of the elements in the hierarchy.public abstract class ForwardingHierarchy<E> extends ForwardingObject implements Hierarchy<E>
Constructor and Description |
---|
ForwardingHierarchy() |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(E element)
Returns
true if the hierarchy contains the provided element. |
boolean |
containsAll(Iterable<? extends E> elements)
Returns
true if the hierarchy contains all the provided elements. |
protected abstract Hierarchy<E> |
delegate() |
Set<E> |
elementSet()
Returns the set of distinct elements contained in this hierarchy.
|
boolean |
equals(Object object)
Compares the specified object with this hierarchy for equality.
|
Iterable<E> |
getAncestors(E element)
Returns the ancestors of the specified element.
|
List<E> |
getChildren(E element)
Returns the children of the specified element.
|
Set<E> |
getDescendants(E element)
Returns the descendants of the specified element.
|
List<E> |
getFirstLevel()
Returns the first level of the hierarchy.
|
int |
getIndex(E element)
Returns the index of the specified element among its siblings.
|
E |
getParent(E element)
Returns the parent of the specified element.
|
E |
getRoot()
Returns the root element.
|
List<E> |
getSiblings(E element)
Returns the siblings of the specified element.
|
int |
hashCode()
Returns the hash code value for this hierarchy.
|
boolean |
isEmpty()
Returns
true if the hierarchy is empty. |
boolean |
isRooted()
Returns whether the hierarchy is rooted.
|
int |
size()
Returns the number of elements in the hierarchy.
|
toString
protected abstract Hierarchy<E> delegate()
delegate
in class ForwardingObject
public boolean isEmpty()
Hierarchy
true
if the hierarchy is empty.public int size()
Hierarchy
public boolean contains(E element)
Hierarchy
true
if the hierarchy contains the provided element.public boolean containsAll(Iterable<? extends E> elements)
Hierarchy
true
if the hierarchy contains all the provided elements.containsAll
in interface Hierarchy<E>
public Set<E> elementSet()
Hierarchy
elementSet
in interface Hierarchy<E>
public List<E> getChildren(E element)
Hierarchy
getChildren
in interface Hierarchy<E>
element
- Element which children are requested. If null
the first level will be
returned.null
.public List<E> getFirstLevel()
Hierarchy
getFirstLevel
in interface Hierarchy<E>
null
.public E getParent(E element)
Hierarchy
public List<E> getSiblings(E element)
Hierarchy
getSiblings
in interface Hierarchy<E>
element
- Element which siblings are requested.public int getIndex(E element)
Hierarchy
public boolean isRooted()
Hierarchy
public Iterable<E> getAncestors(E element)
Hierarchy
getAncestors
in interface Hierarchy<E>
element
- Element which ancestors are requested.public Set<E> getDescendants(@Nullable E element)
Hierarchy
getDescendants
in interface Hierarchy<E>
element
- Element which descendants are requested. If null
the element set is returned.public boolean equals(@Nullable Object object)
Hierarchy
public int hashCode()
Hierarchy
Object.hashCode()
.hashCode
in interface Hierarchy<E>
hashCode
in class Object
Object.equals(Object)
,
Hierarchy.equals(Object)
Copyright © 2014 Derquinse Projects. All rights reserved.