[FOray-commit] SF.net SVN: foray: [10275] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-11-10 01:37:26
|
Revision: 10275
http://foray.svn.sourceforge.net/foray/?rev=10275&view=rev
Author: victormote
Date: 2007-11-09 17:37:30 -0800 (Fri, 09 Nov 2007)
Log Message:
-----------
Fix some issues reported by Checkstyle, related to ternary conditionals and the use of implementations instead of interfaces.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/util/WordList.java
trunk/foray/foray-mif/src/java/org/foray/mif/MifBookComponent.java
trunk/foray/foray-mif/src/java/org/foray/mif/MifPgf.java
trunk/foray/foray-mif/src/java/org/foray/mif/MifPgfLine.java
trunk/foray/foray-mif/src/java/org/foray/mif/MifTbl.java
trunk/foray/foray-mif/src/java/org/foray/mif/MifTextFlow.java
trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDTokenizer.java
trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java
trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java
trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java 2007-11-10 01:19:14 UTC (rev 10274)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java 2007-11-10 01:37:30 UTC (rev 10275)
@@ -400,7 +400,12 @@
* @param newsize The new number of nodes in the tree.
*/
private void redimNodeArrays(final int newsize) {
- final int len = newsize < this.lo.length ? newsize : this.lo.length;
+ int len = 0;
+ if (newsize < this.lo.length) {
+ len = newsize;
+ } else {
+ len = this.lo.length;
+ }
char[] na = new char[newsize];
System.arraycopy(this.lo, 0, na, 0, len);
this.lo = na;
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/util/WordList.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/util/WordList.java 2007-11-10 01:19:14 UTC (rev 10274)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/util/WordList.java 2007-11-10 01:37:30 UTC (rev 10275)
@@ -43,6 +43,7 @@
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
import java.util.StringTokenizer;
/**
@@ -100,7 +101,7 @@
}
/* Tokenize the input. */
- final ArrayList<String> tokens = new ArrayList<String>(
+ final List<String> tokens = new ArrayList<String>(
WordList.INITIAL_LIST_SIZE);
final InputStreamReader reader = new InputStreamReader(this.input,
this.inputEncoding);
@@ -222,7 +223,7 @@
* Removes the non-word characters from the list of tokens.
* @param tokens The list of tokens to be adjusted.
*/
- private void removeNonWordChars(final ArrayList<String> tokens) {
+ private void removeNonWordChars(final List<String> tokens) {
if (! this.removeNonWordChars) {
return;
}
Modified: trunk/foray/foray-mif/src/java/org/foray/mif/MifBookComponent.java
===================================================================
--- trunk/foray/foray-mif/src/java/org/foray/mif/MifBookComponent.java 2007-11-10 01:19:14 UTC (rev 10274)
+++ trunk/foray/foray-mif/src/java/org/foray/mif/MifBookComponent.java 2007-11-10 01:37:30 UTC (rev 10275)
@@ -29,6 +29,7 @@
package org.foray.mif;
import java.util.ArrayList;
+import java.util.List;
/**
* A MIF Book Component.
@@ -54,16 +55,16 @@
private MifTblCatalog tblCatalog;
/** The frames in this component. */
- private ArrayList<MifFrame> aFrames = new ArrayList<MifFrame>();
+ private List<MifFrame> aFrames = new ArrayList<MifFrame>();
/** The table in this component. */
- private ArrayList<MifTbl> tables = new ArrayList<MifTbl>();
+ private List<MifTbl> tables = new ArrayList<MifTbl>();
/** The pages in this component. */
- private ArrayList<MifPage> pages = new ArrayList<MifPage>();
+ private List<MifPage> pages = new ArrayList<MifPage>();
/** The text flows in this component. */
- private ArrayList<MifFlow> textFlows = new ArrayList<MifFlow>();
+ private List<MifFlow> textFlows = new ArrayList<MifFlow>();
/**
* Constructor.
@@ -194,7 +195,7 @@
* Returns the pages for this component.
* @return The pages for this component.
*/
- public ArrayList<MifPage> getPages() {
+ public List<MifPage> getPages() {
return this.pages;
}
@@ -212,7 +213,7 @@
* Returns the text flows for this component.
* @return The textFlows.
*/
- public ArrayList<MifFlow> getTextFlows() {
+ public List<MifFlow> getTextFlows() {
return this.textFlows;
}
Modified: trunk/foray/foray-mif/src/java/org/foray/mif/MifPgf.java
===================================================================
--- trunk/foray/foray-mif/src/java/org/foray/mif/MifPgf.java 2007-11-10 01:19:14 UTC (rev 10274)
+++ trunk/foray/foray-mif/src/java/org/foray/mif/MifPgf.java 2007-11-10 01:37:30 UTC (rev 10275)
@@ -31,6 +31,7 @@
import org.foray.common.WKConstants;
import java.util.ArrayList;
+import java.util.List;
/**
* A MIF Paragraph.
@@ -38,7 +39,7 @@
public class MifPgf extends MifToken {
/** The lines in this paragraph. */
- private ArrayList<MifPgfLine> paraLines;
+ private List<MifPgfLine> paraLines;
/** Same as TextRectID. */
private int id;
Modified: trunk/foray/foray-mif/src/java/org/foray/mif/MifPgfLine.java
===================================================================
--- trunk/foray/foray-mif/src/java/org/foray/mif/MifPgfLine.java 2007-11-10 01:19:14 UTC (rev 10274)
+++ trunk/foray/foray-mif/src/java/org/foray/mif/MifPgfLine.java 2007-11-10 01:37:30 UTC (rev 10275)
@@ -29,6 +29,7 @@
package org.foray.mif;
import java.util.ArrayList;
+import java.util.List;
/**
* A MIF Paragraph Line.
@@ -36,7 +37,7 @@
public class MifPgfLine extends MifToken {
/** The content of this line. */
- private ArrayList<Object> content;
+ private List<Object> content;
/** The id of the parent text rectangle for this line. */
private int textRectID;
Modified: trunk/foray/foray-mif/src/java/org/foray/mif/MifTbl.java
===================================================================
--- trunk/foray/foray-mif/src/java/org/foray/mif/MifTbl.java 2007-11-10 01:19:14 UTC (rev 10274)
+++ trunk/foray/foray-mif/src/java/org/foray/mif/MifTbl.java 2007-11-10 01:37:30 UTC (rev 10275)
@@ -29,6 +29,7 @@
package org.foray.mif;
import java.util.ArrayList;
+import java.util.List;
/**
* A MIF Table.
@@ -39,20 +40,20 @@
private int id;
/** The columns in this table. */
- private ArrayList<TblColumn> tblColumns = new ArrayList<TblColumn>();
+ private List<TblColumn> tblColumns = new ArrayList<TblColumn>();
/** The rows in this table's body. */
- private ArrayList<Row> tblBody;
+ private List<Row> tblBody;
/** The rows in this table's header. */
- private ArrayList<Row> tblHead;
+ private List<Row> tblHead;
/** The rows in this table's footer. */
- private ArrayList<Row> tblFoot;
+ private List<Row> tblFoot;
/** The current portion of the table being processed, one of
* {@link #tblHead}, {@link #tblBody}, or {@link #tblFoot}. */
- private ArrayList<Row> current;
+ private List<Row> current;
/**
* Constructor.
@@ -98,7 +99,7 @@
class Row extends MifToken {
/** The cells in this row. */
- private ArrayList<Cell> cells;
+ private List<Cell> cells;
/**
* Constructor.
@@ -113,7 +114,7 @@
class Cell extends MifToken {
/** The paragraphs in this cell. */
- private ArrayList<MifPgf> paras;
+ private List<MifPgf> paras;
/**
* Constructor.
@@ -234,7 +235,7 @@
*/
public MifPgf curPara() {
final Row curRow = this.current.get(this.current.size() - 1);
- final ArrayList<MifPgf> paras = curRow.curCell().paras;
+ final List<MifPgf> paras = curRow.curCell().paras;
return paras.get(paras.size() - 1);
}
Modified: trunk/foray/foray-mif/src/java/org/foray/mif/MifTextFlow.java
===================================================================
--- trunk/foray/foray-mif/src/java/org/foray/mif/MifTextFlow.java 2007-11-10 01:19:14 UTC (rev 10274)
+++ trunk/foray/foray-mif/src/java/org/foray/mif/MifTextFlow.java 2007-11-10 01:37:30 UTC (rev 10275)
@@ -29,6 +29,7 @@
package org.foray.mif;
import java.util.ArrayList;
+import java.util.List;
/**
* A MIF Text Flow.
@@ -36,7 +37,7 @@
public class MifTextFlow extends MifFlow {
/** The paragraphs in this text flow. */
- private ArrayList<MifPgf> paras;
+ private List<MifPgf> paras;
/** This ID is used within ParaLine. However it is logical to keep it unique
* to a textflow. */
Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDTokenizer.java
===================================================================
--- trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDTokenizer.java 2007-11-10 01:19:14 UTC (rev 10274)
+++ trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDTokenizer.java 2007-11-10 01:37:30 UTC (rev 10275)
@@ -29,6 +29,7 @@
package org.foray.pretty.dtd;
import java.util.ArrayList;
+import java.util.List;
/**
* Utility class for tokenizing a DTD.
@@ -51,7 +52,7 @@
* @return An array of String tokens.
*/
public static String[] tokenizeElementContent(final String content) {
- final ArrayList<String> tokens = new ArrayList<String>();
+ final List<String> tokens = new ArrayList<String>();
int startIndex = 0;
int currentIndex = 0;
while (true) {
@@ -186,8 +187,7 @@
* @param arrayList The raw list.
* @return A String array with arrayList's contents.
*/
- public static String[] arrayListToStrings(
- final ArrayList<String> arrayList) {
+ public static String[] arrayListToStrings(final List<String> arrayList) {
final String[] strings = new String[arrayList.size()];
for (int i = 0; i < arrayList.size(); i++) {
strings[i] = arrayList.get(i);
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java 2007-11-10 01:19:14 UTC (rev 10274)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java 2007-11-10 01:37:30 UTC (rev 10275)
@@ -197,8 +197,8 @@
* being built is in procedureBeingBuilt, which is pushed onto this stack
* if a nested procedure is started.
*/
- private List<ArrayList<PSObject>> procedureStack
- = new ArrayList<ArrayList<PSObject>>();
+ private List<List<PSObject>> procedureStack
+ = new ArrayList<List<PSObject>>();
/**
* This is the procedure that is currently being built. If a nested
@@ -206,7 +206,7 @@
* procedureStack, and a new procedureBeingBuilt is started. It must always
* be null when no procedure is being built.
*/
- private ArrayList<PSObject> procedureBeingBuilt = null;
+ private List<PSObject> procedureBeingBuilt = null;
/** Indicates whether the parser is currently inside a string. */
private boolean inString = false;
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java 2007-11-10 01:19:14 UTC (rev 10274)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java 2007-11-10 01:37:30 UTC (rev 10275)
@@ -40,6 +40,7 @@
import java.awt.geom.Point2D;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
/**
@@ -2031,9 +2032,9 @@
PSOperator.OPER_BIND);
}
// Create a stack of items whose contents are to be bound
- final ArrayList<PSArray> stack = new ArrayList<PSArray>(5);
+ final List<PSArray> stack = new ArrayList<PSArray>(5);
// Create a collection to keep track of where we are in each one.
- final ArrayList<Integer> stackCounter = new ArrayList<Integer>(5);
+ final List<Integer> stackCounter = new ArrayList<Integer>(5);
stack.add(psarray);
stackCounter.add(new Integer(0));
while (stack.size() > 0) {
Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java 2007-11-10 01:19:14 UTC (rev 10274)
+++ trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java 2007-11-10 01:37:30 UTC (rev 10275)
@@ -85,6 +85,7 @@
import java.awt.print.PrinterException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.List;
import java.util.Vector;
import javax.swing.ImageIcon;
@@ -108,7 +109,7 @@
private int pageNumber = 0;
/** The list of pages processed. */
- private Vector<Page> pageList = new Vector<Page>();
+ private List<Page> pageList = new Vector<Page>();
/** A color cached during processing. This could conceivably become a
* local variable, but is an instance variable in the hope of reducing
@@ -386,7 +387,7 @@
* @param page The index to the page to be removed.
*/
public void removePage(final int page) {
- this.pageList.removeElementAt(page);
+ this.pageList.remove(page);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|