[FOray-commit] SF.net SVN: foray: [8049] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-09-11 17:14:15
|
Revision: 8049
http://svn.sourceforge.net/foray/?rev=8049&view=rev
Author: victormote
Date: 2006-09-11 10:13:48 -0700 (Mon, 11 Sep 2006)
Log Message:
-----------
Enforce "RequireThis" checkstyle check.
Modified Paths:
--------------
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/PSColorSpace.java
trunk/foray/foray-ps/src/java/org/foray/ps/PSDictionary.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/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/PSName.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/PSSystemDict.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04Entry.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12Entry.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingZapfDingbats.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCIIHexFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/EncryptFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/java2d/Java2DSystemDict.java
trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoFrame.java
trunk/foray/scripts/checkstyle-suppressions.xml
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSArray.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSArray.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSArray.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -58,7 +58,7 @@
}
public boolean isExecutable() {
- return executable;
+ return this.executable;
}
public byte getPSObjectType() {
@@ -69,17 +69,17 @@
if (! isExecutable()) {
return null;
}
- if (executionStackIteratorIndex > value.length - 1) {
+ if (this.executionStackIteratorIndex > this.value.length - 1) {
return null;
}
final PSObject nextElement =
- (PSObject) value[executionStackIteratorIndex];
- executionStackIteratorIndex ++;
+ (PSObject) this.value[this.executionStackIteratorIndex];
+ this.executionStackIteratorIndex ++;
return nextElement;
}
public int qtyUnexecutedItems() {
- return value.length - executionStackIteratorIndex;
+ return this.value.length - this.executionStackIteratorIndex;
}
public boolean isComparable(final PSObject object) {
@@ -94,18 +94,18 @@
}
public Object[] getInsideArray() {
- return value;
+ return this.value;
}
public int size() {
- return value.length;
+ return this.value.length;
}
public PSObject get(final int index) {
- if (index < 0 || index > value.length - 1) {
+ if (index < 0 || index > this.value.length - 1) {
return null;
}
- return (PSObject) value[index];
+ return (PSObject) this.value[index];
}
public void resetExecutionStackStatus() {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSBoolean.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSBoolean.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSBoolean.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -41,7 +41,7 @@
}
protected PSObject duplicate() {
- return new PSBoolean(interpreter, value);
+ return new PSBoolean(interpreter, this.value);
}
protected boolean isExecutable() {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSColorSpace.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSColorSpace.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSColorSpace.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -56,15 +56,15 @@
final int type) {
PSName csName = null;
switch (type) {
- case DEVICE_GRAY: {
+ case PSColorSpace.DEVICE_GRAY: {
csName = new PSName(interpreter, "DeviceGray", false, false);
return new PSColorSpace(interpreter, new Object[] {csName});
}
- case DEVICE_RGB: {
+ case PSColorSpace.DEVICE_RGB: {
csName = new PSName(interpreter, "DeviceRGB", false, false);
return new PSColorSpace(interpreter, new Object[] {csName});
}
- case DEVICE_CMYK: {
+ case PSColorSpace.DEVICE_CMYK: {
csName = new PSName(interpreter, "DeviceCMYK", false, false);
return new PSColorSpace(interpreter, new Object[] {csName});
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSDictionary.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSDictionary.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -42,7 +42,7 @@
public PSDictionary(final PSInterpreter interpreter,
final int initialSize) {
super(interpreter);
- dictionary = new HashMap(initialSize);
+ this.dictionary = new HashMap(initialSize);
}
/**
@@ -99,26 +99,26 @@
* We are relying here on proper equals() methods, primarily in the
* PSName and PSString classes.
*/
- dictionary.put(key, value);
+ this.dictionary.put(key, value);
}
public PSObject getItem(final PSObject key) {
- final Iterator iter = dictionary.keySet().iterator();
+ final Iterator iter = this.dictionary.keySet().iterator();
while (iter.hasNext()) {
final PSObject currentKey = (PSObject) iter.next();
if (currentKey.equals(key)) {
- return (PSObject) dictionary.get(currentKey);
+ return (PSObject) this.dictionary.get(currentKey);
}
}
return null;
}
public PSObject getItem(final String key) {
- final Iterator iter = dictionary.keySet().iterator();
+ final Iterator iter = this.dictionary.keySet().iterator();
while (iter.hasNext()) {
final PSObject currentKey = (PSObject) iter.next();
if (currentKey.equals(key)) {
- return (PSObject) dictionary.get(currentKey);
+ return (PSObject) this.dictionary.get(currentKey);
}
}
return null;
@@ -179,7 +179,7 @@
}
public Map getMap() {
- return dictionary;
+ return this.dictionary;
}
public int size() {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSException.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSException.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSException.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -76,16 +76,17 @@
if (this.errorCode < 0
|| this.errorCode > PSErrorDict.ERROR_NAMES.length - 1) {
sb.append("PS Interpeter threw invalid PostScript error: ");
- sb.append(errorCode);
+ sb.append(this.errorCode);
} else {
sb.append("PostScript error: ");
- sb.append(PSErrorDict.ERROR_NAMES[errorCode]);
+ sb.append(PSErrorDict.ERROR_NAMES[this.errorCode]);
sb.append(" (operator: ");
- if (offendingOperator < 1
- || offendingOperator > PSOperator.OPERATOR_NAMES.length) {
+ if (this.offendingOperator < 1
+ || this.offendingOperator
+ > PSOperator.OPERATOR_NAMES.length) {
sb.append("unknown");
} else {
- sb.append(PSOperator.OPERATOR_NAMES[offendingOperator]);
+ sb.append(PSOperator.OPERATOR_NAMES[this.offendingOperator]);
}
sb.append(") ");
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSFile.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSFile.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSFile.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -75,41 +75,42 @@
}
protected byte provideInput() throws IOException, PSException {
- if (chunk == null || chunk.length == 0
- || chunkIndex > chunk.length - 1) {
- chunk = getNextChunk();
- chunkIndex = 0;
- if (chunk == null || chunk.length == 0
- || chunkIndex > chunk.length - 1) {
+ if (this.chunk == null || this.chunk.length == 0
+ || this.chunkIndex > this.chunk.length - 1) {
+ this.chunk = getNextChunk();
+ this.chunkIndex = 0;
+ if (this.chunk == null || this.chunk.length == 0
+ || this.chunkIndex > this.chunk.length - 1) {
closeFile();
return 0x00;
}
}
- chunkIndex ++;
- return chunk[chunkIndex - 1];
+ this.chunkIndex ++;
+ return this.chunk[this.chunkIndex - 1];
}
protected abstract byte[] getNextChunk() throws IOException;
protected void closeFile() throws PSException {
- fileIsOpen = false;
- if (popDictionaryStack) {
+ this.fileIsOpen = false;
+ if (this.popDictionaryStack) {
interpreter.getDictionaryStack().pop(-1);
}
}
protected byte[] getRemainingChunk() {
- if (chunk == null) {
+ if (this.chunk == null) {
return null;
}
- final int arraySize = chunk.length - chunkIndex;
+ final int arraySize = this.chunk.length - this.chunkIndex;
if (arraySize < 1) {
return null;
}
final byte[] remainingChunk = new byte[arraySize];
- System.arraycopy(chunk, chunkIndex, remainingChunk, 0, arraySize);
+ System.arraycopy(this.chunk, this.chunkIndex, remainingChunk, 0,
+ arraySize);
// Advance the index past the boundary
- chunkIndex = chunk.length;
+ this.chunkIndex = this.chunk.length;
return remainingChunk;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSFileFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSFileFilter.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSFileFilter.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -75,13 +75,13 @@
return tempChunk;
}
// Get the chunk from the underlying file
- if (underlyingFile != null) {
- tempChunk = underlyingFile.getNextChunk();
- } else if (underlyingString != null) {
- tempChunk = underlyingString.value.getBytes();
+ if (this.underlyingFile != null) {
+ tempChunk = this.underlyingFile.getNextChunk();
+ } else if (this.underlyingString != null) {
+ tempChunk = this.underlyingString.value.getBytes();
}
try {
- return filter.decode(tempChunk);
+ return this.filter.decode(tempChunk);
} 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-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSFileReal.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -66,9 +66,9 @@
if (tempChunk != null) {
return tempChunk;
}
- if (input != null) {
- tempChunk = input.providePostScriptInput();
- } else if (value != null) {
+ if (this.input != null) {
+ tempChunk = this.input.providePostScriptInput();
+ } else if (this.value != null) {
// TODO: Handle i/o from real files
tempChunk = null;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSGraphicsState.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSGraphicsState.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSGraphicsState.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -175,7 +175,7 @@
* @return Returns the lineJoin.
*/
public PSInteger getLineJoin() {
- return lineJoin;
+ return this.lineJoin;
}
/**
@@ -189,7 +189,7 @@
* @return Returns the lineCap.
*/
public PSInteger getLineCap() {
- return lineCap;
+ return this.lineCap;
}
/**
@@ -203,7 +203,7 @@
* @return Returns the lineWidth.
*/
public PSNumber getLineWidth() {
- return lineWidth;
+ return this.lineWidth;
}
/**
@@ -217,7 +217,7 @@
* @return Returns the miterLimit.
*/
public PSNumber getMiterLimit() {
- return miterLimit;
+ return this.miterLimit;
}
/**
@@ -231,7 +231,7 @@
* @return Returns the ctm.
*/
public PSMatrix getCTM() {
- return ctm;
+ return this.ctm;
}
/**
@@ -245,7 +245,7 @@
* @return Returns the font.
*/
public PSDictionary getFont() {
- return font;
+ return this.font;
}
/**
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSInputFile.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSInputFile.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSInputFile.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -57,7 +57,7 @@
*/
public byte[] providePostScriptInput() throws IOException {
final byte[] buf = new byte[2048];
- final int bytesRead = in.read(buf);
+ final int bytesRead = this.in.read(buf);
if (bytesRead <= 0) {
return null;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSInteger.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSInteger.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSInteger.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -53,8 +53,8 @@
*/
public static PSNumber makePSNumber(final PSInterpreter interpreter,
final long value) {
- if (value > PS_LARGEST_INTEGER
- || value < PS_SMALLEST_INTEGER) {
+ if (value > PSInteger.PS_LARGEST_INTEGER
+ || value < PSInteger.PS_SMALLEST_INTEGER) {
return new PSReal(interpreter, value);
}
return new PSInteger(interpreter, (int) value);
@@ -208,7 +208,7 @@
}
protected PSObject duplicate() {
- return new PSInteger(interpreter, value);
+ return new PSInteger(interpreter, this.value);
}
protected boolean isExecutable() {
@@ -271,11 +271,11 @@
}
public int getValue() {
- return value;
+ return this.value;
}
public double getDoubleValue() {
- return value;
+ return this.value;
}
public void round() {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -66,16 +66,37 @@
public static final byte PLUS_SIGN = 0x2b;
public static final byte MINUS_SIGN = 0x2d;
- public static final byte[] WHITESPACE = { NULL, TAB, LINE_FEED, FORM_FEED,
- CARRIAGE_RETURN, SPACE };
+ public static final byte[] WHITESPACE = {
+ PSInterpreter.NULL,
+ PSInterpreter.TAB,
+ PSInterpreter.LINE_FEED,
+ PSInterpreter.FORM_FEED,
+ PSInterpreter.CARRIAGE_RETURN,
+ PSInterpreter.SPACE,
+ };
- public static final byte[] NEWLINE = { LINE_FEED, CARRIAGE_RETURN };
+ public static final byte[] NEWLINE = {
+ PSInterpreter.LINE_FEED,
+ PSInterpreter.CARRIAGE_RETURN,
+ };
- public static final byte[] DELIMITER = { LEFT_PAREN, RIGHT_PAREN,
- LEFT_ANGLE, RIGHT_ANGLE, LEFT_BRACKET, RIGHT_BRACKET, LEFT_CURLY,
- RIGHT_CURLY, SLASH, PERCENT };
+ public static final byte[] DELIMITER = {
+ PSInterpreter.LEFT_PAREN,
+ PSInterpreter.RIGHT_PAREN,
+ PSInterpreter.LEFT_ANGLE,
+ PSInterpreter.RIGHT_ANGLE,
+ PSInterpreter.LEFT_BRACKET,
+ PSInterpreter.RIGHT_BRACKET,
+ PSInterpreter.LEFT_CURLY,
+ PSInterpreter.RIGHT_CURLY,
+ PSInterpreter.SLASH,
+ PSInterpreter.PERCENT,
+ };
- public static final byte[] SIGN_INDICATOR = { PLUS_SIGN, MINUS_SIGN };
+ public static final byte[] SIGN_INDICATOR = {
+ PSInterpreter.PLUS_SIGN,
+ PSInterpreter.MINUS_SIGN,
+ };
public static final int MAX_ARRAY_SIZE = 65535;
protected Log logger;
@@ -168,9 +189,9 @@
}
this.logger = logger;
// Create the standard input file.
- standardInput = new PSFileReal(this, input);
+ this.standardInput = new PSFileReal(this, input);
// Place it on the execution stack.
- executionStack.push(standardInput);
+ this.executionStack.push(this.standardInput);
// Get the System Dictionary.
if (systemDict == null) {
systemDict = new ReadOnlySystemDict(this);
@@ -190,7 +211,7 @@
array = new PSArray(this, encoding.getGlyphList(), false);
systemDict.addItem(name, array);
// Add the System Dictionary to the dictionary stack.
- dictionaryStack.push(systemDict);
+ this.dictionaryStack.push(systemDict);
/*
* Add "systemdict" as an entry in itself. See PLRM2, Section 8.2,
* "systemdict" entry. It is not an operator, but is an element in the
@@ -200,7 +221,7 @@
systemDict.addItem(name, systemDict);
// Create a Global Dictionary & push it on the dictionary Stack.
PSDictionary newDict = new PSDictionary(this, 0);
- dictionaryStack.push(newDict);
+ this.dictionaryStack.push(newDict);
/*
* Add "globaldict" as an entry in systemdict. See PLRM2, Section 8.2,
* "globaldict" entry. It is not an operator, but is an element in the
@@ -210,7 +231,7 @@
systemDict.addItem(name, newDict);
// Create a User Dictionary & push it on the dictionary Stack.
newDict = new PSDictionary(this, 0);
- dictionaryStack.push(newDict);
+ this.dictionaryStack.push(newDict);
/*
* Add "userdict" as an entry in systemdict. See PLRM2, Section 8.2,
* "userdict" entry. It is not an operator, but is an element in the
@@ -233,8 +254,8 @@
* @throws PSException
*/
public void process() throws PSException {
- while (executionStack.size() != 0) {
- final PSObject currentExecution = executionStack.peek();
+ while (this.executionStack.size() != 0) {
+ final PSObject currentExecution = this.executionStack.peek();
processItem(currentExecution);
}
}
@@ -251,24 +272,25 @@
return;
}
if (currentExecution instanceof PSName) {
- executionStack.pop();
+ this.executionStack.pop();
processName((PSName) currentExecution);
return;
}
if (currentExecution instanceof PSOperator) {
final PSOperator operator = (PSOperator) currentExecution;
- executionStack.pop();
+ this.executionStack.pop();
final boolean completed = operator.execute();
if (! completed) {
- logger.error("Internal PostScript error: Unsupported operator: "
+ this.logger.error("Internal PostScript error: "
+ + "Unsupported operator: "
+ PSOperator.mapEnumToName(operator.operatorEnum));
}
return;
}
// If anything else, log an error & pop the item
- logger.error("Internal PostScript error: invalid item on execution "
- + "stack.");
- executionStack.pop();
+ this.logger.error("Internal PostScript error: invalid item on "
+ + "execution stack.");
+ this.executionStack.pop();
}
/**
@@ -277,7 +299,7 @@
*/
private void executePSFile(final PSFile file) throws PSException {
if (! file.fileIsOpen) {
- executionStack.pop();
+ this.executionStack.pop();
return;
}
byte byteToConsume = 0;
@@ -299,7 +321,7 @@
*/
private void executePSArray(final PSArray array) throws PSException {
if (array.qtyUnexecutedItems() < 1) {
- executionStack.pop();
+ this.executionStack.pop();
return;
}
PSObject object = null;
@@ -311,7 +333,7 @@
*/
if (array.qtyUnexecutedItems() == 1) {
object = array.getNextProcedureItem();
- executionStack.pop();
+ this.executionStack.pop();
/* Reset status so it can be placed on the execution stack
* later. */
array.resetExecutionStackStatus();
@@ -325,11 +347,11 @@
private void executePSArrayItem(final PSObject arrayItem)
throws PSException {
if (arrayItem == null) {
- executionStack.pop();
+ this.executionStack.pop();
return;
}
if (arrayItem instanceof PSArray) {
- operandStack.push(arrayItem);
+ this.operandStack.push(arrayItem);
return;
}
processToken(arrayItem);
@@ -337,13 +359,13 @@
private void adjustCounters(final byte inputByte) {
switch (inputByte) {
- case CARRIAGE_RETURN: {
+ case PSInterpreter.CARRIAGE_RETURN: {
this.currentLine ++;
this.currentColumn = 1;
break;
}
- case LINE_FEED: {
- if (this.lastByteParsed != CARRIAGE_RETURN) {
+ case PSInterpreter.LINE_FEED: {
+ if (this.lastByteParsed != PSInterpreter.CARRIAGE_RETURN) {
this.currentLine ++;
this.currentColumn = 1;
}
@@ -362,26 +384,26 @@
* See PSLRM2 3.2.2, where such characters are listed as self-delimiting.
*/
private void autoDelimitByte(final byte inputByte) throws PSException {
- if (inCommentLine) {
+ if (this.inCommentLine) {
return;
}
- if (inString) {
+ if (this.inString) {
return;
}
switch (inputByte) {
- case LEFT_PAREN:
- case RIGHT_PAREN: // RIGHT_PAREN should never happen
- case LEFT_ANGLE:
- case RIGHT_ANGLE:
- case LEFT_BRACKET:
- case RIGHT_BRACKET:
- case LEFT_CURLY:
- case RIGHT_CURLY:
- case SLASH:
- case PERCENT:
- final int oldExecutionStackSize = executionStack.size();
+ case PSInterpreter.LEFT_PAREN:
+ case PSInterpreter.RIGHT_PAREN: // RIGHT_PAREN should never happen
+ case PSInterpreter.LEFT_ANGLE:
+ case PSInterpreter.RIGHT_ANGLE:
+ case PSInterpreter.LEFT_BRACKET:
+ case PSInterpreter.RIGHT_BRACKET:
+ case PSInterpreter.LEFT_CURLY:
+ case PSInterpreter.RIGHT_CURLY:
+ case PSInterpreter.SLASH:
+ case PSInterpreter.PERCENT:
+ final int oldExecutionStackSize = this.executionStack.size();
consumeToken();
- final int newExecutionStackSize = executionStack.size();
+ final int newExecutionStackSize = this.executionStack.size();
/*
* If the execution stack size increased as a result of the
* consumeToken(), we need to
@@ -389,7 +411,7 @@
if (newExecutionStackSize > oldExecutionStackSize) {
assert newExecutionStackSize == oldExecutionStackSize + 1 :
"More than 1 item added to Execution Stack.";
- final PSObject currentExecution = executionStack.peek();
+ final PSObject currentExecution = this.executionStack.peek();
// Warning: This is recursive. We are already inside this.
processItem(currentExecution);
}
@@ -406,79 +428,79 @@
* This is useful for debugging filtered or encrypted PostScript input.
*/
// System.out.print((char) inputByte);
- if (inCommentLine) {
+ if (this.inCommentLine) {
consumeByteInCommentLine(inputByte);
return;
}
- if (inString) {
+ if (this.inString) {
consumeByteInString(inputByte);
return;
}
switch (inputByte) {
- case PERCENT:
- inCommentLine = true;
+ case PSInterpreter.PERCENT:
+ this.inCommentLine = true;
break;
- case CARRIAGE_RETURN:
- case LINE_FEED:
- case NULL:
- case TAB:
- case FORM_FEED:
- case SPACE:
+ case PSInterpreter.CARRIAGE_RETURN:
+ case PSInterpreter.LINE_FEED:
+ case PSInterpreter.NULL:
+ case PSInterpreter.TAB:
+ case PSInterpreter.FORM_FEED:
+ case PSInterpreter.SPACE:
consumeToken();
break;
- case LEFT_PAREN:
- inString = true;
+ case PSInterpreter.LEFT_PAREN:
+ this.inString = true;
break;
- case LEFT_BRACKET: {
+ case PSInterpreter.LEFT_BRACKET: {
final PSName nameObject = new PSName(this, "[", true, false);
processToken(nameObject);
break;
}
- case RIGHT_BRACKET: {
+ case PSInterpreter.RIGHT_BRACKET: {
final PSName nameObject = new PSName(this, "]", true, false);
processToken(nameObject);
break;
}
- case LEFT_CURLY:
+ case PSInterpreter.LEFT_CURLY:
// Check for a nested procedure
- if (inProcedure) {
+ if (this.inProcedure) {
// Push procedureBeingBuilt onto the procedureStack
- procedureStack.add(procedureBeingBuilt);
+ this.procedureStack.add(this.procedureBeingBuilt);
}
// Start a new procedureBeingBuilt
- procedureBeingBuilt = new ArrayList();
- inProcedure = true;
+ this.procedureBeingBuilt = new ArrayList();
+ this.inProcedure = true;
break;
- case RIGHT_CURLY:
+ case PSInterpreter.RIGHT_CURLY:
// Convert procedureBeingBuilt into a PSArray
final Object[] procedureArray =
- new Object[procedureBeingBuilt.size()];
+ new Object[this.procedureBeingBuilt.size()];
for (int i = 0; i < procedureArray.length; i++) {
- procedureArray[i] = procedureBeingBuilt.get(i);
+ procedureArray[i] = this.procedureBeingBuilt.get(i);
}
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.
*/
- if (procedureStack.size() > 0) {
- procedureBeingBuilt = (ArrayList)
- procedureStack.get(procedureStack.size() - 1);
- procedureStack.remove(procedureStack.size() - 1);
+ if (this.procedureStack.size() > 0) {
+ this.procedureBeingBuilt = (ArrayList)
+ this.procedureStack.get(this.procedureStack.size() - 1);
+ this.procedureStack.remove(this.procedureStack.size() - 1);
// Otherwise, make it null.
} else {
- procedureBeingBuilt = null;
+ this.procedureBeingBuilt = null;
}
- if (procedureBeingBuilt == null) {
- operandStack.push(newArray);
+ if (this.procedureBeingBuilt == null) {
+ this.operandStack.push(newArray);
} else {
- procedureBeingBuilt.add(newArray);
+ this.procedureBeingBuilt.add(newArray);
}
- if (procedureBeingBuilt == null) {
- inProcedure = false;
+ if (this.procedureBeingBuilt == null) {
+ this.inProcedure = false;
}
break;
- case SLASH:
+ case PSInterpreter.SLASH:
/*
* Do NOT break at the end, as we want the slash to be part of the
* next token
@@ -491,10 +513,10 @@
private void consumeByteInCommentLine(final byte inputByte) {
/* See PSLRM2, Section 3.2.2, Subsection "Comments". */
switch (inputByte) {
- case CARRIAGE_RETURN:
- case LINE_FEED:
- case FORM_FEED:
- inCommentLine = false;
+ case PSInterpreter.CARRIAGE_RETURN:
+ case PSInterpreter.LINE_FEED:
+ case PSInterpreter.FORM_FEED:
+ this.inCommentLine = false;
break;
default:
}
@@ -502,21 +524,21 @@
private void consumeByteInString(final byte inputByte) throws PSException {
switch (inputByte) {
- case LEFT_PAREN:
- qtyNestedParentheses ++;
+ case PSInterpreter.LEFT_PAREN:
+ this.qtyNestedParentheses ++;
addToString(inputByte);
break;
- case RIGHT_PAREN:
- if (qtyNestedParentheses > 0) {
- qtyNestedParentheses --;
+ case PSInterpreter.RIGHT_PAREN:
+ if (this.qtyNestedParentheses > 0) {
+ this.qtyNestedParentheses --;
addToString(inputByte);
break;
}
- inString = false;
+ this.inString = false;
final PSString stringObject = new PSString(this,
- stringBeingBuilt.toString());
+ this.stringBeingBuilt.toString());
processToken(stringObject);
- stringBeingBuilt = new StringBuffer();
+ this.stringBeingBuilt = new StringBuffer();
break;
default:
addToString(inputByte);
@@ -524,32 +546,33 @@
}
private void addToString(final byte inputByte) {
- stringBeingBuilt.append((char) inputByte);
+ this.stringBeingBuilt.append((char) inputByte);
}
private void appendToToken(final byte inputByte) {
/*
* TODO: Should probably throw an exception here
*/
- if (tokenBeingBuiltSize > tokenBeingBuilt.length - 1) {
+ if (this.tokenBeingBuiltSize > this.tokenBeingBuilt.length - 1) {
return;
}
- tokenBeingBuilt[tokenBeingBuiltSize] = inputByte;
- tokenBeingBuiltSize ++;
+ this.tokenBeingBuilt[this.tokenBeingBuiltSize] = inputByte;
+ this.tokenBeingBuiltSize ++;
}
public void consumeToken() throws PSException {
- if (tokenBeingBuiltSize < 1) {
+ if (this.tokenBeingBuiltSize < 1) {
return;
}
// Copy the token to a new byte array
- final byte[] token = new byte[tokenBeingBuiltSize];
- System.arraycopy(tokenBeingBuilt, 0, token, 0, tokenBeingBuiltSize);
+ final byte[] token = new byte[this.tokenBeingBuiltSize];
+ System.arraycopy(this.tokenBeingBuilt, 0, token, 0,
+ this.tokenBeingBuiltSize);
// Initialize tokenBeingBuilt and related items for next token
- tokenBeingBuiltSize = 0;
+ this.tokenBeingBuiltSize = 0;
// This is probably not really necessary, but seems cleaner.
- for (int i = 0; i < tokenBeingBuilt.length; i++) {
- tokenBeingBuilt[i] = 0x00;
+ for (int i = 0; i < this.tokenBeingBuilt.length; i++) {
+ this.tokenBeingBuilt[i] = 0x00;
}
this.tokenCount ++;
PSObject object = null;
@@ -568,8 +591,8 @@
}
private void processToken(final PSObject object) throws PSException {
- if (inProcedure) {
- procedureBeingBuilt.add(object);
+ if (this.inProcedure) {
+ this.procedureBeingBuilt.add(object);
return;
}
if (object instanceof PSName) {
@@ -577,36 +600,37 @@
return;
}
if (object instanceof PSOperator) {
- executionStack.push(object);
+ this.executionStack.push(object);
return;
}
// Integer or real object
- operandStack.push(object);
+ this.operandStack.push(object);
}
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);
+ this.operandStack.push(nameObject);
return;
}
// Otherwise, execute it.
PSDictionary currentDict = null;
boolean doneExecuting = false;
- for (int i = 0; i < dictionaryStack.size() && !doneExecuting; i++) {
- currentDict = (PSDictionary) (dictionaryStack.peek(i));
+ for (int i = 0; i < this.dictionaryStack.size() && !doneExecuting;
+ i++) {
+ currentDict = (PSDictionary) (this.dictionaryStack.peek(i));
doneExecuting = currentDict.execute(nameObject);
}
if (! doneExecuting) {
- logger.error("PostScript name '" + nameObject.value
+ this.logger.error("PostScript name '" + nameObject.value
+ "' not found.");
}
}
protected PSObject find(final PSObject key) {
PSDictionary currentDict = null;
- for (int i = 0; i < dictionaryStack.size(); i++) {
- currentDict = (PSDictionary) (dictionaryStack.peek(i));
+ for (int i = 0; i < this.dictionaryStack.size(); i++) {
+ currentDict = (PSDictionary) (this.dictionaryStack.peek(i));
final PSObject value = currentDict.getItem(key);
if (value != null) {
return value;
@@ -630,10 +654,11 @@
* @return The system dictionary.
*/
public PSDictionary getSystemDict() {
- if (dictionaryStack.size() < 1) {
+ if (this.dictionaryStack.size() < 1) {
return null;
}
- return (PSDictionary) dictionaryStack.peek(dictionaryStack.size() - 1);
+ return (PSDictionary) this.dictionaryStack.peek(
+ this.dictionaryStack.size() - 1);
}
public PSDictionary getFontDirectory() {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSName.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSName.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSName.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -77,8 +77,8 @@
* a java composite object, so we need to unwrap it and copy the
* contents.
*/
- return new PSName(interpreter, new String(value), isExecutable,
- isImmediatelyEvaluated);
+ return new PSName(interpreter, new String(this.value),
+ this.isExecutable, this.isImmediatelyEvaluated);
}
public boolean equals(final Object anObject) {
@@ -110,7 +110,7 @@
}
protected boolean isExecutable() {
- return isExecutable;
+ return this.isExecutable;
}
public byte getPSObjectType() {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSObject.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSObject.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSObject.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -59,7 +59,7 @@
protected PSInterpreter interpreter;
- private byte access = ACCESS_UNLIMITED;
+ private byte access = PSObject.ACCESS_UNLIMITED;
protected PSObject(final PSInterpreter interpreter) {
this.interpreter = interpreter;
@@ -155,7 +155,7 @@
}
protected byte getAccess() {
- return access;
+ return this.access;
}
protected abstract boolean isExecutable();
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSOperator.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSOperator.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSOperator.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -771,7 +771,7 @@
}
public PSObject duplicate() {
- return new PSOperator(interpreter, dictionary, operatorEnum);
+ return new PSOperator(interpreter, this.dictionary, this.operatorEnum);
}
/**
@@ -780,7 +780,7 @@
* @return The integer equivalent of <code>name</code>.
*/
public static short mapNameToEnum(final String name) {
- return (short) Arrays.binarySearch(OPERATOR_NAMES, name);
+ return (short) Arrays.binarySearch(PSOperator.OPERATOR_NAMES, name);
}
/**
@@ -790,14 +790,15 @@
*/
public static String mapEnumToName(final short enumeratedOperator) {
if (enumeratedOperator < 0
- || enumeratedOperator >= OPERATOR_NAMES.length) {
+ || enumeratedOperator >= PSOperator.OPERATOR_NAMES.length) {
return null;
}
- return OPERATOR_NAMES[enumeratedOperator];
+ return PSOperator.OPERATOR_NAMES[enumeratedOperator];
}
public boolean execute() throws PSException {
- final boolean completed = dictionary.executeOperator(operatorEnum);
+ final boolean completed = this.dictionary.executeOperator(
+ this.operatorEnum);
return completed;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSReal.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSReal.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSReal.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -74,7 +74,7 @@
}
protected PSObject duplicate() {
- return new PSReal(interpreter, value);
+ return new PSReal(interpreter, this.value);
}
protected boolean isExecutable() {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSStack.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSStack.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSStack.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -53,7 +53,7 @@
this.interpreter = interpreter;
this.list = new ArrayList(initialSize);
if (stackType < 2 || stackType > 4) {
- this.stackType = STACK_UNKNOWN;
+ this.stackType = PSStack.STACK_UNKNOWN;
} else {
this.stackType = stackType;
}
@@ -64,22 +64,23 @@
* @return The top item from the stack, which was just discarded.
*/
public Object popObject(final int operatorCode) throws PSException {
- switch (stackType) {
- case STACK_DICTIONARY: {
+ switch (this.stackType) {
+ case PSStack.STACK_DICTIONARY: {
// Don't allow the bottom three items to be popped
- if (list.size() < 4) {
+ if (this.list.size() < 4) {
throw new PSException(this.interpreter,
PSErrorDict.DICTSTACKUNDERFLOW, operatorCode);
}
}
default: {
- if (list.size() < 1) {
+ if (this.list.size() < 1) {
throw new PSException(this.interpreter,
mapStackUnderflowError(), operatorCode);
}
}
}
- final PSObject object = (PSObject) list.remove(list.size() - 1);
+ final PSObject object = (PSObject) this.list.remove(
+ this.list.size() - 1);
return object;
}
@@ -92,10 +93,10 @@
* @return The top item from the stack.
*/
public Object peekObject() {
- if (list.size() < 1) {
+ if (this.list.size() < 1) {
return null;
}
- return list.get(list.size() - 1);
+ return this.list.get(this.list.size() - 1);
}
/**
@@ -105,11 +106,11 @@
* @return The nth item down the stack, where n is indexFromTop.
*/
public Object peekObject(final int indexFromTop) {
- if (list.size() < indexFromTop) {
+ if (this.list.size() < indexFromTop) {
return null;
}
- final int index = list.size() - indexFromTop - 1;
- return list.get(index);
+ final int index = this.list.size() - indexFromTop - 1;
+ return this.list.get(index);
}
/**
@@ -124,53 +125,53 @@
*/
protected void roll(final int n, final int j, final short operatorCode)
throws PSException {
- if (list.size() < n) {
+ if (this.list.size() < n) {
throw new PSException(this.interpreter, mapStackUnderflowError(),
operatorCode, "attempted to roll " + n
+ " additional operands, stack has only "
- + list.size() + ".");
+ + this.list.size() + ".");
}
int iterationsRemaining = j;
while (iterationsRemaining != 0) {
Object saveObject = null;
Object moveObject = null;
- final int topOfRoll = list.size() - 1;
+ final int topOfRoll = this.list.size() - 1;
final int bottomOfRoll = topOfRoll - n + 1;
if (iterationsRemaining > 0) {
// Save the object at the top of the stack
- saveObject = list.get(topOfRoll);
+ saveObject = this.list.get(topOfRoll);
for (int i = 1; i < n; i++) {
// Starting at top of roll/stack, pull each item up 1
final int moveIndex = topOfRoll - i;
- moveObject = list.get(moveIndex);
- list.set(moveIndex + 1, moveObject);
+ moveObject = this.list.get(moveIndex);
+ this.list.set(moveIndex + 1, moveObject);
}
- list.set(bottomOfRoll, saveObject);
+ this.list.set(bottomOfRoll, saveObject);
iterationsRemaining --;
} else {
- saveObject = list.get(bottomOfRoll);
+ saveObject = this.list.get(bottomOfRoll);
for (int i = 1; i < n; i++) {
// Starting at bottom of roll, pull each item down 1
final int moveIndex = bottomOfRoll + i;
- moveObject = list.get(moveIndex);
- list.set(moveIndex - 1, moveObject);
+ moveObject = this.list.get(moveIndex);
+ this.list.set(moveIndex - 1, moveObject);
}
- list.set(topOfRoll, saveObject);
+ this.list.set(topOfRoll, saveObject);
iterationsRemaining ++;
}
}
}
public int size() {
- return list.size();
+ return this.list.size();
}
private byte mapStackUnderflowError() {
switch (this.stackType) {
- case STACK_OPERAND: {
+ case PSStack.STACK_OPERAND: {
return PSErrorDict.STACKUNDERFLOW;
}
- case STACK_DICTIONARY: {
+ case PSStack.STACK_DICTIONARY: {
return PSErrorDict.DICTSTACKUNDERFLOW;
}
default: {
@@ -186,10 +187,10 @@
*/
PSFile currentFile() {
PSFile currentFile = null;
- for (int i = list.size() - 1; i > -1 && currentFile == null;
+ for (int i = this.list.size() - 1; i > -1 && currentFile == null;
i--) {
- if (list.get(i) instanceof PSFile) {
- currentFile = (PSFile) list.get(i);
+ if (this.list.get(i) instanceof PSFile) {
+ currentFile = (PSFile) this.list.get(i);
}
}
return currentFile;
@@ -203,8 +204,8 @@
*/
int markIndex() {
int markIndex = -1;
- for (int i = list.size() - 1; i > -1 && markIndex < 0; i--) {
- final PSObject object = (PSObject) list.get(i);
+ for (int i = this.list.size() - 1; i > -1 && markIndex < 0; i--) {
+ final PSObject object = (PSObject) this.list.get(i);
if (object.getPSObjectType() == PSObject.PSOBJ_MARK) {
markIndex = i;
}
@@ -223,7 +224,7 @@
throw new PSException(this.interpreter, PSErrorDict.UNMATCHEDMARK,
operator);
}
- return list.size() - 1 - markIndex;
+ return this.list.size() - 1 - markIndex;
}
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -1362,7 +1362,7 @@
}
protected void fontDirectory() throws PSException {
- pushOperand(fontDirectory);
+ pushOperand(this.fontDirectory);
}
protected void definefont() throws PSException {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -45,12 +45,12 @@
}
public void addEntry(final CMap04Entry entry) {
- lastEntryAdded++;
- if (lastEntryAdded >= entries.length) {
+ this.lastEntryAdded++;
+ if (this.lastEntryAdded >= this.entries.length) {
// Fails silently.
return;
}
- this.entries[lastEntryAdded] = entry;
+ this.entries[this.lastEntryAdded] = entry;
}
public void addEntry(final char unicodeStart, final char unicodeEnd,
@@ -76,9 +76,9 @@
}
private CMap04Entry entryForChar(final char c) {
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].containsChar(c)) {
- return entries[i];
+ for (int i = 0; i < this.entries.length; i++) {
+ if (this.entries[i].containsChar(c)) {
+ return this.entries[i];
}
}
return null;
@@ -88,8 +88,9 @@
* {@inheritDoc}
*/
public int decodeCharacter(final int glyphIndexInput) {
- for (int i = 0; i < entries.length; i++) {
- final char codePoint = entries[i].decodeCharacter(glyphIndexInput);
+ for (int i = 0; i < this.entries.length; i++) {
+ final char codePoint = this.entries[i].decodeCharacter(
+ glyphIndexInput);
if (codePoint != Character.MAX_VALUE) {
return codePoint;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04Entry.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04Entry.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04Entry.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -62,7 +62,8 @@
* glyph index that corresponds to unicodeEnd.
*/
public char getGlyphEndIndex() {
- return (char) (glyphStartIndex + unicodeEnd - unicodeStart);
+ return (char) (this.glyphStartIndex + this.unicodeEnd
+ - this.unicodeStart);
}
public boolean containsChar(final char c) {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -45,12 +45,12 @@
}
public void addEntry(final CMap12Entry entry) {
- lastEntryAdded++;
- if (lastEntryAdded >= entries.length) {
+ this.lastEntryAdded++;
+ if (this.lastEntryAdded >= this.entries.length) {
// Fails silently.
return;
}
- this.entries[lastEntryAdded] = entry;
+ this.entries[this.lastEntryAdded] = entry;
}
public void addEntry(final int unicodeStart, final int unicodeEnd,
@@ -69,9 +69,9 @@
}
private CMap12Entry entryForChar(final int codePoint) {
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].containsChar(codePoint)) {
- return entries[i];
+ for (int i = 0; i < this.entries.length; i++) {
+ if (this.entries[i].containsChar(codePoint)) {
+ return this.entries[i];
}
}
return null;
@@ -81,8 +81,9 @@
* {@inheritDoc}
*/
public int decodeCharacter(final int glyphIndexInput) {
- for (int i = 0; i < entries.length; i++) {
- final int codePoint = entries[i].decodeCharacter(glyphIndexInput);
+ for (int i = 0; i < this.entries.length; i++) {
+ final int codePoint = this.entries[i].decodeCharacter(
+ glyphIndexInput);
if (codePoint != Character.MAX_VALUE) {
return codePoint;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12Entry.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12Entry.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12Entry.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -50,7 +50,7 @@
* glyph index that corresponds to unicodeEnd.
*/
public int getGlyphEndIndex() {
- return glyphStartIndex + unicodeEnd - unicodeStart;
+ return this.glyphStartIndex + this.unicodeEnd - this.unicodeStart;
}
public boolean containsChar(final int codePoint) {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2006-09-11 01:56:21 UTC (rev 8048)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2006-09-11 17:13:48 UTC (rev 8049)
@@ -109,10 +109,10 @@
private int countLines() throws IOException {
int count = 0;
- reader.seek(0);
+ this.reader.seek(0);
boolean endOfFile = false;
while (! endOfFile) {
- final String currentLine = reader.readLine();
+ final String currentLine = this.reader.readLine();
if (currentLine == null) {
endOfFile = true;
break;
@@ -129,12 +129,12 @@
* @throws IOException
*/
private void parseLines() throws IOException {
- reader.seek(0);
+ this.reader.seek(0);
boolean endOfFile = false;
endOfFile = false;
int arrayIndex = 0;
while (! endOfFile) {
- final String currentLine = reader.readLine();
+ final String currentLine = this.reader.readLine();
this.currentLineNumber++;
if (currentLine == null) {
endOfFile = true;
@@ -183,7 +183,8 @@
try {
index = Integer.parseInt(numericString, this.radix);
} catch (final NumberFormatException e) {
- logger.error("Invalid octal string, line " + this.currentLineNumber
+ this.logger.error("Invalid octal string, line "
+ + this.currentLineNumber
+ ": " + numericString);
}
if (index > 255) {
@@ -216,17 +217,17 @@
while (anyChanges) {
anyChanges = false;
for (int i = 0; i < this.glyphNames.length - 1; i++) {
- final int compareValue = glyphNames[i].compareTo(
- glyphNames[i + 1]);
+ final int compareValue = this.glyphNames[i].compareTo(
+ this.glyphNames[i + 1]);
if (compareValue > 0) {
/* Item at [i + 1] is less than item at [i]. Switch them
* and the same elements in codePointsForGlyphNames. */
- final String storeString = glyphNames[i];
- glyphNames[i] = glyphNames[i + 1];
- glyphNames[i + 1] = storeString;
- final char storeChar = glyphIndexes[i];
- glyphIndexes[i] = glyphIndexes[i + 1];
- glyphIndexes[i + 1] = storeChar;
+ final String storeString = this.glyphNames[i];
+ this.glyphNames[i] = this.glyphNames[i + 1];
+ this.glyphNames[i + 1] = storeString;
+ final char storeChar = this.glyphIndexes[i];
+ this.glyphIndexes[i] = this.glyphIndexes[i + 1];
+ this.glyphIndexes[i + 1] = storeChar;
anyChanges = true;
}
}
@@ -257,17 +258,17 @@
}
}
this.glyphListsToCheck[index] = GlyphList.getGlyphList("AGL");
- this.codePoints = new char[glyphNames.length];
- this.codePointIndexes = new char[codePoints.length];
- for (int i = 0; i < glyphNames.length; i++) {
- final String glyphName = glyphNames[i];
+ this.codePoints = new char[this.glyphNames.length];
+ this.codePointIndexes = new char[this.codePoints.length];
+ for (int i = 0; i < this.glyphNames.length; i++) {
+ final String glyphName = this.glyphNames[i];
for (int j = 0; j < this.glyphListsToCheck.length; j++) {
glyphList = this.glyphListsToCheck[j];
final char codePoint = glyphList.mapGlyphNameToCodePoint(
glyphName);
if (codePoint != 0xFFFF) {
this.codePoints[i] = codePoint;
- final char glyphIndex = glyphIndexes[i];
+ final char glyphIndex = this.glyphIndexes[i];
this.codePointIndexes[i] = glyphIndex;
break;
}
@@ -303,19 +304,20 @@
// Write the glyph names.
s = " public static final String[] sortedGlyphNames = {\n";
out.write(s.getBytes());
- for (int i = 0; i < glyphNames.length; i++) {
+ for (int i = 0; i < this.glyphNames.length; i++) {
s = " \"";
- s = s + glyphNames[i];
+ s = s + this.glyphNames[i];
s = s + "\"";
- if (i < glyphNames.length - 1) {
+ if (i < this.glyphNames.length - 1) {
s = s + ",";
}
s = padSpaces(s, 35, 2);
s = s + "// " + formatArrayIndex(i);
s = padSpaces(s, 44, 1);
s = s + " glyph-index: 0x"
- + StringUtil.charToHexString(glyphIndexes[i], true, 4);
- s = s + " \\" + StringUtil.charToOctalString(glyphIndexes[i], 3);
+ + StringUtil.charToHexString(this.glyphIndexes[i], true, 4);
+ s = s + " \\" + StringUtil.charToOctalString(this.glyphIndexes[i],
+ 3);
s = s + "\n";
out.write(s.getBytes());
}
@@ -327,12 +329,12 @@
out.write(s.getBytes());
s = " public static final short[] glyphIndexes = {\n";
out.write(s.getBytes());
- for (int i = 0; i < glyphIndexes.length; i++) {
- final char index = glyphIndexes[i];
+ for (int i = 0; i < this.glyphIndexes.length; i++) {
+ final char index = this.glyphIndexes[i];
s = " ";
s = s + "0x";
s = s + StringUtil.charToHexString(index, true, 4);
- if (i < glyphIndexes.length - 1) {
+ if (i < this.glyphIndexes.length - 1) {
s = s + ",";
}
s = padSpaces(s, 18, 2);
@@ -340,7 +342,7 @@
s = padSpaces(s, 27, 1);
s = s + "\\" + StringUtil.charToOctalString(index, 3);
s = padSpaces(s, 35, 1);
- s = s + glyphNames[i];
+ s = s + this.glyphNames[i];
s = s + "\n";
out.write(s.getBytes());
}
@@ -356,21 +358,21 @@
out.write(s.getBytes());
s = " public static final char[] codePoints = {\n";
out.write(s.getBytes());
- for (int i = 0; i < codePoints.length; i++) {
- final char index = codePoints[i];
+ for (int i = 0; i < this.codePoints.length; i++) {
+ final char index = this.codePoints[i];
s = " ";
s = s + "0x";
s = s + StringUtil.charToHexString(index, true, 4);
- if (i < codePoints.length - 1) {
+ if (i < this.codePoints.length - 1) {
s = s + ",";
}
s = padSpaces(s, 18, 2);
s = s + "// " + formatArrayIndex(i);
s = padSpaces(s, 27, 2);
s = s + " glyph: 0x" + StringUtil.charToHexString(
- codePointIndexes[i], true, 4);
- s = s + " \\" + StringUtil.charToOctalString(codePointIndexes[i],
- 4);
+ this.codePointIndexes[i], true, 4);
+ s = s + " \\" + StringUtil.charToOctalString(
+ this.codePointIndexes[i], 4);
s ...
[truncated message content] |