[armedbear-cvs] r11575 - trunk/abcl/src/org/armedbear/lisp
Erik Huelsmann
ehuelsmann at common-lisp.net
Thu Jan 22 20:00:52 UTC 2009
Author: ehuelsmann
Date: Thu Jan 22 20:00:49 2009
New Revision: 11575
Log:
Eliminate the FastStringBuffer (from AbstractArray and AbstractBitVector).
Patch by: Philip Hudson
Note: In this category, more patches are expected.
Modified:
trunk/abcl/src/org/armedbear/lisp/AbstractArray.java
trunk/abcl/src/org/armedbear/lisp/AbstractBitVector.java
Modified: trunk/abcl/src/org/armedbear/lisp/AbstractArray.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/AbstractArray.java (original)
+++ trunk/abcl/src/org/armedbear/lisp/AbstractArray.java Thu Jan 22 20:00:49 2009
@@ -142,13 +142,10 @@
{
final int rank = getRank();
if (rank != subscripts.length) {
- FastStringBuffer sb =
- new FastStringBuffer("Wrong number of subscripts (");
- sb.append(subscripts.length);
- sb.append(") for array of rank ");
- sb.append(rank);
- sb.append('.');
- error(new ProgramError(sb.toString()));
+ // ### i18n
+ final String errorMsg =
+ "Wrong number of subscripts (%d) for array of rank %d.";
+ error(new ProgramError(String.format(errorMsg, subscripts.length, rank)));
}
int sum = 0;
int size = 1;
@@ -158,12 +155,10 @@
size *= dim;
final int n = subscripts[i];
if (n < 0 || n >= dim) {
- FastStringBuffer sb = new FastStringBuffer("Invalid index ");
- sb.append(n);
- sb.append(" for array ");
- sb.append(writeToString());
- sb.append('.');
- error(new ProgramError(sb.toString()));
+ // ### i18n
+ final String errorMsg =
+ "Invalid index %d for array %s.";
+ error(new ProgramError(String.format(errorMsg, n, writeToString())));
}
sum += n * lastSize;
}
@@ -185,7 +180,7 @@
public String writeToString(int[] dimv) throws ConditionThrowable
{
- FastStringBuffer sb = new FastStringBuffer();
+ StringBuilder sb = new StringBuilder();
LispThread thread = LispThread.currentThread();
LispObject printReadably = Symbol.PRINT_READABLY.symbolValue(thread);
if (printReadably != NIL || Symbol.PRINT_ARRAY.symbolValue(thread) != NIL) {
@@ -232,7 +227,7 @@
}
// Helper for writeToString().
- private void appendContents(int[] dimensions, int index, FastStringBuffer sb,
+ private void appendContents(int[] dimensions, int index, StringBuilder sb,
LispThread thread)
throws ConditionThrowable
{
@@ -331,7 +326,7 @@
throws ConditionThrowable;
/**
- *
+ *
* @param dims
* @param displacedTo
* @param displacement
Modified: trunk/abcl/src/org/armedbear/lisp/AbstractBitVector.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/AbstractBitVector.java (original)
+++ trunk/abcl/src/org/armedbear/lisp/AbstractBitVector.java Thu Jan 22 20:00:49 2009
@@ -185,19 +185,15 @@
if (Symbol.PRINT_READABLY.symbolValue(thread) != NIL ||
Symbol.PRINT_ARRAY.symbolValue(thread) != NIL)
{
- FastStringBuffer sb = new FastStringBuffer(length + 2);
+ StringBuilder sb = new StringBuilder(length + 2);
sb.append("#*");
for (int i = 0; i < length; i++)
sb.append(getBit(i) == 1 ? '1' : '0');
return sb.toString();
} else {
- FastStringBuffer sb = new FastStringBuffer("(");
- if (this instanceof SimpleBitVector)
- sb.append("SIMPLE-");
- sb.append("BIT-VECTOR ");
- sb.append(length);
- sb.append(")");
- return unreadableString(sb.toString());
+ final String str = "(%sBIT-VECTOR %d)";
+ final String pre = (this instanceof SimpleBitVector) ? "SIMPLE-" : "";
+ return unreadableString(String.format(str, pre, length));
}
}
More information about the armedbear-cvs
mailing list