Package org.insa.graphs.algorithm.utils
Class BinaryHeapFormatter.Context
- java.lang.Object
-
- org.insa.graphs.algorithm.utils.BinaryHeapFormatter.Context
-
- Enclosing class:
- BinaryHeapFormatter
private static class BinaryHeapFormatter.Context extends java.lang.Object
This class is used byBinaryHeapFormatter.toStringTree(org.insa.graphs.algorithm.utils.BinaryHeap<E>, int)
, and simply contains three string accumulating. This is an immutable class.
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
acu
java.lang.String
lastmargin
java.lang.String
margin
-
Constructor Summary
Constructors Constructor Description Context(java.lang.String acu, java.lang.String margin, java.lang.String lastMargin)
Creaet a newContext
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BinaryHeapFormatter.Context
appendBranch(java.lang.Integer count, java.lang.String label)
Creates a new context by appending a branch to this context.BinaryHeapFormatter.Context
appendNewlines(int n)
Creates a new context by appending newlines to this context.BinaryHeapFormatter.Context
appendText(java.lang.Integer count, java.lang.String text)
Creates a new context by appending the given string to this context.
-
-
-
Method Detail
-
appendNewlines
public BinaryHeapFormatter.Context appendNewlines(int n)
Creates a new context by appending newlines to this context.- Parameters:
n
- Number of newlines to append.- Returns:
- a new context with
n
newlines appended.
-
appendText
public BinaryHeapFormatter.Context appendText(java.lang.Integer count, java.lang.String text)
Creates a new context by appending the given string to this context.- Parameters:
count
- Number of spaces to add to the margin, ornull
to use the length of the string.text
- String to append.- Returns:
- a new context with
text
appended.
-
appendBranch
public BinaryHeapFormatter.Context appendBranch(java.lang.Integer count, java.lang.String label)
Creates a new context by appending a branch to this context.- Parameters:
n
- Number of spaces to add to the margin, ornull
to use the length of the string.label
- Name of the branch.- Returns:
- a new context with the branch appended.
-
-