Author: desruisseaux
Date: Mon Dec 24 05:36:25 2012
New Revision: 1425590
URL: http://svn.apache.org/viewvc?rev=1425590&view=rev
Log:
Renamed *Formatter as *Appender for emphasing on the relationship with
Appendeable
(those classes both implement Appendeable and delegate to another Appendable),
and
for making the names more different than *Format.
We could argue that java.util.Formatter also write to an Appendeable. But
Formatter,
like *Format, expect different object as argument. By contrast, our Appenders
do not
format objects, but format character sequences received by the same Appendeable
API.
Added:
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/Appender.java
- copied, changed from r1425582,
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/FilteredAppendable.java
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineAppender.java
- copied, changed from r1425582,
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineFormatter.java
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java
- copied, changed from r1425582,
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/AppenderTestCase.java
- copied, changed from r1425582,
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/FormatterTestCase.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineAppenderTest.java
- copied, changed from r1425582,
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineFormatterTest.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java
- copied, changed from r1425582,
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TableFormatterTest.java
Removed:
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/FilteredAppendable.java
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineFormatter.java
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/FormatterTestCase.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineFormatterTest.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TableFormatterTest.java
Modified:
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/AppendableWriter.java
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/IO.java
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/package-info.java
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Characters.java
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/EchoAppendable.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LeftMarginTest.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/SingleCharAppendable.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TabulationExpansionTest.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/WordWrapTest.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/WordWrapWithLineSeparatorTest.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/collection/TreeTableFormatTest.java
Modified:
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/AppendableWriter.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/AppendableWriter.java?rev=1425590&r1=1425589&r2=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/AppendableWriter.java
(original)
+++
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/AppendableWriter.java
Mon Dec 24 05:36:25 2012
@@ -55,8 +55,8 @@ final class AppendableWriter extends Wri
* are often synchronized on themselves.
*/
private static Object getLock(Appendable out) {
- while (out instanceof FilteredAppendable) {
- out = ((FilteredAppendable) out).out;
+ while (out instanceof Appender) {
+ out = ((Appender) out).out;
}
// StringWriter performs its synchronizations on its StringBuffer.
if (out instanceof StringWriter) {
@@ -139,7 +139,7 @@ final class AppendableWriter extends Wri
}
/**
- * If {@link #out}Â implements {@link Flushable}, or is a {@link
FilteredAppendable} wrapper
+ * If {@link #out}Â implements {@link Flushable}, or is a {@link Appender}
wrapper
* around a flushable object, delegates to that object. Otherwise do
nothing.
*/
@Override
@@ -150,7 +150,7 @@ final class AppendableWriter extends Wri
}
/**
- * If {@link #out}Â implements {@link Closeable}, or is a {@link
FilteredAppendable} wrapper
+ * If {@link #out}Â implements {@link Closeable}, or is a {@link Appender}
wrapper
* around a closeable object, delegates to that object. Otherwise just
flush (if possible).
*/
@Override
Copied:
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/Appender.java
(from r1425582,
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/FilteredAppendable.java)
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/Appender.java?p2=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/Appender.java&p1=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/FilteredAppendable.java&r1=1425582&r2=1425590&rev=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/FilteredAppendable.java
(original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/Appender.java
Mon Dec 24 05:36:25 2012
@@ -35,13 +35,13 @@ import static org.apache.sis.util.Charac
* <li>No synchronization is performed.</li>
* </ul>
*
- * If needed, this {@code FilteredAppendable}Â can be viewed as a synchronized
+ * If needed, this {@code Appender}Â can be viewed as a synchronized
* {@link java.io.Writer} by invoking the {@link IO#asWriter(Appendable)}
method.
*
* {@section Flushing and closing the stream}
* Subclasses implement the {@link java.io.Flushable} interface only if they
* hold data in an internal buffer before to send them to the wrapped {@code
Appendable}.
- * This is the case of {@link TableFormatter} and {@link LineFormatter} for
instance.
+ * This is the case of {@link TableAppender} and {@link LineAppender} for
instance.
* For unconditionally flushing or closing an {@code Appendable} and its
underlying stream,
* see {@link IO#flush(Appendable)} and {@link IO#close(Appendable)}.
*
@@ -53,7 +53,7 @@ import static org.apache.sis.util.Charac
* @see java.io.FilterWriter
*/
@Decorator(Appendable.class)
-abstract class FilteredAppendable implements Appendable {
+abstract class Appender implements Appendable {
/**
* The underlying character output stream or buffer.
*/
@@ -66,11 +66,11 @@ abstract class FilteredAppendable implem
private char highSurrogate;
/**
- * Creates a new filtered formatter which will send its output to the
given stream or buffer.
+ * Creates a new appender which will send its output to the given stream
or buffer.
*
* @param out The underlying character output stream or buffer.
*/
- protected FilteredAppendable(final Appendable out) {
+ protected Appender(final Appendable out) {
ArgumentChecks.ensureNonNull("out", out);
this.out = out;
}
Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/IO.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/IO.java?rev=1425590&r1=1425589&r2=1425590&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/IO.java
(original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/IO.java Mon
Dec 24 05:36:25 2012
@@ -54,10 +54,10 @@ public final class IO extends Static {
*/
public static void flush(Appendable out) throws IOException {
while (!(out instanceof Flushable)) {
- if (!(out instanceof FilteredAppendable)) {
+ if (!(out instanceof Appender)) {
return;
}
- out = ((FilteredAppendable) out).out;
+ out = ((Appender) out).out;
}
((Flushable) out).flush();
}
@@ -82,10 +82,10 @@ public final class IO extends Static {
((Flushable) out).flush();
isFlushed = true;
}
- if (!(out instanceof FilteredAppendable)) {
+ if (!(out instanceof Appender)) {
return;
}
- out = ((FilteredAppendable) out).out;
+ out = ((Appender) out).out;
}
((Closeable) out).close();
}
@@ -111,7 +111,7 @@ public final class IO extends Static {
*
* <p>It may be necessary to invoke {@link #flush(Appendable)} before this
method in order
* to get proper content. In particular, this is necessary if the chain of
{@code Appendable}s
- * contains {@link TableFormatter} or {@link LineFormatter} instances.</p>
+ * contains {@link TableAppender} or {@link LineAppender} instances.</p>
*
* @param out The stream or buffer from which to get the content, or
{@code null}.
* @return The content of the given stream of buffer, or {@code null} if
unavailable.
@@ -120,7 +120,7 @@ public final class IO extends Static {
*/
public static CharSequence content(Appendable out) {
while (!(out instanceof CharSequence)) {
- if (!(out instanceof FilteredAppendable)) {
+ if (!(out instanceof Appender)) {
if (out instanceof StringWriter) {
return ((StringWriter) out).getBuffer();
}
@@ -129,7 +129,7 @@ public final class IO extends Static {
}
return null;
}
- out = ((FilteredAppendable) out).out;
+ out = ((Appender) out).out;
}
return (CharSequence) out;
}
Copied:
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineAppender.java
(from r1425582,
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineFormatter.java)
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineAppender.java?p2=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineAppender.java&p1=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineFormatter.java&r1=1425582&r2=1425590&rev=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineFormatter.java
(original)
+++
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineAppender.java
Mon Dec 24 05:36:25 2012
@@ -60,7 +60,7 @@ import org.apache.sis.internal.util.X364
* @module
*/
@Decorator(Appendable.class)
-public class LineFormatter extends FilteredAppendable implements Flushable {
+public class LineAppender extends Appender implements Flushable {
/**
* The line separator, or {@code null} if not yet determined. If {@code
null}, then the
* {@link #append(CharSequence, int, int)} method will try to infer it
from the submitted text.
@@ -157,7 +157,7 @@ public class LineFormatter extends Filte
*
* @param out The underlying stream or buffer to write to.
*/
- public LineFormatter(final Appendable out) {
+ public LineAppender(final Appendable out) {
super(out);
maximalLineLength = Integer.MAX_VALUE;
}
@@ -171,7 +171,7 @@ public class LineFormatter extends Filte
* @param isTabulationExpanded {@code true} for expanding tabulations
into spaces,
* or {@code false} for sending {@code '\t'}
characters as-is.
*/
- public LineFormatter(final Appendable out, final String lineSeparator,
final boolean isTabulationExpanded) {
+ public LineAppender(final Appendable out, final String lineSeparator,
final boolean isTabulationExpanded) {
super(out);
maximalLineLength = Integer.MAX_VALUE;
this.lineSeparator = lineSeparator;
@@ -188,7 +188,7 @@ public class LineFormatter extends Filte
* @param isTabulationExpanded {@code true} for expanding tabulations
into spaces,
* or {@code false} for forwarding {@code
'\t'} characters as-is.
*/
- public LineFormatter(final Appendable out, final int maximalLineLength,
final boolean isTabulationExpanded) {
+ public LineAppender(final Appendable out, final int maximalLineLength,
final boolean isTabulationExpanded) {
super(out);
ArgumentChecks.ensureStrictlyPositive("maximalLineLength",
maximalLineLength);
this.maximalLineLength = maximalLineLength;
@@ -530,7 +530,7 @@ searchHyp: for (int i=buffer.length();
}
/**
- * Resets the {@code LineFormatter} internal state as if a new line was
beginning.
+ * Resets the {@code LineAppender} internal state as if a new line was
beginning.
* Trailing whitespaces not yet sent to the {@linkplain #out underlying
appendable}
* are discarded, and the column position (for tabulation expansion
calculation) is
* reset to 0. This method does not write any line separator.
@@ -546,7 +546,7 @@ searchHyp: for (int i=buffer.length();
/**
* Sends all pending characters to the underlying appendable, including
trailing whitespaces.
* Note that this method should preferably be invoked at the end of a
word, sentence or line,
- * since invoking this method may prevent {@code LineFormatter} to
properly wrap the current
+ * since invoking this method may prevent {@code LineAppender} to properly
wrap the current
* line if the current position is in the middle of a word.
*
* <p>Invoking this method also flushes the underlying stream, if
{@linkplain Flushable flushable}.
Copied:
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java
(from r1425582,
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java)
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java?p2=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java&p1=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java&r1=1425582&r2=1425590&rev=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java
(original)
+++
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java
Mon Dec 24 05:36:25 2012
@@ -44,7 +44,7 @@ import static org.apache.sis.util.Charac
*
* {@preformat java
* StringBuilder buffer = new StringBuilder();
- * TableFormatter table = new TableFormatter(buffer);
+ * TableAppender table = new TableAppender(buffer);
* table.nextLine('â');
* table.append("English\tFrench\tr.e.d.\n");
* table.nextLine('-');
@@ -77,7 +77,7 @@ import static org.apache.sis.util.Charac
* @see org.apache.sis.util.tree.TreeTableFormat
*/
@Decorator(Appendable.class)
-public class TableFormatter extends FilteredAppendable implements Flushable {
+public class TableAppender extends Appender implements Flushable {
/**
* A possible value for cell alignment. This specifies that the text is
aligned
* to the left indent and extra whitespace should be placed on the right.
@@ -215,7 +215,7 @@ public class TableFormatter extends Filt
* The default is a vertical double line for the left and right table
borders, and a single
* line between the columns.
*/
- public TableFormatter() {
+ public TableAppender() {
this(new StringBuilder(256));
ownOut = true;
}
@@ -225,7 +225,7 @@ public class TableFormatter extends Filt
*
* @param separator String to write between columns.
*/
- public TableFormatter(final String separator) {
+ public TableAppender(final String separator) {
this(new StringBuilder(256), separator);
ownOut = true;
}
@@ -237,7 +237,7 @@ public class TableFormatter extends Filt
*
* @param out The underlying stream or buffer to write to.
*/
- public TableFormatter(final Appendable out) {
+ public TableAppender(final Appendable out) {
super(out);
leftBorder = "â ";
rightBorder = " â" ;
@@ -250,7 +250,7 @@ public class TableFormatter extends Filt
* @param out The underlying stream or buffer to write to.
* @param separator String to write between columns.
*/
- public TableFormatter(final Appendable out, final String separator) {
+ public TableAppender(final Appendable out, final String separator) {
super(out);
/*
* Following methods use Character.isWhitespace(â¦) instead of
Character.isSpaceChar(â¦).
@@ -420,7 +420,7 @@ public class TableFormatter extends Filt
* @param c Character to write.
*/
@Override
- public TableFormatter append(final char c) {
+ public TableAppender append(final char c) {
final int cp = toCodePoint(c);
if (!multiLinesCells) {
if (cp == '\t') {
@@ -453,7 +453,7 @@ public class TableFormatter extends Filt
* @return A reference to this {@code Appendable}.
*/
@Override
- public TableFormatter append(CharSequence sequence) {
+ public TableAppender append(CharSequence sequence) {
if (sequence == null) {
sequence = "null";
}
@@ -470,7 +470,7 @@ public class TableFormatter extends Filt
*/
@Override
@SuppressWarnings("fallthrough")
- public TableFormatter append(final CharSequence sequence, int start, int
end) {
+ public TableAppender append(final CharSequence sequence, int start, int
end) {
ArgumentChecks.ensureValidIndexRange(sequence.length(), start, end);
if (lineSeparator == null) {
lineSeparator = lineSeparator(sequence, start, end);
@@ -622,7 +622,7 @@ public class TableFormatter extends Filt
cells.clear();
currentRow = 0;
currentColumn = 0;
- if (!(out instanceof TableFormatter)) {
+ if (!(out instanceof TableAppender)) {
/*
* Flush only if this table is not included in an outer (bigger)
table.
* This is because flushing the outer table would break its
formatting.
@@ -632,10 +632,10 @@ public class TableFormatter extends Filt
}
/**
- * Returns the content of this {@code TableFormatter} as a string if
possible.
+ * Returns the content of this {@code TableAppender} as a string if
possible.
*
* <ul>
- * <li>If this {@code TableFormatter} has been created without explicit
{@link Appendable},
+ * <li>If this {@code TableAppender} has been created without explicit
{@link Appendable},
* then this method always returns the current table content
formatted as a string.</li>
* <li>Otherwise, if {@link #out} implements {@link CharSequence} or is
directly or
* indirectly a wrapper around a {@code CharSequence}, returns its
{@code toString()}
@@ -659,7 +659,7 @@ public class TableFormatter extends Filt
}
/**
- * Writes the table without clearing the {@code TableFormatter} content.
+ * Writes the table without clearing the {@code TableAppender} content.
* Invoking this method many time would result in the same table being
* repeated.
*/
@@ -771,7 +771,7 @@ public class TableFormatter extends Filt
out.append(leftBorder);
}
final Appendable tabExpander = (cellText.indexOf('\t') >=
0)
- ? new LineFormatter(out, Integer.MAX_VALUE, true)
: out;
+ ? new LineAppender(out, Integer.MAX_VALUE, true) :
out;
switch (cell.alignment) {
default: {
throw new AssertionError(cell.alignment);
Modified:
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java?rev=1425590&r1=1425589&r2=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java
(original)
+++
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java
Mon Dec 24 05:36:25 2012
@@ -48,7 +48,7 @@ import org.apache.sis.util.resources.Err
* <th>Table with a border</th>
* </tr><tr><td>
* {@preformat java
- * TableFormatter table = new TableFormatter(out, "");
+ * TableAppender table = new TableAppender(out, "");
* // ... do some work, then add a column separator:
* table.append(beforeFill);
* table.nextColumn(fillCharacter);
@@ -56,7 +56,7 @@ import org.apache.sis.util.resources.Err
* }
* </td><td>
* {@preformat java
- * TableFormatter table = new TableFormatter(out, columnSeparator);
+ * TableAppender table = new TableAppender(out, columnSeparator);
* // ... do some work, then add a column separator:
* table.append(beforeFill);
* table.nextColumn(fillCharacter);
@@ -70,7 +70,7 @@ import org.apache.sis.util.resources.Err
*
* @param <T> The base type of objects parsed and formatted by this class.
*
- * @see TableFormatter
+ * @see TableAppender
*/
@NotThreadSafe
public abstract class TabularFormat<T> extends CompoundFormat<T> {
@@ -100,7 +100,7 @@ public abstract class TabularFormat<T> e
* This is the character between the "{@code [ ]}" pair of brackets in the
pattern given
* to the {@link #setColumnSeparatorPattern(String)} method.
*
- * Subclasses will typically use this value in calls to {@link
TableFormatter#nextColumn(char)}.
+ * Subclasses will typically use this value in calls to {@link
TableAppender#nextColumn(char)}.
*/
protected char fillCharacter;
Modified:
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/package-info.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/package-info.java?rev=1425590&r1=1425589&r2=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/package-info.java
(original)
+++
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/package-info.java
Mon Dec 24 05:36:25 2012
@@ -19,8 +19,8 @@
* Extensions to standard Java I/O ({@link java.io.Reader}, {@link
java.io.Writer},
* {@link java.lang.Appendable}).
* Many classes defined in this package are filters applying on-the-fly
formatting while writing
- * text to the output device. For example {@link
org.apache.sis.io.LineFormatter} can wrap lines
- * to some maximal line length (e.g. 80 characters), and {@link
org.apache.sis.io.TableFormatter}
+ * text to the output device. For example {@link
org.apache.sis.io.LineAppender} can wrap lines
+ * to some maximal line length (e.g. 80 characters), and {@link
org.apache.sis.io.TableAppender}
* replaces all occurrence of {@code '\t'} by the amount of spaces needed for
producing a tabular
* output.
*
Modified:
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java?rev=1425590&r1=1425589&r2=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java
(original)
+++
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java
Mon Dec 24 05:36:25 2012
@@ -27,7 +27,7 @@ import java.text.DecimalFormat;
import java.text.ParsePosition;
import java.text.ParseException;
import org.opengis.util.InternationalString;
-import org.apache.sis.io.TableFormatter;
+import org.apache.sis.io.TableAppender;
import org.apache.sis.io.TabularFormat;
import org.apache.sis.util.resources.Vocabulary;
@@ -269,7 +269,7 @@ public class StatisticsFormat extends Ta
case 1: horizontalLine = 'â'; separator += "â "; break;
case 2: horizontalLine = 'â'; separator += "â "; break;
}
- final TableFormatter table = new TableFormatter(toAppendTo, separator);
+ final TableAppender table = new TableAppender(toAppendTo, separator);
final Vocabulary resources = Vocabulary.getResources(headerLocale);
/*
* If there is a header for at least one statistics, write the full
headers row.
@@ -282,7 +282,7 @@ public class StatisticsFormat extends Ta
for (final String header : headers) {
if (header != null) {
table.append(header);
- table.setCellAlignment(TableFormatter.ALIGN_CENTER);
+ table.setCellAlignment(TableAppender.ALIGN_CENTER);
}
table.nextColumn();
}
@@ -318,7 +318,7 @@ public class StatisticsFormat extends Ta
case 2: needsConfigure = true; break;
case 3: needsConfigure = (stats[0].differences() != null);
break;
}
- table.setCellAlignment(TableFormatter.ALIGN_LEFT);
+ table.setCellAlignment(TableAppender.ALIGN_LEFT);
table.append(resources.getString(KEYS[i])).append(':');
for (final Statistics s : stats) {
final Number value;
@@ -338,7 +338,7 @@ public class StatisticsFormat extends Ta
table.append(beforeFill);
table.nextColumn(fillCharacter);
table.append(format.format(value));
- table.setCellAlignment(TableFormatter.ALIGN_RIGHT);
+ table.setCellAlignment(TableAppender.ALIGN_RIGHT);
}
table.append(lineSeparator);
}
@@ -346,7 +346,7 @@ public class StatisticsFormat extends Ta
table.nextLine(horizontalLine);
}
/*
- * TableFormatter needs to be explicitly flushed in order to format
the values.
+ * TableAppender needs to be explicitly flushed in order to format the
values.
*/
table.flush();
}
Modified:
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Characters.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Characters.java?rev=1425590&r1=1425589&r2=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Characters.java
(original)
+++
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Characters.java
Mon Dec 24 05:36:25 2012
@@ -33,7 +33,7 @@ import org.apache.sis.util.resources.Err
public final class Characters extends Static {
/**
* Hyphen character ('\u2010', Unicode {@code 2010}).
- * This code tells to {@link org.apache.sis.io.LineFormatter}
+ * This code tells to {@link org.apache.sis.io.LineAppender}
* that a line break is allowed to be inserted after this character.
*
* <p>For non-breaking hyphen, use the Unicode {@code 2011} character.</p>
Modified:
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java?rev=1425590&r1=1425589&r2=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
(original)
+++
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
Mon Dec 24 05:36:25 2012
@@ -27,8 +27,8 @@ import java.text.ParsePosition;
import java.text.ParseException;
import java.util.regex.Matcher;
import net.jcip.annotations.NotThreadSafe;
-import org.apache.sis.io.LineFormatter;
-import org.apache.sis.io.TableFormatter;
+import org.apache.sis.io.LineAppender;
+import org.apache.sis.io.TableAppender;
import org.apache.sis.io.TabularFormat;
import org.apache.sis.io.CompoundFormat;
import org.apache.sis.util.Workaround;
@@ -509,17 +509,17 @@ public class TreeTableFormat extends Tab
* methods, so we are better to define only one method here doing the work.
*/
final void writeColumnSeparator(final Appendable out) throws IOException {
- // We have a TableFormatter instance if and only if there is 2 or more
columns.
- ((TableFormatter) out.append(beforeFill)).nextColumn(fillCharacter);
+ // We have a TableAppender instance if and only if there is 2 or more
columns.
+ ((TableAppender) out.append(beforeFill)).nextColumn(fillCharacter);
out.append(columnSeparator);
}
/**
* Creates string representation of the node values. Tabulations are
replaced by spaces,
* and line feeds are replaced by the Pilcrow character. This is necessary
in order to
- * avoid conflict with the characters expected by {@link TableFormatter}.
+ * avoid conflict with the characters expected by {@link TableAppender}.
*/
- private final class Writer extends LineFormatter {
+ private final class Writer extends LineAppender {
/**
* The columns to write.
*/
@@ -545,7 +545,7 @@ public class TreeTableFormat extends Tab
* Creates a new instance which will write in the given appendable.
*/
Writer(final Appendable out, final TableColumn<?>[] columns) {
- super(columns.length >= 2 ? new TableFormatter(out, "") : out);
+ super(columns.length >= 2 ? new TableAppender(out, "") : out);
this.columns = columns;
this.formats = getFormats(columns, false);
this.values = new Object[columns.length];
Copied:
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/AppenderTestCase.java
(from r1425582,
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/FormatterTestCase.java)
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/AppenderTestCase.java?p2=sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/AppenderTestCase.java&p1=sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/FormatterTestCase.java&r1=1425582&r2=1425590&rev=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/FormatterTestCase.java
(original)
+++
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/AppenderTestCase.java
Mon Dec 24 05:36:25 2012
@@ -25,7 +25,7 @@ import static org.apache.sis.test.Assert
/**
- * Base class for the testing {@code *Formatter} implementation.
+ * Base class for the testing {@code *Appender} implementation.
* This is public because JUnit requires it, but should be considered as an
implementation details.
*
* @author Martin Desruisseaux (Geomatys)
@@ -33,32 +33,32 @@ import static org.apache.sis.test.Assert
* @version 0.3
* @module
*/
-public abstract class FormatterTestCase extends TestCase {
+public abstract class AppenderTestCase extends TestCase {
/**
* The buffer where to write test data.
*/
private final StringBuilder buffer;
/**
- * The formatter to test. Subclasses should initialize this field as below:
+ * The appender to test. Subclasses should initialize this field as below:
*
* {@preformat java
- * formatter = MyFormatter(formatter);
+ * appender = MyAppender(appender);
* }
*/
- Appendable formatter;
+ Appendable appender;
/**
* Creates a new test case.
*/
- FormatterTestCase() {
+ AppenderTestCase() {
buffer = new StringBuilder(128);
- formatter = buffer;
+ appender = buffer;
}
/**
* Run the test. This method is where the test is actually performed.
- * Implementations shall write in the {@link #formatter}, then test
+ * Implementations shall write in the {@link #appender}, then test
* the result with {@link #assertOutputEquals(String)}.
*
* @param lineSeparator The line separator to use.
@@ -73,18 +73,18 @@ public abstract class FormatterTestCase
* @throws IOException Should never happen.
*/
final void assertOutputEquals(final String expected) throws IOException {
- IO.flush(formatter);
+ IO.flush(appender);
final String actual = buffer.toString();
assertMultilinesEquals("Ignoring line separators.", expected, actual);
assertEquals ("Checking line separators.", expected, actual);
}
/**
- * Uses a formatter which will redirect every {@link
Appendable#append(CharSequence)}
+ * Uses a appender which will redirect every {@link
Appendable#append(CharSequence)}
* calls to a sequence of {@link Appendable#append(char)} calls.
*/
private void useSingleChars() {
- formatter = new SingleCharAppendable(formatter);
+ appender = new SingleCharAppendable(appender);
}
/**
@@ -193,7 +193,7 @@ public abstract class FormatterTestCase
* @throws IOException Should never happen.
*/
public void testSequencesToWriter() throws IOException {
- formatter = IO.asWriter(formatter);
+ appender = IO.asWriter(appender);
run("\n");
}
}
Modified:
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/EchoAppendable.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/EchoAppendable.java?rev=1425590&r1=1425589&r2=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/EchoAppendable.java
(original)
+++
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/EchoAppendable.java
Mon Dec 24 05:36:25 2012
@@ -34,7 +34,7 @@ import static org.junit.Assert.*;
* @module
*/
@Decorator(Appendable.class)
-public class EchoAppendable extends FilteredAppendable {
+public class EchoAppendable extends Appender {
/**
* The echo writer.
*/
Modified:
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LeftMarginTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LeftMarginTest.java?rev=1425590&r1=1425589&r2=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LeftMarginTest.java
(original)
+++
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LeftMarginTest.java
Mon Dec 24 05:36:25 2012
@@ -24,24 +24,24 @@ import static org.junit.Assert.*;
/**
- * Tests {@link LineFormatter} implementation when used for inserting a margin
before every line.
+ * Tests {@link LineAppender} implementation when used for inserting a margin
before every line.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-3.00)
* @version 0.3
* @module
*
- * @see LineFormatter#onLineBegin(boolean)
+ * @see LineAppender#onLineBegin(boolean)
*/
-@DependsOn(LineFormatterTest.class)
-public final strictfp class LeftMarginTest extends LineFormatterTest {
+@DependsOn(LineAppenderTest.class)
+public final strictfp class LeftMarginTest extends LineAppenderTest {
/**
- * Creates and configure the {@link LineFormatter} to test.
+ * Creates and configure the {@link LineAppender} to test.
*/
@Before
@Override
- public void createLineFormatter() {
- formatter = new LineFormatter(formatter) {
+ public void createLineAppender() {
+ appender = new LineAppender(appender) {
@Override
protected void onLineBegin(boolean isContinuation) throws
IOException {
out.append(" ");
@@ -57,7 +57,7 @@ public final strictfp class LeftMarginTe
*/
@Override
void run(final String lineSeparator) throws IOException {
- final Appendable f = formatter;
+ final Appendable f = appender;
assertSame(f, f.append("Comme je descendais des Fleuves impassibles,\r"
+ "Je ne me sentis plus guidé par les haleurs
:\n"));
assertSame(f, f.append("Des Peaux-Rouges criards les avaient pris pour
cibles,\r\n"));
Copied:
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineAppenderTest.java
(from r1425582,
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineFormatterTest.java)
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineAppenderTest.java?p2=sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineAppenderTest.java&p1=sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineFormatterTest.java&r1=1425582&r2=1425590&rev=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineFormatterTest.java
(original)
+++
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineAppenderTest.java
Mon Dec 24 05:36:25 2012
@@ -24,8 +24,8 @@ import static org.junit.Assert.*;
/**
- * Tests various aspects of {@link LineFormatter}.
- * This base class tests {@code LineFormatter} when used for changing the line
separator,
+ * Tests various aspects of {@link LineAppender}.
+ * This base class tests {@code LineAppender} when used for changing the line
separator,
* which is a problematic involved in every tests. Subclasses will test other
aspects.
*
* @author Martin Desruisseaux (Geomatys)
@@ -37,20 +37,20 @@ import static org.junit.Assert.*;
org.apache.sis.util.CharSequencesTest.class,
org.apache.sis.internal.util.X364Test.class
})
-public strictfp class LineFormatterTest extends FormatterTestCase {
+public strictfp class LineAppenderTest extends AppenderTestCase {
/**
- * Creates a new test. Subclasses shall override the {@link
#createLineFormatter()} method
+ * Creates a new test. Subclasses shall override the {@link
#createLineAppender()} method
* in order to create the instance to test.
*/
- public LineFormatterTest() {
+ public LineAppenderTest() {
}
/**
- * Creates and configure the {@link LineFormatter} to test.
+ * Creates and configure the {@link LineAppender} to test.
*/
@Before
- public void createLineFormatter() {
- formatter = new LineFormatter(formatter, " ", false);
+ public void createLineAppender() {
+ appender = new LineAppender(appender, " ", false);
}
/**
@@ -61,9 +61,9 @@ public strictfp class LineFormatterTest
*/
@Override
void run(final String lineSeparator) throws IOException {
- final Appendable f = formatter;
- if (f instanceof LineFormatter) {
- assertEquals("getLineSeparator", " ", ((LineFormatter)
f).getLineSeparator());
+ final Appendable f = appender;
+ if (f instanceof LineAppender) {
+ assertEquals("getLineSeparator", " ", ((LineAppender)
f).getLineSeparator());
}
assertSame(f, f.append("Le vrai" + lineSeparator + "policitien, "));
assertSame(f, f.append("c'est celui\r\nqui\r")); // Line separator
broken on two method calls.
Modified:
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/SingleCharAppendable.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/SingleCharAppendable.java?rev=1425590&r1=1425589&r2=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/SingleCharAppendable.java
(original)
+++
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/SingleCharAppendable.java
Mon Dec 24 05:36:25 2012
@@ -22,14 +22,14 @@ import java.io.IOException;
/**
* Delegates calls to {@code append(CharSequence, int, int)} to a sequence of
calls
* to {@code append(char)}. This is used in order to explore more code paths in
- * {@link FilteredAppendable} implementations.
+ * {@link Appender} implementations.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-3.00)
* @version 0.3
* @module
*/
-final class SingleCharAppendable extends FilteredAppendable {
+final class SingleCharAppendable extends Appender {
/**
* Constructs a {@code SingleCharAppendable} object delegating to the
given {@code Appendable}.
*
Copied:
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java
(from r1425582,
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TableFormatterTest.java)
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java?p2=sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java&p1=sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TableFormatterTest.java&r1=1425582&r2=1425590&rev=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TableFormatterTest.java
(original)
+++
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java
Mon Dec 24 05:36:25 2012
@@ -24,7 +24,7 @@ import static org.junit.Assert.*;
/**
- * Tests the {@link TableFormatter} implementations.
+ * Tests the {@link TableAppender} implementations.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-3.00)
@@ -34,20 +34,20 @@ import static org.junit.Assert.*;
@DependsOn({
org.apache.sis.util.CharSequencesTest.class,
org.apache.sis.internal.util.X364Test.class,
- LineFormatterTest.class})
-public final strictfp class TableFormatterTest extends FormatterTestCase {
+ LineAppenderTest.class})
+public final strictfp class TableAppenderTest extends AppenderTestCase {
/**
- * The table formatter to test. May not be same instance than {@link
#formatter},
+ * The table appender to test. May not be same instance than {@link
#appender},
* because the super-class will wraps it in a {@link SingleCharAppendable}
in
* some occasions.
*/
- private final TableFormatter table;
+ private final TableAppender table;
/**
* Creates a new test case.
*/
- public TableFormatterTest() {
- formatter = table = new TableFormatter(formatter);
+ public TableAppenderTest() {
+ appender = table = new TableAppender(appender);
}
/**
@@ -55,7 +55,7 @@ public final strictfp class TableFormatt
*/
@Override
void run(String lineSeparator) throws IOException {
- final Appendable out = formatter;
+ final Appendable out = appender;
table.nextLine('â');
// r.e.d. = Equatorial diameter Measured relative to the Earth.
@@ -78,7 +78,7 @@ public final strictfp class TableFormatt
table.nextLine('â');
/*
* If our test case is using the wrapper which will send the data once
character at time,
- * our TableFormatter implementation will not be able to detect the
line separator and
+ * our TableAppender implementation will not be able to detect the
line separator and
* will fallback on the default one. So we set the line separator to
the one actually used
* not because this is the class contract (quite the opposite, this is
a limitation in our
* implementation), but simply in order to allow the test to pass.
@@ -102,22 +102,22 @@ public final strictfp class TableFormatt
}
/**
- * Tests the {@link TableFormatter#toString()} method.
+ * Tests the {@link TableAppender#toString()} method.
* The intend of this test is also to ensure that we can use the API
* more easily, without having to deal with {@link IOException}.
*/
@Test
public void testToString() { // NO throws IOException
/*
- * First, ensure that TableFormatter.toString() does not
+ * First, ensure that TableAppender.toString() does not
* mess with the content of user-supplied Appendable.
*/
testToString(table, "");
/*
- * When TableFormatter is created with its own internal buffer,
- * then TableFormatter.toString() is allowed to format the table.
+ * When TableAppender is created with its own internal buffer,
+ * then TableAppender.toString() is allowed to format the table.
*/
- testToString(new TableFormatter(),
+ testToString(new TableAppender(),
"âââââââââââ¤ââââââââââ¤âââââââââ\n"
+ "â English â French â r.e.d. â\n"
+
"âââââââââââ¼ââââââââââ¼âââââââââ¢\n"
@@ -133,7 +133,7 @@ public final strictfp class TableFormatt
* @param table Where to format the table.
* @param expected The expected string representation of the formatted
table.
*/
- private static void testToString(final TableFormatter table, final String
expected) {
+ private static void testToString(final TableAppender table, final String
expected) {
table.nextLine('â');
table.append("English\tFrench\tr.e.d.\n").writeHorizontalSeparator();
table.append("Mercury\tMercure\t0.382\n")
Modified:
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TabulationExpansionTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TabulationExpansionTest.java?rev=1425590&r1=1425589&r2=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TabulationExpansionTest.java
(original)
+++
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TabulationExpansionTest.java
Mon Dec 24 05:36:25 2012
@@ -24,24 +24,24 @@ import static org.junit.Assert.*;
/**
- * Tests {@link LineFormatter} implementation when used for expanding
tabulations to spaces.
+ * Tests {@link LineAppender} implementation when used for expanding
tabulations to spaces.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-3.00)
* @version 0.3
* @module
*
- * @see LineFormatter#setTabulationExpanded(boolean)
+ * @see LineAppender#setTabulationExpanded(boolean)
*/
-@DependsOn(LineFormatterTest.class)
-public final strictfp class TabulationExpansionTest extends LineFormatterTest {
+@DependsOn(LineAppenderTest.class)
+public final strictfp class TabulationExpansionTest extends LineAppenderTest {
/**
- * Creates and configure the {@link LineFormatter} to test.
+ * Creates and configure the {@link LineAppender} to test.
*/
@Before
@Override
- public void createLineFormatter() {
- formatter = new LineFormatter(formatter, null, true);
+ public void createLineAppender() {
+ appender = new LineAppender(appender, null, true);
}
/**
@@ -52,9 +52,9 @@ public final strictfp class TabulationEx
*/
@Override
void run(final String lineSeparator) throws IOException {
- final Appendable f = formatter;
- if (f instanceof LineFormatter) {
- assertEquals("getTabWidth", 8, ((LineFormatter)
f).getTabulationWidth());
+ final Appendable f = appender;
+ if (f instanceof LineAppender) {
+ assertEquals("getTabWidth", 8, ((LineAppender)
f).getTabulationWidth());
}
assertSame(f, f.append("12\t8" + lineSeparator));
assertSame(f, f.append("1234\t8" + lineSeparator));
Modified:
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/WordWrapTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/WordWrapTest.java?rev=1425590&r1=1425589&r2=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/WordWrapTest.java
(original)
+++
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/WordWrapTest.java
Mon Dec 24 05:36:25 2012
@@ -26,24 +26,24 @@ import static org.apache.sis.util.Charac
/**
- * Tests {@link LineFormatter} implementation when used for wrapping lines to
80 characters.
+ * Tests {@link LineAppender} implementation when used for wrapping lines to
80 characters.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-3.00)
* @version 0.3
* @module
*
- * @see LineFormatter#setMaximalLineLength(int)
+ * @see LineAppender#setMaximalLineLength(int)
*/
-@DependsOn(LineFormatterTest.class)
-public strictfp class WordWrapTest extends LineFormatterTest {
+@DependsOn(LineAppenderTest.class)
+public strictfp class WordWrapTest extends LineAppenderTest {
/**
- * Creates and configure the {@link LineFormatter} to test.
+ * Creates and configure the {@link LineAppender} to test.
*/
@Before
@Override
- public void createLineFormatter() {
- formatter = new LineFormatter(formatter, 10, false);
+ public void createLineAppender() {
+ appender = new LineAppender(appender, 10, false);
}
/**
@@ -64,9 +64,9 @@ public strictfp class WordWrapTest exten
*/
@Override
void run(final String lineSeparator) throws IOException {
- final Appendable f = formatter;
- if (f instanceof LineFormatter) {
- assertEquals("getMaximalLineLength", 10, ((LineFormatter)
f).getMaximalLineLength());
+ final Appendable f = appender;
+ if (f instanceof LineAppender) {
+ assertEquals("getMaximalLineLength", 10, ((LineAppender)
f).getMaximalLineLength());
}
final String BLUE = X364.FOREGROUND_BLUE .sequence();
final String DEFAULT = X364.FOREGROUND_DEFAULT.sequence();
@@ -74,7 +74,7 @@ public strictfp class WordWrapTest exten
assertSame(f, f.append("Ma vitre est un jar" + SOFT_HYPHEN + "din de
givre." + lineSeparator));
/*
* If our test case is using the wrapper which will send the data once
character at time,
- * our LineFormatter implementation will not be able to detect the
line separator and
+ * our LineAppender implementation will not be able to detect the line
separator and
* will fallback on the default one. So we set the line separator to
the one actually used
* not because this is the class contract (quite the opposite, this is
a limitation in our
* implementation), but simply in order to allow the test to pass.
Modified:
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/WordWrapWithLineSeparatorTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/WordWrapWithLineSeparatorTest.java?rev=1425590&r1=1425589&r2=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/WordWrapWithLineSeparatorTest.java
(original)
+++
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/WordWrapWithLineSeparatorTest.java
Mon Dec 24 05:36:25 2012
@@ -21,9 +21,9 @@ import org.apache.sis.test.DependsOn;
/**
- * Tests {@link LineFormatter} implementation when used for wrapping lines to
80 characters,
- * chained with another {@code LineFormatter}. Such chaining should not be
needed since a
- * single {@code LineFormatter} can handle many operations. But if such
situation happens
+ * Tests {@link LineAppender} implementation when used for wrapping lines to
80 characters,
+ * chained with another {@code LineAppender}. Such chaining should not be
needed since a
+ * single {@code LineAppender} can handle many operations. But if such
situation happens
* anyway, we want it to work.
*
* @author Martin Desruisseaux (Geomatys)
@@ -34,12 +34,12 @@ import org.apache.sis.test.DependsOn;
@DependsOn(WordWrapTest.class)
public final strictfp class WordWrapWithLineSeparatorTest extends WordWrapTest
{
/**
- * Creates and configure the {@link LineFormatter} to test.
+ * Creates and configure the {@link LineAppender} to test.
*/
@Before
@Override
- public void createLineFormatter() {
- formatter = new LineFormatter(new LineFormatter(formatter, "\r",
false), 10, false);
+ public void createLineAppender() {
+ appender = new LineAppender(new LineAppender(appender, "\r", false),
10, false);
}
/**
Modified:
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1425590&r1=1425589&r2=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
(original)
+++
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
Mon Dec 24 05:36:25 2012
@@ -72,12 +72,12 @@ import org.junit.runners.Suite;
org.apache.sis.measure.AngleFormatTest.class,
org.apache.sis.measure.AngleTest.class,
org.apache.sis.internal.util.X364Test.class,
- org.apache.sis.io.LineFormatterTest.class,
+ org.apache.sis.io.LineAppenderTest.class,
org.apache.sis.io.LeftMarginTest.class,
org.apache.sis.io.TabulationExpansionTest.class,
org.apache.sis.io.WordWrapTest.class,
org.apache.sis.io.WordWrapWithLineSeparatorTest.class,
- org.apache.sis.io.TableFormatterTest.class,
+ org.apache.sis.io.TableAppenderTest.class,
org.apache.sis.util.collection.TreeTableFormatTest.class,
// XML most basic types.
Modified:
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/collection/TreeTableFormatTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/collection/TreeTableFormatTest.java?rev=1425590&r1=1425589&r2=1425590&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/collection/TreeTableFormatTest.java
(original)
+++
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/collection/TreeTableFormatTest.java
Mon Dec 24 05:36:25 2012
@@ -36,7 +36,7 @@ import static org.apache.sis.util.collec
*/
@DependsOn({
DefaultTreeTableTest.class,
- org.apache.sis.io.TableFormatterTest.class
+ org.apache.sis.io.TableAppenderTest.class
})
public final strictfp class TreeTableFormatTest extends TestCase {
/**