Revision: 7820
Author: victormote
Date: 2006-07-23 12:47:59 -0700 (Sun, 23 Jul 2006)
ViewCVS: http://svn.sourceforge.net/foray/?rev=7820&view=rev
Log Message:
-----------
Implement standard use of final modifier on local variable and method parameters.
Modified Paths:
--------------
trunk/foray/foray-mif/src/java/org/foray/mif/MIFDocument.java
Modified: trunk/foray/foray-mif/src/java/org/foray/mif/MIFDocument.java
===================================================================
--- trunk/foray/foray-mif/src/java/org/foray/mif/MIFDocument.java 2006-07-23 19:39:14 UTC (rev 7819)
+++ trunk/foray/foray-mif/src/java/org/foray/mif/MIFDocument.java 2006-07-23 19:47:59 UTC (rev 7820)
@@ -52,9 +52,9 @@
private ID curIDCounter = new ID();
private Log logger;
- public static final String MIFEncode(String val) {
- int len = val.length();
- StringBuffer buf = new StringBuffer(len * 2);
+ public static final String MIFEncode(final String val) {
+ final int len = val.length();
+ final StringBuffer buf = new StringBuffer(len * 2);
char c;
for(int i = 0; i < len; i++) {
@@ -133,11 +133,11 @@
protected int width;
public Document() {}
- public void output(OutputStream stream) throws IOException {
+ public void output(final OutputStream stream) throws IOException {
- String mif = "\n<Document " + "\n<DPageSize " + width / 1000f
+ final String mif = "\n<Document " + "\n<DPageSize " + width / 1000f
+ " " + height / 1000f + " >\n>";
- byte buf[] = mif.getBytes();
+ final byte buf[] = mif.getBytes();
stream.write(buf);
@@ -157,7 +157,8 @@
private String url;
private int x, y, w, h;
- public ImportObject(String url, int x, int y, int w, int h) {
+ public ImportObject(final String url, final int x, final int y,
+ final int w, final int h) {
this.url = url;
this.x = x;
@@ -168,9 +169,7 @@
}
- public void output(OutputStream stream) throws IOException {
-
-
+ public void output(final OutputStream stream) throws IOException {
String path = this.url;
// Strip 'file:'
@@ -207,24 +206,20 @@
private int ID;
private int x, y, w, h;
ArrayList content = new ArrayList();
- public Frame(int x, int y, int w, int h) {
+ public Frame(final int x, final int y, final int w, final int h) {
this.ID = curIDCounter.getnewID();
this.x = x;
this.y = y;
this.w = w;
this.h = h;
-
}
- public void addContent(ImportObject obj) {
-
+ public void addContent(final ImportObject obj) {
content.add(obj);
-
}
- public void output(OutputStream stream) throws IOException {
-
+ public void output(final OutputStream stream) throws IOException {
String mif = "\n<Frame" + "\n\t<ID " + this.ID + " >";
mif += EOL
+ TAB + "<Pen 15>" + EOL
@@ -276,25 +271,19 @@
private int curCol = 0; // Current column being processed
private int colGap = 0;
private int textRectID;
- public TextRect(int numCols) {
+ public TextRect(final int numCols) {
this.numCols = numCols;
this.curCol = 0;
this.textRectID = curIDCounter.getnewID();
-
}
-
public int getTextRectID() {
-
return textRectID;
-
}
-
- public void setTextRectProp(int left, int top, int width,
- int height) {
-
+ public void setTextRectProp(final int left, final int top,
+ final int width, final int height) {
if (curCol == 0) {
// Use the left and top margins
@@ -318,7 +307,7 @@
}
- public void output(OutputStream stream) throws IOException {
+ public void output(final OutputStream stream) throws IOException {
String mif = "\n<TextRect" + "\n\t<ID " + textRectID + ">"
+ "\n\t<ShapeRect " + rx / 1000f + " " + ry / 1000f
@@ -330,7 +319,7 @@
}
mif += "\n> #End TextRect";
- byte buf[] = mif.getBytes();
+ final byte buf[] = mif.getBytes();
stream.write(buf);
}
@@ -341,7 +330,8 @@
private String pageBackground;
private ArrayList textRects;
- public Page(String pageType, String pageTag, String pageBackground) {
+ public Page(final String pageType, final String pageTag,
+ final String pageBackground) {
this.pageType = pageType;
this.pageBackground = pageBackground;
this.textRects = new ArrayList();
@@ -353,15 +343,15 @@
this.textRects = new ArrayList();
}
- public void addTextRect(int numCols) {
- TextRect textRect = new TextRect(numCols);
+ public void addTextRect(final int numCols) {
+ final TextRect textRect = new TextRect(numCols);
this.textRects.add(textRect);
}
public TextRect curTextRect() {
//temporary fix for NoSuchElementException
if (textRects.isEmpty()) {
- TextRect textRect = new TextRect(1);
+ final TextRect textRect = new TextRect(1);
this.textRects.add(textRect);
}
return (TextRect)textRects.get(textRects.size() - 1);
@@ -369,11 +359,11 @@
- public void output(OutputStream stream) throws IOException {
+ public void output(final OutputStream stream) throws IOException {
String mif = "\n<Page" + "\n\t<PageType " + pageType + ">"
+ "\n\t<PageBackground " + "`" + pageBackground
+ "'" + ">";
- byte buf[] = mif.getBytes();
+ final byte buf[] = mif.getBytes();
stream.write(buf);
for (int i = 0; i < textRects.size(); i++) {
((TextRect)textRects.get(i)).output(stream);
@@ -425,7 +415,7 @@
this.paras.add(new Para(ID));
}
- public void output(OutputStream stream) throws IOException {
+ public void output(final OutputStream stream) throws IOException {
String mif = "\n<TextFlow";
stream.write(mif.getBytes());
for (int i = 0; i < paras.size(); i++) {
@@ -450,7 +440,7 @@
}
- public Para(int ID) {
+ public Para(final int ID) {
this.ID = ID;
this.paraLines = new ArrayList();
@@ -471,7 +461,8 @@
}
- public void setBlockProp(int startIndent, int endIndent) {
+ public void setBlockProp(final int startIndent,
+ final int endIndent) {
pgf = new ParagraphFormat();
pgf.startIndent = startIndent;
@@ -481,7 +472,7 @@
}
- public void output(OutputStream stream) throws IOException {
+ public void output(final OutputStream stream) throws IOException {
String mif = "\n<Para";
// Is there a block property?
@@ -508,7 +499,7 @@
int textRectID;
String tableID;
String aFrameID;
- public ParaLine(int textRectID) {
+ public ParaLine(final int textRectID) {
this.textRectID = textRectID;
this.content = new ArrayList();
@@ -521,13 +512,13 @@
this.content = new ArrayList();
}
- public void addContent(Object obj) {
+ public void addContent(final Object obj) {
this.content.add(obj);
}
- public void output(OutputStream stream) throws IOException {
+ public void output(final OutputStream stream) throws IOException {
String mif = "\n<ParaLine";
@@ -537,7 +528,7 @@
}
stream.write(mif.getBytes());
for (int i = 0; i < content.size(); i++) {
- Object elem = content.get(i);
+ final Object elem = content.get(i);
if (elem instanceof String) {
// Output newlines as char hard return
if (elem == "\n") {
@@ -566,8 +557,8 @@
ArrayList pgfs; // Paragraph formats
public PgfCatalog() {}
- public void output(OutputStream stream) throws IOException {
- String mif = "\n<PgfCatalog" + "\n<Pgf" + "\n<PgfTag `Body'>"
+ public void output(final OutputStream stream) throws IOException {
+ final String mif = "\n<PgfCatalog" + "\n<Pgf" + "\n<PgfTag `Body'>"
+ "\n>" + "\n>";
stream.write(mif.getBytes());
}
@@ -600,7 +591,7 @@
}
- public void output(OutputStream stream) throws IOException {
+ public void output(final OutputStream stream) throws IOException {
String mif = "\n<Ruling \n<RulingTag `Default'>";
mif += "\n<RulingPenWidth " + penWidth + ">";
@@ -624,7 +615,7 @@
}
- public void output(OutputStream stream) throws IOException {
+ public void output(final OutputStream stream) throws IOException {
String mif = "\n<RulingCatalog";
stream.write(mif.getBytes());
@@ -652,15 +643,15 @@
class TblColumn {
private int width;
- public TblColumn(int width) {
+ public TblColumn(final int width) {
this.width = width;
}
- public void output(OutputStream stream) throws IOException {
+ public void output(final OutputStream stream) throws IOException {
- String mif = "\n\t<TblColumnWidth " + width + " >";
+ final String mif = "\n\t<TblColumnWidth " + width + " >";
stream.write(mif.getBytes());
}
@@ -673,7 +664,7 @@
class Cell {
private ArrayList paras; // Paras
- public Cell(int rowSpan, int colSpan) {
+ public Cell(final int rowSpan, final int colSpan) {
paras = new ArrayList();
}
@@ -681,7 +672,8 @@
this.paras.add(new Para());
}
- public void output(OutputStream stream) throws IOException {
+ public void output(final OutputStream stream)
+ throws IOException {
String mif = "\n\t\t<Cell" + "\n\t\t<CellContent";
stream.write(mif.getBytes());
for (int i = 0; i < paras.size(); i++) {
@@ -695,7 +687,7 @@
private ArrayList cells;
- public void addCell(int rowSpan, int colSpan) {
+ public void addCell(final int rowSpan, final int colSpan) {
cells.add(new Cell(rowSpan, colSpan));
}
@@ -707,7 +699,7 @@
return (Cell)this.cells.get(cells.size() - 1);
}
- public void output(OutputStream stream) throws IOException {
+ public void output(final OutputStream stream) throws IOException {
String mif = "\n\t<Row";
stream.write(mif.getBytes());
for (int i = 0; i < cells.size(); i++) {
@@ -723,13 +715,13 @@
private ArrayList tblBody, tblHead, tblFoot;
/* is a reference to one of tblHead,tblBody or tblFoot */
private ArrayList current;
- public void addColumn(int colWidth) {
+ public void addColumn(final int colWidth) {
tblColumns.add(new TblColumn(colWidth));
}
- public void setCurrent(String current) {
+ public void setCurrent(final String current) {
if (current == "fo:table-body") {
this.current = this.tblBody;
@@ -744,7 +736,7 @@
this.current.add(new Row());
}
- public void startCell(int rowSpan, int colSpan) {
+ public void startCell(final int rowSpan, final int colSpan) {
// Add a cell into the current row
((Row)this.current.get(current.size() - 1)).addCell(rowSpan,
colSpan);
@@ -766,8 +758,8 @@
public Para curPara() {
// Return the last para of the current cell
- Row curRow = (Row)this.current.get(current.size() - 1);
- ArrayList paras = curRow.curCell().paras;
+ final Row curRow = (Row)this.current.get(current.size() - 1);
+ final ArrayList paras = curRow.curCell().paras;
return (Para)paras.get(paras.size() - 1);
}
@@ -780,7 +772,7 @@
}
- public void output(OutputStream stream) throws IOException {
+ public void output(final OutputStream stream) throws IOException {
String mif = "\n<Tbl" + "\n\t<TblID " + ID + " >";
@@ -867,8 +859,9 @@
}
- public Frame createFrame(int x, int y, int w, int h) {
- Frame frame = new Frame(x, y, w, h);
+ public Frame createFrame(final int x, final int y, final int w,
+ final int h) {
+ final Frame frame = new Frame(x, y, w, h);
aFrames.add(frame);
return frame;
}
@@ -883,7 +876,7 @@
public Tbl createTable() {
- Tbl table = new Tbl();
+ final Tbl table = new Tbl();
tables.add(table);
return table;
}
@@ -893,7 +886,7 @@
return (Tbl)tables.get(tables.size() - 1);
}
- public void output(OutputStream stream) throws IOException {
+ public void output(final OutputStream stream) throws IOException {
String mif = "<MIFFile 5.00>" + "\n<Units Upt>";
stream.write(mif.getBytes());
pgfCatalog.output(stream);
@@ -943,7 +936,7 @@
/**
* creates an empty MIF document
*/
- public MIFDocument(Log logger) {
+ public MIFDocument(final Log logger) {
this.logger = logger;
bookComponent = new BookComponent();
}
@@ -954,19 +947,19 @@
}
- public void addToStream(String s) {
+ public void addToStream(final String s) {
// Add this string to the curent flow
- Para para = curFlow.curPara();
- ParaLine paraLine = para.curParaLine();
+ final Para para = curFlow.curPara();
+ final ParaLine paraLine = para.curParaLine();
paraLine.addContent(s);
}
- public void output(OutputStream stream) throws IOException {
+ public void output(final OutputStream stream) throws IOException {
// Output the contents of bookComponent
this.bookComponent.output(stream);
}
- public void setDocumentHeightWidth(int height, int width) {
+ public void setDocumentHeightWidth(final int height, final int width) {
if (bookComponent.document == null) {
bookComponent.document = new Document();
bookComponent.document.height = height;
@@ -978,7 +971,7 @@
}
}
- public void createTextRect(int numCols) {
+ public void createTextRect(final int numCols) {
// Create a textrect on the bodypage with these dimensions
// This default behaviour will later be changed to reflect on
// the master-page
@@ -989,7 +982,8 @@
bookComponent.textFlows.add(curFlow);
}
- public void setTextRectProp(int left, int top, int width, int height) {
+ public void setTextRectProp(final int left, final int top, final int width,
+ final int height) {
(bookComponent.curPage()).curTextRect().setTextRectProp(left, top,
width, height);
}
@@ -1003,19 +997,21 @@
}
}
- public void setBlockProp(int startIndent, int endIndent) {
+ public void setBlockProp(final int startIndent, final int endIndent) {
curFlow.startPara(); // Start a para
curFlow.curPara().setBlockProp(startIndent, endIndent);
}
- public void createFrame(int x, int y, int w, int h) {
+ public void createFrame(final int x, final int y, final int w,
+ final int h) {
// Create a new anchored frame
bookComponent.createFrame(x, y, w, h);
}
- public void addImage(String url, int x, int y, int w, int h) {
- Frame frame = bookComponent.createFrame(x, y, w, h);
- ImportObject imageObject = new ImportObject(url, 0, 0, w, h);
+ public void addImage(final String url, final int x, final int y,
+ final int w, final int h) {
+ final Frame frame = bookComponent.createFrame(x, y, w, h);
+ final ImportObject imageObject = new ImportObject(url, 0, 0, w, h);
frame.addContent(imageObject);
if (curFlow.curPara().curParaLine() == null) {
curFlow.curPara().startParaLine();
@@ -1025,7 +1021,7 @@
public void createTable() {
// First create a table with an ID, then add it to the textflow
- Tbl table = bookComponent.createTable();
+ final Tbl table = bookComponent.createTable();
if (curFlow.curPara().curParaLine() == null) {
curFlow.curPara().startParaLine();
}
@@ -1038,25 +1034,25 @@
curFlow = table;
}
- public void setColumnProp(int colWidth) {
+ public void setColumnProp(final int colWidth) {
// Get the current table
- Tbl table = bookComponent.curTable();
+ final Tbl table = bookComponent.curTable();
table.addColumn(colWidth);
}
- public void setCurrent(String current) {
+ public void setCurrent(final String current) {
// Start the table body or header or footer
- Tbl table = bookComponent.curTable();
+ final Tbl table = bookComponent.curTable();
table.setCurrent(current);
}
public void startRow() {
- Tbl table = bookComponent.curTable();
+ final Tbl table = bookComponent.curTable();
table.startRow();
}
- public void startCell(int rowSpan, int colSpan) {
- Tbl table = bookComponent.curTable();
+ public void startCell(final int rowSpan, final int colSpan) {
+ final Tbl table = bookComponent.curTable();
table.startCell(rowSpan, colSpan);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|