Module org.autogui

Interface GuiRepresentation.TreeString

All Known Implementing Classes:
GuiRepresentation.TreeStringComposite, GuiRepresentation.TreeStringValue
Enclosing interface:
GuiRepresentation

public static interface GuiRepresentation.TreeString
intermediate repesentation of table string; composition of GuiRepresentation.TreeStringValue and GuiRepresentation.TreeStringComposite. toString() returns multiline-strings of tab-separated columns with quoting columns by double-quotation (GuiRepresentation.quoteForTabSeparatedValues(String)).
     //example
     r1c1    r1c2    r1c3
     r2c1    r2c2    r2c3
 
      C=GuiRepresentation.TreeStringComposite, V=GuiRepresentation.TreeStringValue
    //pattern 1 : collection(col1, col2, col3)
     C(lines=true, hasLines=false,
     {C(lines=false, hasLines=false, {V("r1c1"), V("r1c2"), V("r1c3")}),
      C(lines=false, hasLines=false, {V("r2c1"), V("r2c2"), V("r2c3")})})
        .toString() // lines=true, and join sub-composites by new-line,
           //and the sub-composites has no lines but under-line and thus join elements by tab

    //pattern 2 : object(collection(col1,col2,col3))
    C(lines=false, hasLines=true,{
     C(lines=true, hasLines=false,
     {C(lines=false, hasLines=false, {V("r1c1"), V("r1c2"), V("r1c3")}),
      C(lines=false, hasLines=false, {V("r2c1"), V("r2c2"), V("r2c3")})}) })
      .toString() // the top composite lines=false but hasLines=true, thus join lines of sub-composite by new-line
       // and the sub-composite lines=true and same as pattern 1

   //pattern 3 : object(object(col1, col2, col3), object(col1, col2, col3))
     C(lines=false, hasLines=false,
     {C(lines=false, hasLines=false, {V("r1c1"), V("r1c2"), V("r1c3")}),
      C(lines=false, hasLines=false, {V("r2c1"), V("r2c2"), V("r2c3")})})
     .toString() // lines=false and hasLines=false, thus join columns of sub-composites by tab
       //the sub-composites also join columns by tab
       => "r1c1\tr1c2\tr1c3\tr2c1\tr2c2\tr2c3"

 
Since:
1.8
  • Method Details

    • toColumns

      default List<String> toColumns()
      Returns:
      collect sub-items as columns
    • toLines

      List<String> toLines(boolean underLine)
      Parameters:
      underLine - if the upper call has a lines=true node
      Returns:
      joins sub-items as lines
    • collect

      void collect(List<String> cols)
      Parameters:
      cols - the list for appending elements
    • hasLine

      boolean hasLine()
      Returns:
      true if the tree contains a line-seaprated item