Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–877 unchanged (877 lines)
878 public StrBuilder appendFixedWidthPadRight(Object obj, int width, char padChar) {
879 if (width > 0) {
880 ensureCapacity(size + width);
881 String str = (obj == null ? getNullText() : obj.toString());
882 int strLen = str.length();
883 if (strLen >= width) {
884 str.getChars(0, strLen, buffer, size);
885 } else {
886 int padLen = width - strLen;
887 str.getChars(0, strLen, buffer, size);
888 for (int i = 0; i < padLen; i++) {
889 buffer[size + strLen + i] = padChar;
890 }
…lines 891–2365 unchanged (1475 lines)

After

…lines 1–877 unchanged (877 lines)
878 public StrBuilder appendFixedWidthPadRight(Object obj, int width, char padChar) {
879 if (width > 0) {
880 ensureCapacity(size + width);
881 String str = (obj == null ? getNullText() : obj.toString());
882 int strLen = str.length();
883 if (strLen >= width) {
884 str.getChars(0, width, buffer, size);
885 } else {
886 int padLen = width - strLen;
887 str.getChars(0, strLen, buffer, size);
888 for (int i = 0; i < padLen; i++) {
889 buffer[size + strLen + i] = padChar;
890 }
…lines 891–2365 unchanged (1475 lines)

Before

program
block_comment "/*\n * Licensed to the Apache Software Foundation (ASF) under"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "lang"
. "."
identifier "text"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Reader"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Writer"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Collection"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "lang"
. "."
identifier "ArrayUtils"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "lang"
. "."
identifier "SystemUtils"
; ";"
block_comment "/**\n * Builds a string from constituent parts providing a mo"...
class_declaration
modifiers
public "public"
class "class"
identifier "StrBuilder"
super_interfaces
implements "implements"
type_list
type_identifier "Cloneable"
class_body
{ "{"
block_comment "/**\n * The extra capacity for new builders.\n */"
field_declaration
modifiers
static "static"
final "final"
integral_type
int "int"
variable_declarator
identifier "CAPACITY"
= "="
decimal_integer_literal "32"
; ";"
block_comment "/**\n * Required for serialization support.\n * \n "...
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
long "long"
variable_declarator
identifier "serialVersionUID"
= "="
decimal_integer_literal "7628716375283629643L"
; ";"
block_comment "/** Internal data storage. */"
field_declaration
modifiers
protected "protected"
array_type
integral_type
char "char"
dimensions
[ "["
] "]"
variable_declarator
identifier "buffer"
; ";"
block_comment "/** Current size of the buffer. */"
field_declaration
modifiers
protected "protected"
integral_type
int "int"
variable_declarator
identifier "size"
; ";"
block_comment "/** The new line. */"
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "newLine"
; ";"
block_comment "/** The null text. */"
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "nullText"
; ";"
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Constructor that creates an empty builder initial"...
constructor_declaration
modifiers
public "public"
identifier "StrBuilder"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
this "this"
argument_list
( "("
identifier "CAPACITY"
) ")"
; ";"
} "}"
block_comment "/**\n * Constructor that creates an empty builder the spe"...
constructor_declaration (+51 nodes collapsed)
block_comment "/**\n * Constructor that creates a builder from the strin"...
constructor_declaration (+78 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets the text to be appended when a new line is a"...
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "getNewLineText"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "newLine"
; ";"
} "}"
block_comment "/**\n * Sets the text to be appended when a new line is a"...
method_declaration (+27 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets the text to be appended when null is added.\n"...
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "getNullText"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "nullText"
; ";"
} "}"
block_comment "/**\n * Sets the text to be appended when null is added.\n"...
method_declaration (+57 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets the length of the string builder.\n *\n "...
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "length"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "size"
; ";"
} "}"
block_comment "/**\n * Updates the length of the builder by either dropp"...
method_declaration (+135 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets the current size of the internal character a"...
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "capacity"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
field_access
identifier "buffer"
. "."
identifier "length"
; ";"
} "}"
block_comment "/**\n * Checks the capacity and ensures that it is at lea"...
method_declaration (+77 nodes collapsed)
block_comment "/**\n * Minimizes the capacity to the actual length of th"...
method_declaration (+81 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets the length of the string builder.\n * <p>"...
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "size"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "size"
; ";"
} "}"
block_comment "/**\n * Checks is the string builder is empty (convenienc"...
method_declaration
modifiers
public "public"
boolean_type "boolean"
identifier "isEmpty"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
binary_expression
identifier "size"
== "=="
decimal_integer_literal "0"
; ";"
} "}"
block_comment "/**\n * Clears the string builder (convenience Collection"...
method_declaration (+21 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets the character at the specified index.\n *"...
method_declaration (+56 nodes collapsed)
block_comment "/**\n * Sets the character at the specified index.\n *"...
method_declaration (+66 nodes collapsed)
block_comment "/**\n * Deletes the character at the specified index.\n "...
method_declaration (+62 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Copies the builder's character array into a new c"...
method_declaration (+75 nodes collapsed)
block_comment "/**\n * Copies part of the builder's character array into"...
method_declaration (+108 nodes collapsed)
block_comment "/**\n * Copies the character array into the specified arr"...
method_declaration (+92 nodes collapsed)
block_comment "/**\n * Copies the character array into the specified arr"...
method_declaration (+133 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Appends the new line string to this string builde"...
method_declaration (+47 nodes collapsed)
block_comment "/**\n * Appends the text representing <code>null</code> t"...
method_declaration (+36 nodes collapsed)
block_comment "/**\n * Appends an object to this string builder.\n * "...
method_declaration (+49 nodes collapsed)
block_comment "/**\n * Appends a string to this string builder.\n * A"...
method_declaration (+109 nodes collapsed)
block_comment "/**\n * Appends part of a string to this string builder.\n"...
method_declaration (+188 nodes collapsed)
block_comment "/**\n * Appends a string buffer to this string builder.\n "...
method_declaration (+109 nodes collapsed)
block_comment "/**\n * Appends part of a string buffer to this string bu"...
method_declaration (+188 nodes collapsed)
block_comment "/**\n * Appends another string builder to this string bui"...
method_declaration (+114 nodes collapsed)
block_comment "/**\n * Appends part of a string builder to this string b"...
method_declaration (+188 nodes collapsed)
block_comment "/**\n * Appends a char array to the string builder.\n "...
method_declaration (+113 nodes collapsed)
block_comment "/**\n * Appends a char array to the string builder.\n "...
method_declaration (+192 nodes collapsed)
block_comment "/**\n * Appends a boolean value to the string builder.\n "...
method_declaration (+161 nodes collapsed)
block_comment "/**\n * Appends a char value to the string builder.\n "...
method_declaration (+54 nodes collapsed)
block_comment "/**\n * Appends an int value to the string builder using "...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Appends a long value to the string builder using "...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Appends a float value to the string builder using"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Appends a double value to the string builder usin"...
method_declaration (+31 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Appends an array placing separators between each "...
method_declaration (+124 nodes collapsed)
block_comment "/**\n * Appends a collection placing separators between e"...
method_declaration (+130 nodes collapsed)
block_comment "/**\n * Appends an iterator placing separators between ea"...
method_declaration (+105 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Appends the pad character to the builder the spec"...
method_declaration (+82 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Appends an object to the builder padding on the l"...
method_declaration (+200 nodes collapsed)
block_comment "/**\n * Appends an object to the builder padding on the l"...
method_declaration (+45 nodes collapsed)
block_comment "/**\n * Appends an object to the builder padding on the r"...
method_declaration
modifiers
public "public"
type_identifier "StrBuilder"
identifier "appendFixedWidthPadRight"
formal_parameters
( "("
formal_parameter
type_identifier "Object"
identifier "obj"
, ","
formal_parameter
integral_type
int "int"
identifier "width"
, ","
formal_parameter
integral_type
char "char"
identifier "padChar"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "width"
> ">"
decimal_integer_literal "0"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "ensureCapacity"
argument_list
( "("
binary_expression
identifier "size"
+ "+"
identifier "width"
) ")"
; ";"
local_variable_declaration (+28 nodes collapsed)
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "strLen"
= "="
method_invocation
identifier "str"
. "."
identifier "length"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "strLen"
>= ">="
identifier "width"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "str"
. "."
identifier "getChars"
argument_list
( "("
decimal_integer_literal "0"
, ","
identifier "strLen"
, ","
identifier "buffer"
, ","
identifier "size"
) ")"
; ";"
} "}"
else "else"
block (+69 nodes collapsed)
expression_statement
assignment_expression
identifier "size"
+= "+="
identifier "width"
; ";"
} "}"
return_statement
return "return"
this "this"
; ";"
} "}"
block_comment "/**\n * Appends an object to the builder padding on the r"...
method_declaration (+45 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Inserts the string representation of an object in"...
method_declaration (+59 nodes collapsed)
block_comment "/**\n * Inserts the string into this builder.\n * Inse"...
method_declaration (+151 nodes collapsed)
block_comment "/**\n * Inserts the character array into this builder.\n "...
method_declaration (+140 nodes collapsed)
block_comment "/**\n * Inserts part of the character array into this bui"...
method_declaration (+216 nodes collapsed)
block_comment "/**\n * Inserts the value into this builder.\n *\n "...
method_declaration (+230 nodes collapsed)
block_comment "/**\n * Inserts the value into this builder.\n *\n "...
method_declaration (+82 nodes collapsed)
block_comment "/**\n * Inserts the value into this builder.\n *\n "...
method_declaration (+38 nodes collapsed)
block_comment "/**\n * Inserts the value into this builder.\n *\n "...
method_declaration (+38 nodes collapsed)
block_comment "/**\n * Inserts the value into this builder.\n *\n "...
method_declaration (+38 nodes collapsed)
block_comment "/**\n * Inserts the value into this builder.\n *\n "...
method_declaration (+38 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Internal method to delete a range without validat"...
method_declaration (+52 nodes collapsed)
block_comment "/**\n * Deletes the characters between the two specified "...
method_declaration (+72 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Deletes the character wherever it occurs in the b"...
method_declaration (+128 nodes collapsed)
block_comment "/**\n * Deletes the character wherever it occurs in the b"...
method_declaration (+76 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Deletes the string wherever it occurs in the buil"...
method_declaration (+110 nodes collapsed)
block_comment "/**\n * Deletes the string wherever it occurs in the buil"...
method_declaration (+97 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Deletes all parts of the builder that the matcher"...
method_declaration (+33 nodes collapsed)
block_comment "/**\n * Deletes the first match within the builder using "...
method_declaration (+31 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Internal method to delete a range without validat"...
method_declaration (+126 nodes collapsed)
block_comment "/**\n * Replaces a portion of the string builder with ano"...
method_declaration (+85 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Replaces the search character with the replace ch"...
method_declaration (+85 nodes collapsed)
block_comment "/**\n * Replaces the first instance of the search charact"...
method_declaration (+88 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Replaces the search string with the replace strin"...
method_declaration (+146 nodes collapsed)
block_comment "/**\n * Replaces the first instance of the search string "...
method_declaration (+130 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Replaces all matches within the builder with the "...
method_declaration (+37 nodes collapsed)
block_comment "/**\n * Replaces the first match within the builder with "...
method_declaration (+35 nodes collapsed)
line_comment "// ---------------------------------------------------------"...
block_comment "/**\n * Advanced search and replaces within the builder u"...
method_declaration (+63 nodes collapsed)
block_comment "/**\n * Replaces within the builder using a matcher.\n "...
method_declaration (+218 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Reverses the string builder placing each characte"...
method_declaration (+125 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Trims the builder by removing characters less tha"...
method_declaration (+160 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Checks whether this builder starts with the speci"...
method_declaration (+130 nodes collapsed)
block_comment "/**\n * Checks whether this builder ends with the specifi"...
method_declaration (+145 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Extracts a portion of this string builder as a st"...
method_declaration (+26 nodes collapsed)
block_comment "/**\n * Extracts a portion of this string builder as a st"...
method_declaration (+50 nodes collapsed)
block_comment "/**\n * Extracts the leftmost characters from the string "...
method_declaration (+78 nodes collapsed)
block_comment "/**\n * Extracts the rightmost characters from the string"...
method_declaration (+81 nodes collapsed)
block_comment "/**\n * Extracts some characters from the middle of the s"...
method_declaration (+112 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Checks if the string builder contains the specifi"...
method_declaration (+77 nodes collapsed)
block_comment "/**\n * Checks if the string builder contains the specifi"...
method_declaration (+28 nodes collapsed)
block_comment "/**\n * Checks if the string builder contains a string ma"...
method_declaration (+28 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Searches the string builder to find the first ref"...
method_declaration (+27 nodes collapsed)
block_comment "/**\n * Searches the string builder to find the first ref"...
method_declaration (+117 nodes collapsed)
block_comment "/**\n * Searches the string builder to find the first ref"...
method_declaration (+26 nodes collapsed)
block_comment "/**\n * Searches the string builder to find the first ref"...
method_declaration (+254 nodes collapsed)
block_comment "/**\n * Searches the string builder using the matcher to "...
method_declaration (+26 nodes collapsed)
block_comment "/**\n * Searches the string builder using the matcher to "...
method_declaration (+139 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Searches the string builder to find the last refe"...
method_declaration (+30 nodes collapsed)
block_comment "/**\n * Searches the string builder to find the last refe"...
method_declaration (+108 nodes collapsed)
block_comment "/**\n * Searches the string builder to find the last refe"...
method_declaration (+29 nodes collapsed)
block_comment "/**\n * Searches the string builder to find the last refe"...
method_declaration (+238 nodes collapsed)
block_comment "/**\n * Searches the string builder using the matcher to "...
method_declaration (+26 nodes collapsed)
block_comment "/**\n * Searches the string builder using the matcher to "...
method_declaration (+145 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Creates a tokenizer that can tokenize the content"...
method_declaration
modifiers
public "public"
type_identifier "StrTokenizer"
identifier "asTokenizer"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
object_creation_expression
new "new"
type_identifier "StrBuilderTokenizer"
argument_list
( "("
) ")"
; ";"
} "}"
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets the contents of this builder as a Reader.\n "...
method_declaration
modifiers
public "public"
type_identifier "Reader"
identifier "asReader"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
object_creation_expression
new "new"
type_identifier "StrBuilderReader"
argument_list
( "("
) ")"
; ";"
} "}"
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets this builder as a Writer that can be written"...
method_declaration
modifiers
public "public"
type_identifier "Writer"
identifier "asWriter"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
object_creation_expression
new "new"
type_identifier "StrBuilderWriter"
argument_list
( "("
) ")"
; ";"
} "}"
line_comment "//----------------------------------------------------------"...
line_comment "// /**"
line_comment "// * Gets a String version of the string builder by call"...
line_comment "// * constructor of String by reflection."
line_comment "// * <p>"
line_comment "// * WARNING: You must not use the StrBuilder after call"...
line_comment "// * as the buffer is now shared with the String object."...
line_comment "// * the internal character array is set to null, so you"...
line_comment "// * NullPointerExceptions on all method calls."
line_comment "// *"
line_comment "// * @return the builder as a String"
line_comment "// */"
line_comment "// public String toSharedString() {"
line_comment "// try {"
line_comment "// Constructor con = String.class.getDeclaredCons"...
line_comment "// new Class[] {int.class, int.class, char[]."...
line_comment "// con.setAccessible(true);"
line_comment "// char[] buffer = buf;"
line_comment "// buf = null;"
line_comment "// size = -1;"
line_comment "// nullText = null;"
line_comment "// return (String) con.newInstance("
line_comment "// new Object[] {new Integer(0), new Integer("...
line_comment "// "
line_comment "// } catch (Exception ex) {"
line_comment "// ex.printStackTrace();"
line_comment "// throw new UnsupportedOperationException(\"StrBu"...
line_comment "// }"
line_comment "// }"
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Checks the contents of this builder against anoth"...
method_declaration (+170 nodes collapsed)
block_comment "/**\n * Checks the contents of this builder against anoth"...
method_declaration (+134 nodes collapsed)
block_comment "/**\n * Checks the contents of this builder against anoth"...
method_declaration (+43 nodes collapsed)
block_comment "/**\n * Gets a suitable hash code for this builder.\n "...
method_declaration (+77 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets a String version of the string builder, crea"...
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Gets a StringBuffer version of the string builder"...
method_declaration (+32 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Validates parameters defining a range of the buil"...
method_declaration (+90 nodes collapsed)
block_comment "/**\n * Validates parameters defining a single index in t"...
method_declaration (+43 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Inner class to allow StrBuilder to operate as a t"...
class_declaration (+173 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Inner class to allow StrBuilder to operate as a w"...
class_declaration (+480 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Inner class to allow StrBuilder to operate as a w"...
class_declaration (+234 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Licensed to the Apache Software Foundation (ASF) under"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "lang"
. "."
identifier "text"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Reader"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Writer"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Collection"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "lang"
. "."
identifier "ArrayUtils"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "lang"
. "."
identifier "SystemUtils"
; ";"
block_comment "/**\n * Builds a string from constituent parts providing a mo"...
class_declaration
modifiers
public "public"
class "class"
identifier "StrBuilder"
super_interfaces
implements "implements"
type_list
type_identifier "Cloneable"
class_body
{ "{"
block_comment "/**\n * The extra capacity for new builders.\n */"
field_declaration
modifiers
static "static"
final "final"
integral_type
int "int"
variable_declarator
identifier "CAPACITY"
= "="
decimal_integer_literal "32"
; ";"
block_comment "/**\n * Required for serialization support.\n * \n "...
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
long "long"
variable_declarator
identifier "serialVersionUID"
= "="
decimal_integer_literal "7628716375283629643L"
; ";"
block_comment "/** Internal data storage. */"
field_declaration
modifiers
protected "protected"
array_type
integral_type
char "char"
dimensions
[ "["
] "]"
variable_declarator
identifier "buffer"
; ";"
block_comment "/** Current size of the buffer. */"
field_declaration
modifiers
protected "protected"
integral_type
int "int"
variable_declarator
identifier "size"
; ";"
block_comment "/** The new line. */"
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "newLine"
; ";"
block_comment "/** The null text. */"
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "nullText"
; ";"
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Constructor that creates an empty builder initial"...
constructor_declaration
modifiers
public "public"
identifier "StrBuilder"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
this "this"
argument_list
( "("
identifier "CAPACITY"
) ")"
; ";"
} "}"
block_comment "/**\n * Constructor that creates an empty builder the spe"...
constructor_declaration (+51 nodes collapsed)
block_comment "/**\n * Constructor that creates a builder from the strin"...
constructor_declaration (+78 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets the text to be appended when a new line is a"...
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "getNewLineText"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "newLine"
; ";"
} "}"
block_comment "/**\n * Sets the text to be appended when a new line is a"...
method_declaration (+27 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets the text to be appended when null is added.\n"...
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "getNullText"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "nullText"
; ";"
} "}"
block_comment "/**\n * Sets the text to be appended when null is added.\n"...
method_declaration (+57 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets the length of the string builder.\n *\n "...
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "length"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "size"
; ";"
} "}"
block_comment "/**\n * Updates the length of the builder by either dropp"...
method_declaration (+135 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets the current size of the internal character a"...
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "capacity"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
field_access
identifier "buffer"
. "."
identifier "length"
; ";"
} "}"
block_comment "/**\n * Checks the capacity and ensures that it is at lea"...
method_declaration (+77 nodes collapsed)
block_comment "/**\n * Minimizes the capacity to the actual length of th"...
method_declaration (+81 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets the length of the string builder.\n * <p>"...
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "size"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "size"
; ";"
} "}"
block_comment "/**\n * Checks is the string builder is empty (convenienc"...
method_declaration
modifiers
public "public"
boolean_type "boolean"
identifier "isEmpty"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
binary_expression
identifier "size"
== "=="
decimal_integer_literal "0"
; ";"
} "}"
block_comment "/**\n * Clears the string builder (convenience Collection"...
method_declaration (+21 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets the character at the specified index.\n *"...
method_declaration (+56 nodes collapsed)
block_comment "/**\n * Sets the character at the specified index.\n *"...
method_declaration (+66 nodes collapsed)
block_comment "/**\n * Deletes the character at the specified index.\n "...
method_declaration (+62 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Copies the builder's character array into a new c"...
method_declaration (+75 nodes collapsed)
block_comment "/**\n * Copies part of the builder's character array into"...
method_declaration (+108 nodes collapsed)
block_comment "/**\n * Copies the character array into the specified arr"...
method_declaration (+92 nodes collapsed)
block_comment "/**\n * Copies the character array into the specified arr"...
method_declaration (+133 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Appends the new line string to this string builde"...
method_declaration (+47 nodes collapsed)
block_comment "/**\n * Appends the text representing <code>null</code> t"...
method_declaration (+36 nodes collapsed)
block_comment "/**\n * Appends an object to this string builder.\n * "...
method_declaration (+49 nodes collapsed)
block_comment "/**\n * Appends a string to this string builder.\n * A"...
method_declaration (+109 nodes collapsed)
block_comment "/**\n * Appends part of a string to this string builder.\n"...
method_declaration (+188 nodes collapsed)
block_comment "/**\n * Appends a string buffer to this string builder.\n "...
method_declaration (+109 nodes collapsed)
block_comment "/**\n * Appends part of a string buffer to this string bu"...
method_declaration (+188 nodes collapsed)
block_comment "/**\n * Appends another string builder to this string bui"...
method_declaration (+114 nodes collapsed)
block_comment "/**\n * Appends part of a string builder to this string b"...
method_declaration (+188 nodes collapsed)
block_comment "/**\n * Appends a char array to the string builder.\n "...
method_declaration (+113 nodes collapsed)
block_comment "/**\n * Appends a char array to the string builder.\n "...
method_declaration (+192 nodes collapsed)
block_comment "/**\n * Appends a boolean value to the string builder.\n "...
method_declaration (+161 nodes collapsed)
block_comment "/**\n * Appends a char value to the string builder.\n "...
method_declaration (+54 nodes collapsed)
block_comment "/**\n * Appends an int value to the string builder using "...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Appends a long value to the string builder using "...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Appends a float value to the string builder using"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Appends a double value to the string builder usin"...
method_declaration (+31 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Appends an array placing separators between each "...
method_declaration (+124 nodes collapsed)
block_comment "/**\n * Appends a collection placing separators between e"...
method_declaration (+130 nodes collapsed)
block_comment "/**\n * Appends an iterator placing separators between ea"...
method_declaration (+105 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Appends the pad character to the builder the spec"...
method_declaration (+82 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Appends an object to the builder padding on the l"...
method_declaration (+200 nodes collapsed)
block_comment "/**\n * Appends an object to the builder padding on the l"...
method_declaration (+45 nodes collapsed)
block_comment "/**\n * Appends an object to the builder padding on the r"...
method_declaration
modifiers
public "public"
type_identifier "StrBuilder"
identifier "appendFixedWidthPadRight"
formal_parameters
( "("
formal_parameter
type_identifier "Object"
identifier "obj"
, ","
formal_parameter
integral_type
int "int"
identifier "width"
, ","
formal_parameter
integral_type
char "char"
identifier "padChar"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "width"
> ">"
decimal_integer_literal "0"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "ensureCapacity"
argument_list
( "("
binary_expression
identifier "size"
+ "+"
identifier "width"
) ")"
; ";"
local_variable_declaration (+28 nodes collapsed)
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "strLen"
= "="
method_invocation
identifier "str"
. "."
identifier "length"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "strLen"
>= ">="
identifier "width"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "str"
. "."
identifier "getChars"
argument_list
( "("
decimal_integer_literal "0"
, ","
identifier "width"
, ","
identifier "buffer"
, ","
identifier "size"
) ")"
; ";"
} "}"
else "else"
block (+69 nodes collapsed)
expression_statement
assignment_expression
identifier "size"
+= "+="
identifier "width"
; ";"
} "}"
return_statement
return "return"
this "this"
; ";"
} "}"
block_comment "/**\n * Appends an object to the builder padding on the r"...
method_declaration (+45 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Inserts the string representation of an object in"...
method_declaration (+59 nodes collapsed)
block_comment "/**\n * Inserts the string into this builder.\n * Inse"...
method_declaration (+151 nodes collapsed)
block_comment "/**\n * Inserts the character array into this builder.\n "...
method_declaration (+140 nodes collapsed)
block_comment "/**\n * Inserts part of the character array into this bui"...
method_declaration (+216 nodes collapsed)
block_comment "/**\n * Inserts the value into this builder.\n *\n "...
method_declaration (+230 nodes collapsed)
block_comment "/**\n * Inserts the value into this builder.\n *\n "...
method_declaration (+82 nodes collapsed)
block_comment "/**\n * Inserts the value into this builder.\n *\n "...
method_declaration (+38 nodes collapsed)
block_comment "/**\n * Inserts the value into this builder.\n *\n "...
method_declaration (+38 nodes collapsed)
block_comment "/**\n * Inserts the value into this builder.\n *\n "...
method_declaration (+38 nodes collapsed)
block_comment "/**\n * Inserts the value into this builder.\n *\n "...
method_declaration (+38 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Internal method to delete a range without validat"...
method_declaration (+52 nodes collapsed)
block_comment "/**\n * Deletes the characters between the two specified "...
method_declaration (+72 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Deletes the character wherever it occurs in the b"...
method_declaration (+128 nodes collapsed)
block_comment "/**\n * Deletes the character wherever it occurs in the b"...
method_declaration (+76 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Deletes the string wherever it occurs in the buil"...
method_declaration (+110 nodes collapsed)
block_comment "/**\n * Deletes the string wherever it occurs in the buil"...
method_declaration (+97 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Deletes all parts of the builder that the matcher"...
method_declaration (+33 nodes collapsed)
block_comment "/**\n * Deletes the first match within the builder using "...
method_declaration (+31 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Internal method to delete a range without validat"...
method_declaration (+126 nodes collapsed)
block_comment "/**\n * Replaces a portion of the string builder with ano"...
method_declaration (+85 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Replaces the search character with the replace ch"...
method_declaration (+85 nodes collapsed)
block_comment "/**\n * Replaces the first instance of the search charact"...
method_declaration (+88 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Replaces the search string with the replace strin"...
method_declaration (+146 nodes collapsed)
block_comment "/**\n * Replaces the first instance of the search string "...
method_declaration (+130 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Replaces all matches within the builder with the "...
method_declaration (+37 nodes collapsed)
block_comment "/**\n * Replaces the first match within the builder with "...
method_declaration (+35 nodes collapsed)
line_comment "// ---------------------------------------------------------"...
block_comment "/**\n * Advanced search and replaces within the builder u"...
method_declaration (+63 nodes collapsed)
block_comment "/**\n * Replaces within the builder using a matcher.\n "...
method_declaration (+218 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Reverses the string builder placing each characte"...
method_declaration (+125 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Trims the builder by removing characters less tha"...
method_declaration (+160 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Checks whether this builder starts with the speci"...
method_declaration (+130 nodes collapsed)
block_comment "/**\n * Checks whether this builder ends with the specifi"...
method_declaration (+145 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Extracts a portion of this string builder as a st"...
method_declaration (+26 nodes collapsed)
block_comment "/**\n * Extracts a portion of this string builder as a st"...
method_declaration (+50 nodes collapsed)
block_comment "/**\n * Extracts the leftmost characters from the string "...
method_declaration (+78 nodes collapsed)
block_comment "/**\n * Extracts the rightmost characters from the string"...
method_declaration (+81 nodes collapsed)
block_comment "/**\n * Extracts some characters from the middle of the s"...
method_declaration (+112 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Checks if the string builder contains the specifi"...
method_declaration (+77 nodes collapsed)
block_comment "/**\n * Checks if the string builder contains the specifi"...
method_declaration (+28 nodes collapsed)
block_comment "/**\n * Checks if the string builder contains a string ma"...
method_declaration (+28 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Searches the string builder to find the first ref"...
method_declaration (+27 nodes collapsed)
block_comment "/**\n * Searches the string builder to find the first ref"...
method_declaration (+117 nodes collapsed)
block_comment "/**\n * Searches the string builder to find the first ref"...
method_declaration (+26 nodes collapsed)
block_comment "/**\n * Searches the string builder to find the first ref"...
method_declaration (+254 nodes collapsed)
block_comment "/**\n * Searches the string builder using the matcher to "...
method_declaration (+26 nodes collapsed)
block_comment "/**\n * Searches the string builder using the matcher to "...
method_declaration (+139 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Searches the string builder to find the last refe"...
method_declaration (+30 nodes collapsed)
block_comment "/**\n * Searches the string builder to find the last refe"...
method_declaration (+108 nodes collapsed)
block_comment "/**\n * Searches the string builder to find the last refe"...
method_declaration (+29 nodes collapsed)
block_comment "/**\n * Searches the string builder to find the last refe"...
method_declaration (+238 nodes collapsed)
block_comment "/**\n * Searches the string builder using the matcher to "...
method_declaration (+26 nodes collapsed)
block_comment "/**\n * Searches the string builder using the matcher to "...
method_declaration (+145 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Creates a tokenizer that can tokenize the content"...
method_declaration
modifiers
public "public"
type_identifier "StrTokenizer"
identifier "asTokenizer"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
object_creation_expression
new "new"
type_identifier "StrBuilderTokenizer"
argument_list
( "("
) ")"
; ";"
} "}"
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets the contents of this builder as a Reader.\n "...
method_declaration
modifiers
public "public"
type_identifier "Reader"
identifier "asReader"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
object_creation_expression
new "new"
type_identifier "StrBuilderReader"
argument_list
( "("
) ")"
; ";"
} "}"
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets this builder as a Writer that can be written"...
method_declaration
modifiers
public "public"
type_identifier "Writer"
identifier "asWriter"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
object_creation_expression
new "new"
type_identifier "StrBuilderWriter"
argument_list
( "("
) ")"
; ";"
} "}"
line_comment "//----------------------------------------------------------"...
line_comment "// /**"
line_comment "// * Gets a String version of the string builder by call"...
line_comment "// * constructor of String by reflection."
line_comment "// * <p>"
line_comment "// * WARNING: You must not use the StrBuilder after call"...
line_comment "// * as the buffer is now shared with the String object."...
line_comment "// * the internal character array is set to null, so you"...
line_comment "// * NullPointerExceptions on all method calls."
line_comment "// *"
line_comment "// * @return the builder as a String"
line_comment "// */"
line_comment "// public String toSharedString() {"
line_comment "// try {"
line_comment "// Constructor con = String.class.getDeclaredCons"...
line_comment "// new Class[] {int.class, int.class, char[]."...
line_comment "// con.setAccessible(true);"
line_comment "// char[] buffer = buf;"
line_comment "// buf = null;"
line_comment "// size = -1;"
line_comment "// nullText = null;"
line_comment "// return (String) con.newInstance("
line_comment "// new Object[] {new Integer(0), new Integer("...
line_comment "// "
line_comment "// } catch (Exception ex) {"
line_comment "// ex.printStackTrace();"
line_comment "// throw new UnsupportedOperationException(\"StrBu"...
line_comment "// }"
line_comment "// }"
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Checks the contents of this builder against anoth"...
method_declaration (+170 nodes collapsed)
block_comment "/**\n * Checks the contents of this builder against anoth"...
method_declaration (+134 nodes collapsed)
block_comment "/**\n * Checks the contents of this builder against anoth"...
method_declaration (+43 nodes collapsed)
block_comment "/**\n * Gets a suitable hash code for this builder.\n "...
method_declaration (+77 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Gets a String version of the string builder, crea"...
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Gets a StringBuffer version of the string builder"...
method_declaration (+32 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Validates parameters defining a range of the buil"...
method_declaration (+90 nodes collapsed)
block_comment "/**\n * Validates parameters defining a single index in t"...
method_declaration (+43 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Inner class to allow StrBuilder to operate as a t"...
class_declaration (+173 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Inner class to allow StrBuilder to operate as a w"...
class_declaration (+480 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * Inner class to allow StrBuilder to operate as a w"...
class_declaration (+234 nodes collapsed)
} "}"