Package org.insa.graphs.algorithm.utils
Class BinaryHeapFormatter
- java.lang.Object
-
- org.insa.graphs.algorithm.utils.BinaryHeapFormatter
-
public class BinaryHeapFormatter extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description BinaryHeapFormatter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
main(java.lang.String[] args)
protected static <E extends java.lang.Comparable<E>>
org.insa.graphs.algorithm.utils.BinaryHeapFormatter.ContexttoStringLoop(BinaryHeap<E> heap, org.insa.graphs.algorithm.utils.BinaryHeapFormatter.Context ctxt, int node, int max_depth)
static <E extends java.lang.Comparable<E>>
java.lang.StringtoStringSorted(BinaryHeap<E> heap, int max_elements)
Creates a multi-lines string representing a sorted view of the given binary heap.static <E extends java.lang.Comparable<E>>
java.lang.StringtoStringTree(BinaryHeap<E> heap, int maxDepth)
Creates a multi-lines string representing a tree view of the given binary heap.
-
-
-
Method Detail
-
toStringLoop
protected static <E extends java.lang.Comparable<E>> org.insa.graphs.algorithm.utils.BinaryHeapFormatter.Context toStringLoop(BinaryHeap<E> heap, org.insa.graphs.algorithm.utils.BinaryHeapFormatter.Context ctxt, int node, int max_depth)
-
toStringTree
public static <E extends java.lang.Comparable<E>> java.lang.String toStringTree(BinaryHeap<E> heap, int maxDepth)
Creates a multi-lines string representing a tree view of the given binary heap.- Parameters:
heap
- The binary heap to display.maxDepth
- Maximum depth of the tree to display.- Returns:
- a string containing a tree view of the given binary heap.
-
toStringSorted
public static <E extends java.lang.Comparable<E>> java.lang.String toStringSorted(BinaryHeap<E> heap, int max_elements)
Creates a multi-lines string representing a sorted view of the given binary heap.- Parameters:
heap
- The binary heap to display.maxElement
- Maximum number of elements to display. or-1
to display all the elements.- Returns:
- a string containing a sorted view the given binary heap.
-
main
public static void main(java.lang.String[] args)
-
-