[FOray-commit] SF.net SVN: foray: [7827] trunk/foray/foray-ps
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-07-23 21:55:52
|
Revision: 7827 Author: victormote Date: 2006-07-23 14:55:19 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7827&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-ps/.project trunk/foray/foray-ps/src/java/org/foray/ps/PSArray.java trunk/foray/foray-ps/src/java/org/foray/ps/PSBoolean.java trunk/foray/foray-ps/src/java/org/foray/ps/PSColor.java trunk/foray/foray-ps/src/java/org/foray/ps/PSColorSpace.java trunk/foray/foray-ps/src/java/org/foray/ps/PSDictionary.java trunk/foray/foray-ps/src/java/org/foray/ps/PSErrorDict.java trunk/foray/foray-ps/src/java/org/foray/ps/PSException.java trunk/foray/foray-ps/src/java/org/foray/ps/PSFile.java trunk/foray/foray-ps/src/java/org/foray/ps/PSFileFilter.java trunk/foray/foray-ps/src/java/org/foray/ps/PSFileReal.java trunk/foray/foray-ps/src/java/org/foray/ps/PSFontID.java trunk/foray/foray-ps/src/java/org/foray/ps/PSGraphicsState.java trunk/foray/foray-ps/src/java/org/foray/ps/PSInputFile.java trunk/foray/foray-ps/src/java/org/foray/ps/PSInteger.java trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java trunk/foray/foray-ps/src/java/org/foray/ps/PSMark.java trunk/foray/foray-ps/src/java/org/foray/ps/PSMatrix.java trunk/foray/foray-ps/src/java/org/foray/ps/PSName.java trunk/foray/foray-ps/src/java/org/foray/ps/PSNumber.java trunk/foray/foray-ps/src/java/org/foray/ps/PSObject.java trunk/foray/foray-ps/src/java/org/foray/ps/PSOperator.java trunk/foray/foray-ps/src/java/org/foray/ps/PSReal.java trunk/foray/foray-ps/src/java/org/foray/ps/PSStack.java trunk/foray/foray-ps/src/java/org/foray/ps/PSStackGS.java trunk/foray/foray-ps/src/java/org/foray/ps/PSStackObject.java trunk/foray/foray-ps/src/java/org/foray/ps/PSString.java trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java Modified: trunk/foray/foray-ps/.project =================================================================== --- trunk/foray/foray-ps/.project 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/.project 2006-07-23 21:55:19 UTC (rev 7827) @@ -7,12 +7,12 @@ </projects> <buildSpec> <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> <arguments> </arguments> </buildCommand> Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSArray.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSArray.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSArray.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -38,8 +38,8 @@ */ int executionStackIteratorIndex = 0; - public PSArray(PSInterpreter interpreter, Object[] value, - boolean executable) { + public PSArray(final PSInterpreter interpreter, final Object[] value, + final boolean executable) { super(interpreter); this.value = value; this.executable = executable; @@ -68,7 +68,8 @@ if (executionStackIteratorIndex > value.length - 1) { return null; } - PSObject nextElement = (PSObject) value[executionStackIteratorIndex]; + final PSObject nextElement = + (PSObject) value[executionStackIteratorIndex]; executionStackIteratorIndex ++; return nextElement; } @@ -77,7 +78,7 @@ return value.length - executionStackIteratorIndex; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSArray) { return true; } @@ -96,7 +97,7 @@ return value.length; } - public PSObject get(int index) { + public PSObject get(final int index) { if (index < 0 || index > value.length - 1) { return null; } @@ -116,7 +117,7 @@ return null; } boolean allNumbers = true; - PSNumber[] newArray = new PSNumber[6]; + final PSNumber[] newArray = new PSNumber[6]; for (int i = 0; i < this.value.length; i++) { if (this.value[i] instanceof PSNumber) { newArray[i] = (PSNumber) this.value[i]; Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSBoolean.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSBoolean.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSBoolean.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -31,7 +31,7 @@ boolean value; - public PSBoolean(PSInterpreter interpreter, boolean value) { + public PSBoolean(final PSInterpreter interpreter, final boolean value) { super(interpreter); this.value = value; } @@ -48,7 +48,7 @@ return PSObject.PSOBJ_BOOLEAN; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSBoolean) { return true; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSColor.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSColor.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSColor.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -40,8 +40,9 @@ * @param fillNotStroke * @return The PostScript code that represents this color. */ - public static String toPS(Color color, boolean fillNotStroke, String eol) { - int colorSpace = color.getColorSpace().getType(); + public static String toPS(final Color color, final boolean fillNotStroke, + final String eol) { + final int colorSpace = color.getColorSpace().getType(); switch (colorSpace) { case ColorSpace.TYPE_RGB: { return toPS_RGB(color, fillNotStroke, eol); @@ -56,9 +57,9 @@ } /* Colorspace is RGB. */ - private static String toPS_RGB(Color color, boolean fillNotStroke, - String eol) { - StringBuffer buffer = new StringBuffer(""); + private static String toPS_RGB(final Color color, + final boolean fillNotStroke, final String eol) { + final StringBuffer buffer = new StringBuffer(""); /* According to pdfspec 12.1 p.399, if the colors are the same then * just use the g or G operator (DeviceGray). */ @@ -67,7 +68,7 @@ && color.getRed() == color.getBlue()) { isGray = true; } - float[] rgbColors = color.getComponents(null); + final float[] rgbColors = color.getComponents(null); // fill if (fillNotStroke) { @@ -94,10 +95,10 @@ } /* Colorspace is CMYK. */ - private static String toPS_CMYK(Color color, boolean fillNotStroke, - String eol) { - StringBuffer buffer = new StringBuffer(""); - float[] cmykColors = color.getComponents(null); + private static String toPS_CMYK(final Color color, + final boolean fillNotStroke, final String eol) { + final StringBuffer buffer = new StringBuffer(""); + final float[] cmykColors = color.getComponents(null); if (fillNotStroke) { // fill buffer.append(PSReal.doubleOut(cmykColors[0]) + " " + PSReal.doubleOut(cmykColors[1]) + " " @@ -113,10 +114,10 @@ } /* Colorspace is DeviceGray. */ - private static String toPS_Gray(Color color, boolean fillNotStroke, - String eol) { - StringBuffer buffer = new StringBuffer(""); - float[] grayColors = color.getComponents(null); + private static String toPS_Gray(final Color color, + final boolean fillNotStroke, final String eol) { + final StringBuffer buffer = new StringBuffer(""); + final float[] grayColors = color.getComponents(null); if (fillNotStroke) { buffer.append(PSReal.doubleOut(grayColors[0]) + " g" + eol); } else { Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSColorSpace.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSColorSpace.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSColorSpace.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -44,12 +44,12 @@ /** * Standard constructor. */ - public PSColorSpace(PSInterpreter interpreter, Object[] value) { + public PSColorSpace(final PSInterpreter interpreter, final Object[] value) { super(interpreter, value, false); } - public static PSColorSpace makeColorSpace(PSInterpreter interpreter, - int type) { + public static PSColorSpace makeColorSpace(final PSInterpreter interpreter, + final int type) { PSName csName = null; switch (type) { case DEVICE_GRAY: { Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSDictionary.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSDictionary.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSDictionary.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -35,7 +35,8 @@ private HashMap dictionary = null; - public PSDictionary(PSInterpreter interpreter, int initialSize) { + public PSDictionary(final PSInterpreter interpreter, + final int initialSize) { super(interpreter); dictionary = new HashMap(initialSize); } @@ -45,8 +46,8 @@ * @param nameObject The PSName instance that should be executed. * @return True if the operation was found and executed, otherwise, false. */ - protected boolean execute(PSName nameObject) throws PSException { - PSObject value = getItem(nameObject); + protected boolean execute(final PSName nameObject) throws PSException { + final PSObject value = getItem(nameObject); // If the item is not in this dictionary, exit if (value == null) { return false; @@ -67,7 +68,8 @@ * be executed * @return True if the operator is found and executed, otherwise, false. */ - protected boolean executeOperator(short operatorEnum) throws PSException { + protected boolean executeOperator(final short operatorEnum) + throws PSException { return false; } @@ -83,7 +85,8 @@ * @param key * @param value */ - public void addItem(PSObject key, PSObject value) throws PSException { + public void addItem(final PSObject key, final PSObject value) + throws PSException { // Per PLRM2, Sec 3.3.9, a key can be any PS object except null. if (key.getPSObjectType() == PSOBJ_NULL) { throw new PSException(this.interpreter, PSErrorDict.TYPECHECK, -1); @@ -95,10 +98,10 @@ dictionary.put(key, value); } - public PSObject getItem(PSObject key) { - Iterator iter = dictionary.keySet().iterator(); + public PSObject getItem(final PSObject key) { + final Iterator iter = dictionary.keySet().iterator(); while (iter.hasNext()) { - PSObject currentKey = (PSObject) iter.next(); + final PSObject currentKey = (PSObject) iter.next(); if (currentKey.equals(key)) { return (PSObject) dictionary.get(currentKey); } @@ -106,10 +109,10 @@ return null; } - public PSObject getItem(String key) { - Iterator iter = dictionary.keySet().iterator(); + public PSObject getItem(final String key) { + final Iterator iter = dictionary.keySet().iterator(); while (iter.hasNext()) { - PSObject currentKey = (PSObject) iter.next(); + final PSObject currentKey = (PSObject) iter.next(); if (currentKey.equals(key)) { return (PSObject) dictionary.get(currentKey); } @@ -131,7 +134,7 @@ * @return True if this is a valid font dictionary, false otherwise. */ public boolean isValidFontDictionary() { - PSInteger fontType = (PSInteger) getItem("FontType"); + final PSInteger fontType = (PSInteger) getItem("FontType"); if (fontType == null) { return false; } @@ -160,7 +163,7 @@ return true; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSDictionary) { return true; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSErrorDict.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSErrorDict.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSErrorDict.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -93,7 +93,7 @@ "vmerror" }; - public PSErrorDict(PSInterpreter interpreter) { + public PSErrorDict(final PSInterpreter interpreter) { super(interpreter, 0); } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSException.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSException.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSException.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -37,38 +37,38 @@ String message; String operandStackImage; - public PSException(PSInterpreter interpreter, int errorCode, - int offendingOperator, String message) { + public PSException(final PSInterpreter interpreter, final int errorCode, + final int offendingOperator, final String message) { super(message); this.lineNumber = interpreter.getCurrentLine(); this.columnNumber = interpreter.getCurrentColumn(); this.errorCode = errorCode; this.offendingOperator = offendingOperator; - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("Operand Stack:\n"); - PSStackObject operandStack = interpreter.getOperandStack(); + final PSStackObject operandStack = interpreter.getOperandStack(); if (operandStack.size() == 0) { buffer.append(" (empty)"); } for (int i = 0; i < operandStack.size(); i++) { - PSObject object = operandStack.peek(i); + final PSObject object = operandStack.peek(i); buffer.append(" " + object.toString() + "\n"); } this.operandStackImage = buffer.toString(); } - public PSException(PSInterpreter interpreter, int errorCode) { + public PSException(final PSInterpreter interpreter, final int errorCode) { this(interpreter, errorCode, (short) -1, null); } - public PSException(PSInterpreter interpreter, int errorCode, - int offendingOperator) { + public PSException(final PSInterpreter interpreter, final int errorCode, + final int offendingOperator) { this(interpreter, errorCode, offendingOperator, null); } public String getMessage() { - String detailMessage = super.getMessage(); - StringBuffer sb = new StringBuffer(); + final String detailMessage = super.getMessage(); + final StringBuffer sb = new StringBuffer(); if (this.errorCode < 0 || this.errorCode > PSErrorDict.ERROR_NAMES.length - 1) { sb.append("PS Interpeter threw invalid PostScript error: "); Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSFile.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSFile.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSFile.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -50,7 +50,7 @@ /** * Generic constructor. */ - public PSFile(PSInterpreter interpreter) { + public PSFile(final PSInterpreter interpreter) { super(interpreter); } @@ -98,18 +98,18 @@ if (chunk == null) { return null; } - int arraySize = chunk.length - chunkIndex; + final int arraySize = chunk.length - chunkIndex; if (arraySize < 1) { return null; } - byte[] remainingChunk = new byte[arraySize]; + final byte[] remainingChunk = new byte[arraySize]; System.arraycopy(chunk, chunkIndex, remainingChunk, 0, arraySize); // Advance the index past the boundary chunkIndex = chunk.length; return remainingChunk; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSFile) { return true; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSFileFilter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSFileFilter.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSFileFilter.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -46,8 +46,8 @@ * @param interpreter The PSInterpreter for which this filter is operating. * @param underlyingFile The PSFile which backs this filter. */ - public PSFileFilter(PSInterpreter interpreter, PSFilter filter, - PSFile underlyingFile) { + public PSFileFilter(final PSInterpreter interpreter, final PSFilter filter, + final PSFile underlyingFile) { super(interpreter); this.filter = filter; this.underlyingFile = underlyingFile; @@ -58,8 +58,8 @@ * @param interpreter The PSInterpreter for which this filter is operating. * @param underlyingString The String which backs this filter. */ - public PSFileFilter(PSInterpreter interpreter, PSFilter filter, - PSString underlyingString) { + public PSFileFilter(final PSInterpreter interpreter, final PSFilter filter, + final PSString underlyingString) { super(interpreter); this.filter = filter; this.underlyingString = underlyingString; @@ -78,7 +78,7 @@ } try { return filter.decode(tempChunk); - } catch (PSFilterException e) { + } catch (final PSFilterException e) { // TODO Auto-generated catch block e.printStackTrace(); } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSFileReal.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSFileReal.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSFileReal.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -41,7 +41,7 @@ * @param interpreter * @param file */ - public PSFileReal(PSInterpreter interpreter, File file) { + public PSFileReal(final PSInterpreter interpreter, final File file) { super(interpreter); this.value = file; } @@ -52,7 +52,7 @@ * @param interpreter * @param input */ - public PSFileReal(PSInterpreter interpreter, PSInput input) { + public PSFileReal(final PSInterpreter interpreter, final PSInput input) { super(interpreter); this.input = input; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSFontID.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSFontID.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSFontID.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -31,7 +31,7 @@ public class PSFontID extends PSObject { - public PSFontID(PSInterpreter interpreter) { + public PSFontID(final PSInterpreter interpreter) { super(interpreter); } @@ -47,7 +47,7 @@ return PSObject.PSOBJ_FONTID; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSFontID) { return true; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSGraphicsState.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSGraphicsState.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSGraphicsState.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -89,7 +89,7 @@ private float flatness = 1.0f; byte device; // Bogus datatype. - public PSGraphicsState(PSInterpreter interpreter) { + public PSGraphicsState(final PSInterpreter interpreter) { super(interpreter); this.interpreter = interpreter; this.colorSpaceDeviceGray = PSColorSpace.makeColorSpace( @@ -104,7 +104,7 @@ PSGraphicsState clone; try { clone = (PSGraphicsState) super.clone(); - } catch (CloneNotSupportedException e) { + } catch (final CloneNotSupportedException e) { return null; } return clone; @@ -114,7 +114,7 @@ return (PSGraphicsState) this.clone(); } - public void setColorSpace(int colorSpace) { + public void setColorSpace(final int colorSpace) { switch (colorSpace) { case PSColorSpace.DEVICE_GRAY: { this.colorSpace = this.colorSpaceDeviceGray; @@ -134,7 +134,7 @@ } } - public void setColor(Color newColor) { + public void setColor(final Color newColor) { this.color = newColor; } @@ -146,7 +146,7 @@ return this.colorSpace; } - public void setDash(PSArray dashPattern, float dashOffset) { + public void setDash(final PSArray dashPattern, final float dashOffset) { this.dashPattern = dashPattern; this.dashOffset = dashOffset; } @@ -159,7 +159,7 @@ return this.dashOffset; } - public void setFlatness(float flatness) { + public void setFlatness(final float flatness) { this.flatness = flatness; } @@ -177,7 +177,7 @@ /** * @param lineJoin The lineJoin to set. */ - public void setLineJoin(PSInteger lineJoin) { + public void setLineJoin(final PSInteger lineJoin) { this.lineJoin = lineJoin; } @@ -191,7 +191,7 @@ /** * @param lineCap The lineCap to set. */ - public void setLineCap(PSInteger lineCap) { + public void setLineCap(final PSInteger lineCap) { this.lineCap = lineCap; } @@ -205,7 +205,7 @@ /** * @param lineWidth The lineWidth to set. */ - public void setLineWidth(PSNumber lineWidth) { + public void setLineWidth(final PSNumber lineWidth) { this.lineWidth = lineWidth; } @@ -219,7 +219,7 @@ /** * @param miterLimit The miterLimit to set. */ - public void setMiterLimit(PSNumber miterLimit) { + public void setMiterLimit(final PSNumber miterLimit) { this.miterLimit = miterLimit; } @@ -233,7 +233,7 @@ /** * @param ctm The ctm to set. */ - public void setCTM(PSMatrix ctm) { + public void setCTM(final PSMatrix ctm) { this.ctm = ctm; } @@ -247,7 +247,7 @@ /** * @param font The font to set. */ - public void setFont(PSDictionary font) { + public void setFont(final PSDictionary font) { this.font = font; } @@ -263,7 +263,7 @@ return PSObject.PSOBJ_GSTATE; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSGraphicsState) { return true; } @@ -279,7 +279,7 @@ * requirements of the copy operator. * @param copyFrom */ - protected void copy(PSGraphicsState copyFrom) { + protected void copy(final PSGraphicsState copyFrom) { this.colorSpaceDeviceGray = copyFrom.colorSpaceDeviceGray; this.colorSpaceDeviceRGB = copyFrom.colorSpaceDeviceRGB; this.colorSpaceDeviceCMYK = copyFrom.colorSpaceDeviceCMYK; Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSInputFile.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSInputFile.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSInputFile.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -43,7 +43,7 @@ * to the PSInterpreter. * @throws IOException If the file cannot be opened for use. */ - public PSInputFile(File psFile) throws IOException { + public PSInputFile(final File psFile) throws IOException { this.in = new java.io.BufferedInputStream (new java.io.FileInputStream(psFile)); } @@ -52,12 +52,12 @@ * {@inheritDoc} */ public byte[] providePostScriptInput() throws IOException { - byte[] buf = new byte[2048]; - int bytesRead = in.read(buf); + final byte[] buf = new byte[2048]; + final int bytesRead = in.read(buf); if (bytesRead <= 0) { return null; } - byte[] trimmed = new byte[bytesRead]; + final byte[] trimmed = new byte[bytesRead]; System.arraycopy(buf, 0, trimmed, 0, bytesRead); return trimmed; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSInteger.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSInteger.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSInteger.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -34,7 +34,7 @@ int value; - public PSInteger(PSInterpreter interpreter, int value) { + public PSInteger(final PSInterpreter interpreter, final int value) { super(interpreter); this.value = value; } @@ -47,8 +47,8 @@ * @return A PSInteger instance if value is within the PS architectural * limits, or a PSReal instance otherwise. */ - public static PSNumber makePSNumber(PSInterpreter interpreter, - long value) { + public static PSNumber makePSNumber(final PSInterpreter interpreter, + final long value) { if (value > PS_LARGEST_INTEGER || value < PS_SMALLEST_INTEGER) { return new PSReal(interpreter, value); @@ -63,7 +63,8 @@ * a PSInteger instance. * @return A PSInteger instance, if the input qualifies, otherwise, null. */ - public static PSInteger create(PSInterpreter interpreter, byte[] input) { + public static PSInteger create(final PSInterpreter interpreter, + final byte[] input) { // First char must be a digit or a sign indicator if (!isNumeral(input[0]) && !isMember(PSInterpreter.SIGN_INDICATOR, input[0])) { @@ -105,8 +106,8 @@ * a PSInteger instance. * @return A PSInteger instance, if the input qualifies, otherwise, null. */ - private static PSInteger parseRadixNumber(PSInterpreter interpreter, - byte[] input) { + private static PSInteger parseRadixNumber(final PSInterpreter interpreter, + final byte[] input) { // Every char must be a digit, a letter, or a # sign for (int i = 0; i < input.length; i++) { if (!isNumeral(input[i]) @@ -155,7 +156,7 @@ int value = 0; place = 0; for (int i = input.length - 1; i > delimiterMark; i--) { - byte placeValue = getPlaceValue(base, input[i]); + final byte placeValue = getPlaceValue(base, input[i]); // Make sure the digit is valid for this base if (placeValue < 0) { return null; @@ -176,7 +177,7 @@ * @return The base-10 integral value of this digit in this base, or a -1 * if the digit is not valid in this base. */ - private static byte getPlaceValue(byte base, byte input) { + private static byte getPlaceValue(final byte base, byte input) { // Normalize the letters to be all caps if (input >= 0x61 && input <= 0x7a) { input -= 0x20; @@ -214,14 +215,14 @@ return PSObject.PSOBJ_INTEGER; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSInteger || object instanceof PSReal) { return true; } return false; } - public int compareTo(Object object) { + public int compareTo(final Object object) { PSObject psobject = null; if (object instanceof PSObject) { psobject = (PSObject) object; @@ -232,7 +233,7 @@ return -127; } if (psobject instanceof PSInteger) { - PSInteger psinteger = (PSInteger) psobject; + final PSInteger psinteger = (PSInteger) psobject; if (this.value == psinteger.value) { return 0; } else if (this.value < psinteger.value) { @@ -242,7 +243,7 @@ } } if (psobject instanceof PSReal) { - PSReal psreal = (PSReal) psobject; + final PSReal psreal = (PSReal) psobject; if (this.value == psreal.value) { return 0; } else if (this.value < psreal.value) { @@ -254,7 +255,7 @@ return -127; } - public boolean equals(Object object) { + public boolean equals(final Object object) { if (this.compareTo(object) == 0) { return true; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -156,7 +156,7 @@ * @param input The PSInput instance that should be used as standard input * to the interpreter. */ - public PSInterpreter(Log logger, PSInput input, + public PSInterpreter(final Log logger, final PSInput input, PSSystemDict systemDict) throws PSException { if (input == null) { logger.error("PostScript Error: No standard input."); @@ -230,12 +230,13 @@ */ public void process() throws PSException { while (executionStack.size() != 0) { - PSObject currentExecution = executionStack.peek(); + final PSObject currentExecution = executionStack.peek(); processItem(currentExecution); } } - public void processItem(PSObject currentExecution) throws PSException { + public void processItem(final PSObject currentExecution) + throws PSException { if (currentExecution instanceof PSFile) { executePSFile((PSFile) currentExecution); return; @@ -251,9 +252,9 @@ return; } if (currentExecution instanceof PSOperator) { - PSOperator operator = (PSOperator) currentExecution; + final PSOperator operator = (PSOperator) currentExecution; executionStack.pop(); - boolean completed = operator.execute(); + final boolean completed = operator.execute(); if (! completed) { logger.error("Internal PostScript error: Unsupported operator: " + PSOperator.mapEnumToName(operator.operatorEnum)); @@ -270,7 +271,7 @@ * @param file * @throws PSException */ - private void executePSFile(PSFile file) throws PSException { + private void executePSFile(final PSFile file) throws PSException { if (! file.fileIsOpen) { executionStack.pop(); return; @@ -278,7 +279,7 @@ byte byteToConsume = 0; try { byteToConsume = file.provideInput(); - } catch (IOException e) { + } catch (final IOException e) { file.closeFile(); return; } @@ -292,7 +293,7 @@ * @param array * @throws PSException */ - private void executePSArray(PSArray array) throws PSException { + private void executePSArray(final PSArray array) throws PSException { if (array.qtyUnexecutedItems() < 1) { executionStack.pop(); return; @@ -317,7 +318,8 @@ return; } - private void executePSArrayItem(PSObject arrayItem) throws PSException { + private void executePSArrayItem(final PSObject arrayItem) + throws PSException { if (arrayItem == null) { executionStack.pop(); return; @@ -329,7 +331,7 @@ processToken(arrayItem); } - private void adjustCounters(byte inputByte) { + private void adjustCounters(final byte inputByte) { switch (inputByte) { case CARRIAGE_RETURN: { this.currentLine ++; @@ -353,7 +355,7 @@ * to be processed normally when a self-delimiting character is found. * See PSLRM2 3.2.2, where such characters are listed as self-delimiting. */ - private void autoDelimitByte(byte inputByte) throws PSException { + private void autoDelimitByte(final byte inputByte) throws PSException { if (inCommentLine) { return; } @@ -371,9 +373,9 @@ case RIGHT_CURLY: case SLASH: case PERCENT: - int oldExecutionStackSize = executionStack.size(); + final int oldExecutionStackSize = executionStack.size(); consumeToken(); - int newExecutionStackSize = executionStack.size(); + final int newExecutionStackSize = executionStack.size(); /* * If the execution stack size increased as a result of the * consumeToken(), we need to @@ -381,7 +383,7 @@ if (newExecutionStackSize > oldExecutionStackSize) { assert newExecutionStackSize == oldExecutionStackSize + 1: "More than 1 item added to Execution Stack."; - PSObject currentExecution = executionStack.peek(); + final PSObject currentExecution = executionStack.peek(); // Warning: This is recursive. We are already inside this. processItem(currentExecution); } @@ -392,7 +394,7 @@ } } - public void consumeByte(byte inputByte) throws PSException { + public void consumeByte(final byte inputByte) throws PSException { /* * Uncomment the following line to have the input font sent to std out. * This is useful for debugging filtered or encrypted PostScript input. @@ -421,14 +423,16 @@ case LEFT_PAREN: inString = true; break; - case LEFT_BRACKET: - PSName nameObject = new PSName(this, "[", true, false); + case LEFT_BRACKET: { + final PSName nameObject = new PSName(this, "[", true, false); processToken(nameObject); break; - case RIGHT_BRACKET: - nameObject = new PSName(this, "]", true, false); + } + case RIGHT_BRACKET: { + final PSName nameObject = new PSName(this, "]", true, false); processToken(nameObject); break; + } case LEFT_CURLY: // Check for a nested procedure if (inProcedure) { @@ -441,11 +445,12 @@ break; case RIGHT_CURLY: // Convert procedureBeingBuilt into a PSArray - Object[] procedureArray = new Object[procedureBeingBuilt.size()]; + final Object[] procedureArray = + new Object[procedureBeingBuilt.size()]; for (int i = 0; i < procedureArray.length; i++) { procedureArray[i] = procedureBeingBuilt.get(i); } - PSArray newArray = new PSArray(this, procedureArray, true); + final PSArray newArray = new PSArray(this, procedureArray, true); /* * If there is anything on the procedureStack, pop the top item off * and that is now the procedureBeingBuilt. @@ -477,7 +482,7 @@ } } - private void consumeByteInCommentLine(byte inputByte) { + private void consumeByteInCommentLine(final byte inputByte) { /* See PSLRM2, Section 3.2.2, Subsection "Comments". */ switch (inputByte) { case CARRIAGE_RETURN: @@ -489,7 +494,7 @@ } } - private void consumeByteInString(byte inputByte) throws PSException { + private void consumeByteInString(final byte inputByte) throws PSException { switch (inputByte) { case LEFT_PAREN: qtyNestedParentheses ++; @@ -502,7 +507,7 @@ break; } inString = false; - PSString stringObject = new PSString(this, + final PSString stringObject = new PSString(this, stringBeingBuilt.toString()); processToken(stringObject); stringBeingBuilt = new StringBuffer(); @@ -512,11 +517,11 @@ } } - private void addToString(byte inputByte) { + private void addToString(final byte inputByte) { stringBeingBuilt.append((char) inputByte); } - private void appendToToken(byte inputByte) { + private void appendToToken(final byte inputByte) { /* * TODO: Should probably throw an exception here */ @@ -532,7 +537,7 @@ return; } // Copy the token to a new byte array - byte[] token = new byte[tokenBeingBuiltSize]; + final byte[] token = new byte[tokenBeingBuiltSize]; System.arraycopy(tokenBeingBuilt, 0, token, 0, tokenBeingBuiltSize); // Initialize tokenBeingBuilt and related items for next token tokenBeingBuiltSize = 0; @@ -556,7 +561,7 @@ processToken(object); } - private void processToken(PSObject object) throws PSException { + private void processToken(final PSObject object) throws PSException { if (inProcedure) { procedureBeingBuilt.add(object); return; @@ -573,7 +578,7 @@ operandStack.push(object); } - private void processName(PSName nameObject) throws PSException { + private void processName(final PSName nameObject) throws PSException { // If the name is not executable, just push it onto the stack. if (! nameObject.isExecutable) { operandStack.push(nameObject); @@ -592,11 +597,11 @@ } } - protected PSObject find(PSObject key) { + protected PSObject find(final PSObject key) { PSDictionary currentDict = null; for (int i = 0; i < dictionaryStack.size(); i++) { currentDict = (PSDictionary) (dictionaryStack.peek(i)); - PSObject value = currentDict.getItem(key); + final PSObject value = currentDict.getItem(key); if (value != null) { return value; } @@ -609,7 +614,7 @@ * @param key String containing the name of the item to be found. * @return The PSObject that is stored with key. */ - public PSObject find(String key) { + public PSObject find(final String key) { return find(new PSName(this, key, false, false)); } @@ -626,7 +631,7 @@ } public PSDictionary getFontDirectory() { - PSDictionary systemDict = getSystemDict(); + final PSDictionary systemDict = getSystemDict(); if (systemDict == null) { return null; } @@ -657,7 +662,7 @@ return this.currentGraphicsState; } - public void setGraphicsState(PSGraphicsState graphicsState) { + public void setGraphicsState(final PSGraphicsState graphicsState) { this.currentGraphicsState = graphicsState; } @@ -665,7 +670,7 @@ return this.packingMode; } - public void setPackingMode(boolean newPackingMode) { + public void setPackingMode(final boolean newPackingMode) { this.packingMode = newPackingMode; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSMark.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSMark.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSMark.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -29,7 +29,7 @@ */ public class PSMark extends PSObject { - public PSMark(PSInterpreter interpreter) { + public PSMark(final PSInterpreter interpreter) { super(interpreter); } @@ -45,7 +45,7 @@ return PSObject.PSOBJ_MARK; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSMark) { return true; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSMatrix.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSMatrix.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSMatrix.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -37,8 +37,8 @@ * @param value * @param executable */ - public PSMatrix(PSInterpreter interpreter, PSNumber[] value, - boolean executable) { + public PSMatrix(final PSInterpreter interpreter, final PSNumber[] value, + final boolean executable) { super(interpreter, value, executable); } @@ -46,16 +46,16 @@ return (PSNumber[]) this.value; } - public void setMatrixValue(PSNumber[] newMatrixValue) { + public void setMatrixValue(final PSNumber[] newMatrixValue) { this.value = newMatrixValue; } - protected static PSMatrix identMatrix(PSInterpreter interpreter, - PSMatrix matrix) { - PSReal real1 = new PSReal(interpreter, 1.0); - PSReal real0 = new PSReal(interpreter, 0.0); - PSNumber[] insideArray = new PSReal[] { real1, real0, real0, real1, - real0, real0 }; + protected static PSMatrix identMatrix(final PSInterpreter interpreter, + final PSMatrix matrix) { + final PSReal real1 = new PSReal(interpreter, 1.0); + final PSReal real0 = new PSReal(interpreter, 0.0); + final PSNumber[] insideArray = new PSReal[] { real1, real0, real0, + real1, real0, real0 }; if (matrix == null) { return new PSMatrix(interpreter, insideArray, false); } @@ -68,7 +68,7 @@ * @param point The point to be transformed. * @return The transformed point. */ - public Point2D transform(Point2D point) { + public Point2D transform(final Point2D point) { /* TODO: This is just a stub. This should transform the point and * returned a transformed value instead of just copying the one * given. */ @@ -80,7 +80,7 @@ * @param point The point to be inverse transformed. * @return The transformed point. */ - public Point2D inverseTransform(Point2D point) { + public Point2D inverseTransform(final Point2D point) { /* TODO: This is just a stub. This should transform the point and * returned a transformed value instead of just copying the one * given. */ @@ -92,7 +92,7 @@ * @param distanceVector The distance vector to be delta transformed. * @return The transformed point. */ - public Dimension2D deltaTransform(Dimension2D distanceVector) { + public Dimension2D deltaTransform(final Dimension2D distanceVector) { /* TODO: This is just a stub. This should transform the Dimension and * returned a transformed Dimension instead of just copying the one * given. */ @@ -105,7 +105,7 @@ * @param distanceVector The distance vector to be delta transformed. * @return The transformed point. */ - public Dimension2D inverseDeltaTransform(Dimension2D distanceVector) { + public Dimension2D inverseDeltaTransform(final Dimension2D distanceVector) { /* TODO: This is just a stub. This should transform the Dimension and * returned a transformed Dimension instead of just copying the one * given. */ @@ -121,8 +121,9 @@ * @throws PSException If either matrix1 or matrix2 are not exactly 6 * elements long. */ - public static PSNumber[] concatMatrices(PSInterpreter interpreter, - PSNumber[] matrix1, PSNumber[] matrix2) throws PSException { + public static PSNumber[] concatMatrices(final PSInterpreter interpreter, + final PSNumber[] matrix1, final PSNumber[] matrix2) + throws PSException { if (matrix1.length != 6) { throw new PSException(interpreter, PSErrorDict.RANGECHECK); } @@ -132,9 +133,10 @@ return matrix1; } - public static PSNumber[] makeTranslateMatrix(PSInterpreter interpreter, - PSNumber x, PSNumber y) { - PSNumber[] returnArray = new PSNumber[6]; + public static PSNumber[] makeTranslateMatrix( + final PSInterpreter interpreter, final PSNumber x, + final PSNumber y) { + final PSNumber[] returnArray = new PSNumber[6]; returnArray[0] = new PSInteger(interpreter, 1); returnArray[1] = new PSInteger(interpreter, 0); returnArray[2] = new PSInteger(interpreter, 0); Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSName.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSName.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSName.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -33,8 +33,8 @@ boolean isExecutable; boolean isImmediatelyEvaluated; - public PSName(PSInterpreter interpreter, String value, boolean executable, - boolean immediatelyEvaluated) { + public PSName(final PSInterpreter interpreter, final String value, + final boolean executable, final boolean immediatelyEvaluated) { super(interpreter); this.value = value; this.isExecutable = executable; @@ -48,7 +48,8 @@ * a PSName instance. * @return A PSName instance, if the input qualifies, otherwise, null. */ - public static PSName create(PSInterpreter interpreter, byte[] input) { + public static PSName create(final PSInterpreter interpreter, + final byte[] input) { /* * There is not really much validation work to do here that we know of. * The input should be checked first to see whether it is a valid @@ -56,11 +57,11 @@ */ if (input[0] == PSInterpreter.SLASH && input[1] == PSInterpreter.SLASH) { - String name = new String(input, 2, input.length - 2); + final String name = new String(input, 2, input.length - 2); return new PSName(interpreter, name, false, true); } if (input[0] == PSInterpreter.SLASH) { - String name = new String(input, 1, input.length - 1); + final String name = new String(input, 1, input.length - 1); return new PSName(interpreter, name, false, false); } return new PSName(interpreter, new String(input), true, false); @@ -76,26 +77,26 @@ isImmediatelyEvaluated); } - public boolean equals(Object anObject) { + public boolean equals(final Object anObject) { if (this == anObject) { return true; } if (anObject instanceof PSName) { - PSName psNameObject = (PSName) anObject; + final PSName psNameObject = (PSName) anObject; if (psNameObject.value.equals(this.value)) { return true; } return false; } if (anObject instanceof PSString) { - PSString psStringObject = (PSString) anObject; + final PSString psStringObject = (PSString) anObject; if (psStringObject.value.equals(this.value)) { return true; } return false; } if (anObject instanceof String) { - String string = (String) anObject; + final String string = (String) anObject; if (string.equals(this.value)) { return true; } @@ -112,7 +113,7 @@ return PSObject.PSOBJ_NAME; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSName || object instanceof PSString) { return true; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSNumber.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSNumber.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSNumber.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -34,7 +34,7 @@ /** * @param interpreter */ - public PSNumber(PSInterpreter interpreter) { + public PSNumber(final PSInterpreter interpreter) { super(interpreter); } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSObject.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSObject.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSObject.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -57,7 +57,7 @@ private byte access = ACCESS_UNLIMITED; - protected PSObject(PSInterpreter interpreter) { + protected PSObject(final PSInterpreter interpreter) { this.interpreter = interpreter; } @@ -67,7 +67,7 @@ * @return True if the input byte represents an ASCII numeral, * false otherwise. */ - protected static boolean isNumeral(byte input) { + protected static boolean isNumeral(final byte input) { if (input < 0x30) { return false; } @@ -83,7 +83,7 @@ * @return True if the input byte represents an character in the range A-Z * or a-z, false otherwise. */ - protected static boolean isAlphabetic(byte input) { + protected static boolean isAlphabetic(final byte input) { if (input >= 0x41 && input <= 0x5a) { return true; } @@ -99,7 +99,7 @@ * @param input The byte to be tested. * @return True if input is a member of testSet, otherwise false. */ - protected static boolean isMember(byte[] testSet, byte input) { + protected static boolean isMember(final byte[] testSet, final byte input) { for (int i = 0; i < testSet.length; i++) { if (input == testSet[i]) { return true; @@ -125,7 +125,7 @@ return false; } - protected void setAccess(byte accessLevel) throws PSException { + protected void setAccess(final byte accessLevel) throws PSException { // Can access be changed on this object? if (! isComposite()) { throw new PSException (this.interpreter, PSErrorDict.TYPECHECK, -1); Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSOperator.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSOperator.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSOperator.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -751,8 +751,8 @@ PSDictionary dictionary; short operatorEnum; - public PSOperator(PSInterpreter interpreter, PSDictionary dictionary, - short operatorEnum) { + public PSOperator(final PSInterpreter interpreter, + final PSDictionary dictionary, final short operatorEnum) { super(interpreter); this.dictionary = dictionary; this.operatorEnum = operatorEnum; @@ -775,7 +775,7 @@ * @param name The String to be evaluated. * @return The integer equivalent of <code>name</code>. */ - public static short mapNameToEnum(String name) { + public static short mapNameToEnum(final String name) { return (short) Arrays.binarySearch(operatorNames, name); } @@ -784,7 +784,7 @@ * @param enumeratedOperator The String to be evaluated. * @return The String name of the operator enum. */ - public static String mapEnumToName(short enumeratedOperator) { + public static String mapEnumToName(final short enumeratedOperator) { if (enumeratedOperator < 0 || enumeratedOperator >= operatorNames.length) { return null; @@ -793,11 +793,11 @@ } public boolean execute() throws PSException { - boolean completed = dictionary.executeOperator(operatorEnum); + final boolean completed = dictionary.executeOperator(operatorEnum); return completed; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSOperator) { return true; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSReal.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSReal.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSReal.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -31,7 +31,7 @@ double value; - public PSReal(PSInterpreter interpreter, double value) { + public PSReal(final PSInterpreter interpreter, final double value) { super(interpreter); this.value = value; } @@ -43,7 +43,8 @@ * a PSReal instance. * @return A PSReal instance, if the input qualifies, otherwise, null. */ - public static PSReal create(PSInterpreter interpreter, byte[] input) { + public static PSReal create(final PSInterpreter interpreter, + final byte[] input) { // Every char must be a digit, sign, decimal point, E, or e for (int i = 0; i < input.length; i++) { if (!isNumeral(input[i]) @@ -60,11 +61,11 @@ return null; } // It looks like the java methods might be sufficient here - StringBuffer sb = new StringBuffer(); + final StringBuffer sb = new StringBuffer(); for (int i = 0; i < input.length; i++) { sb.append((char) input[i]); } - double value = Double.valueOf(sb.toString()).doubleValue(); + final double value = Double.valueOf(sb.toString()).doubleValue(); return new PSReal(interpreter, value); } @@ -80,14 +81,14 @@ return PSObject.PSOBJ_REAL; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSInteger || object instanceof PSReal) { return true; } return false; } - public int compareTo(Object object) { + public int compareTo(final Object object) { PSObject psobject = null; if (object instanceof PSObject) { psobject = (PSObject) object; @@ -98,7 +99,7 @@ return -127; } if (psobject instanceof PSInteger) { - PSInteger psinteger = (PSInteger) psobject; + final PSInteger psinteger = (PSInteger) psobject; if (this.value == psinteger.value) { return 0; } else if (this.value < psinteger.value) { @@ -108,7 +109,7 @@ } } if (psobject instanceof PSReal) { - PSReal psreal = (PSReal) psobject; + final PSReal psreal = (PSReal) psobject; if (this.value == psreal.value) { return 0; } else if (this.value < psreal.value) { @@ -120,7 +121,7 @@ return -127; } - public boolean equals(Object object) { + public boolean equals(final Object object) { if (this.compareTo(object) == 0) { return true; } @@ -147,25 +148,25 @@ return "Real: " + Double.toString(this.value); } - public static String doubleOut(Double doubleDown) { + public static String doubleOut(final Double doubleDown) { return doubleOut(doubleDown.doubleValue()); } public static String doubleOut(double doubleDown) { - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); if (doubleDown < 0) { doubleDown = -doubleDown; p.append("-"); } - double trouble = doubleDown % 1; + final double trouble = doubleDown % 1; if (trouble > 0.950) { p.append((int)doubleDown + 1); } else if (trouble < 0.050) { p.append((int)doubleDown); } else { - String doubleString = Double.toString(doubleDown); - int decimal = doubleString.indexOf("."); + final String doubleString = Double.toString(doubleDown); + final int decimal = doubleString.indexOf("."); if (decimal != -1) { p.append(doubleString.substring(0, decimal)); @@ -181,22 +182,22 @@ return (p.toString()); } - public static String doubleOut(double doubleDown, int dec) { + public static String doubleOut(double doubleDown, final int dec) { - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); if (doubleDown < 0) { doubleDown = -doubleDown; p.append("-"); } - double trouble = doubleDown % 1; + final double trouble = doubleDown % 1; if (trouble > (1.0 - (5.0 / (Math.pow(10.0, dec))))) { p.append((int)doubleDown + 1); } else if (trouble < (5.0 / (Math.pow(10.0, dec)))) { p.append((int)doubleDown); } else { - String doubleString = Double.toString(doubleDown); - int decimal = doubleString.indexOf("."); + final String doubleString = Double.toString(doubleDown); + final int decimal = doubleString.indexOf("."); if (decimal != -1) { p.append(doubleString.substring(0, decimal)); Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSStack.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSStack.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSStack.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -44,7 +44,8 @@ private byte stackType = -1; - PSStack(PSInterpreter interpreter, int initialSize, byte stackType) { + PSStack(final PSInterpreter interpreter, final int initialSize, + final byte stackType) { this.interpreter = interpreter; this.list = new ArrayList(initialSize); if (stackType < 2 || stackType > 4) { @@ -58,7 +59,7 @@ * Discards the top element from the stack. * @return The top item from the stack, which was just discarded. */ - public Object popObject(int operatorCode) throws PSException { + public Object popObject(final int operatorCode) throws PSException { switch (stackType) { case STACK_DICTIONARY: { // Don't allow the bottom three items to be popped @@ -74,7 +75,7 @@ } } } - PSObject object = (PSObject) list.remove(list.size() - 1); + final PSObject object = (PSObject) list.remove(list.size() - 1); ... [truncated message content] |