Class BinaryHeapFormatter.Context

    • 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 new Context.
    • Field Detail

      • acu

        public final java.lang.String acu
      • margin

        public final java.lang.String margin
      • lastmargin

        public final java.lang.String lastmargin
    • Constructor Detail

      • Context

        public Context​(java.lang.String acu,
                       java.lang.String margin,
                       java.lang.String lastMargin)
        Creaet a new Context.
        Parameters:
        acu - The accumulated string.
        margin - The current margin.
        lastMargin - The last margin used.
    • 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, or null 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, or null to use the length of the string.
        label - Name of the branch.
        Returns:
        a new context with the branch appended.