|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ca.quine.jcommons.sourcegen.FormattingUtils
Method Summary | |
static void |
addSpaceToLastEntry(ArrayList retVal)
|
static void |
addSpaceToLastEntryIfNotThere(ArrayList retVal)
|
static String |
formatCodeLine(FormattingRules formatRules,
String codeLine)
If the given FormattingRules use spaces for indenting, convert any tabs at the beginning of the line into the appropriate number of spaces. |
static ArrayList |
formatList(FormattingRules rules,
ArrayList items,
int initialIndent,
int subsequentIndent)
Take the ArrayList of Strings (must contain at least 1 String) and format them onto lines as defined by the given rules . |
static ArrayList |
formatList(FormattingRules rules,
ArrayList items,
int indentLevel,
String prefix)
Take the ArrayList of Strings (must contain at least 1 String and each String must contain appropriate trailing spacing) and format them onto lines as defined by the given rules
with the given prefix on each line. |
static ArrayList |
makeCommaSeparatedList(String prefix,
ArrayList items,
String suffix,
boolean addPrefixSuffixIfNoItems)
Makes a comma separated list that can then be used with formatList . |
static void |
outputLines(FormattingRules formatRules,
ArrayList lines,
StringBuffer buffer)
Outputs the already formatted and indented lines into the given StringBuffer. |
static ArrayList |
tokenize(String text)
|
static String |
trimRight(String string)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static ArrayList formatList(FormattingRules rules, ArrayList items, int initialIndent, int subsequentIndent)
rules
.
rules
- the desired rules for formattingitems
- a list of String
objects which
are to be formatted on one or more lines with
spaces in between theminitialIndent
- the number of indents on the first formatted
linesubsequentIndent
- the number of indents on each subsequent line
String
objects, each one
representing a formatted line of datapublic static ArrayList formatList(FormattingRules rules, ArrayList items, int indentLevel, String prefix)
rules
with the given prefix
on each line.
Each String in the List must contain spacing after it indicating the
amount of spacing that is required. For example, the word that ends
a sentence could be a String that contains two trailing spaces. These
spaces will be added if another word follows that one on the same line.
If one of the Strings in the List is the character "\n", it will be
treated as a paragraph break.
rules
- the desired rules for formattingitems
- a list of String
objects which
are to be formatted on one or more lines with
spaces in between themindentLevel
- the number of indents on the first formatted
lineprefix
- added to each line after the indent
String
objects, each one
representing a formatted line of datapublic static String trimRight(String string)
public static ArrayList makeCommaSeparatedList(String prefix, ArrayList items, String suffix, boolean addPrefixSuffixIfNoItems)
formatList
.
items
- a list of String
objects
String
objects, with a comma
added to the end of each of the input items except
for the last String
.public static void outputLines(FormattingRules formatRules, ArrayList lines, StringBuffer buffer)
formatRules
- lines
- buffer
- public static String formatCodeLine(FormattingRules formatRules, String codeLine)
String
.
formatRules
- the desired rules for formattingcodeLine
- the line to reformat
public static ArrayList tokenize(String text)
public static void addSpaceToLastEntry(ArrayList retVal)
public static void addSpaceToLastEntryIfNotThere(ArrayList retVal)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |