Thread: [FOray-commit] SF.net SVN: foray:[10612] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2008-07-18 00:49:26
|
Revision: 10612
http://foray.svn.sourceforge.net/foray/?rev=10612&view=rev
Author: victormote
Date: 2008-07-18 00:49:26 +0000 (Fri, 18 Jul 2008)
Log Message:
-----------
Clean up some serialization complaints resulting from Eclipse upgrade.
Modified Paths:
--------------
trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java
Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2008-07-16 04:43:10 UTC (rev 10611)
+++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2008-07-18 00:49:26 UTC (rev 10612)
@@ -65,6 +65,9 @@
*/
public abstract class AbstractDemoServlet extends HttpServlet {
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = -2834400719691501846L;
+
/** Constant for the "fo" request parameter. */
public static final String FO_REQUEST_PARAM = "fo";
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java 2008-07-16 04:43:10 UTC (rev 10611)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java 2008-07-18 00:49:26 UTC (rev 10612)
@@ -33,4 +33,7 @@
*/
public abstract class CMap extends Encoding {
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = -6516855352094857929L;
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java 2008-07-16 04:43:10 UTC (rev 10611)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java 2008-07-18 00:49:26 UTC (rev 10612)
@@ -47,6 +47,9 @@
*/
public abstract class Encoding implements org.axsl.ps.Encoding, Serializable {
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = -745565802070157893L;
+
/**
* {@inheritDoc}
*/
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java 2008-07-16 04:43:10 UTC (rev 10611)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java 2008-07-18 00:49:26 UTC (rev 10612)
@@ -86,6 +86,9 @@
public abstract class EncodingVector extends Encoding
implements org.axsl.ps.EncodingVector, Serializable {
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = 6967489975814026068L;
+
/** The name of the undefined glyph. */
public static final String NOTDEF = ".notdef";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2008-07-18 02:12:33
|
Revision: 10613
http://foray.svn.sourceforge.net/foray/?rev=10613&view=rev
Author: victormote
Date: 2008-07-18 02:12:39 +0000 (Fri, 18 Jul 2008)
Log Message:
-----------
Add some more Type 1 dictionary wrapper classes, and move more of the "get" logic to them.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java
trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontDictionary.java
Added Paths:
-----------
trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionaryWrapper.java
trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontInfoDictionary.java
trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsMetricsDictionary.java
trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsPrivateDictionary.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2008-07-18 00:49:26 UTC (rev 10612)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2008-07-18 02:12:39 UTC (rev 10613)
@@ -29,18 +29,16 @@
package org.foray.font.format;
import org.foray.common.WKConstants;
-import org.foray.ps.PsArray;
import org.foray.ps.PsDictionary;
import org.foray.ps.PsException;
import org.foray.ps.PsInput;
-import org.foray.ps.PsInteger;
import org.foray.ps.PsInterpreter;
import org.foray.ps.PsObject;
import org.foray.ps.filter.PSFilter;
import org.foray.ps.type1.PsFontDictionary;
+import org.foray.ps.type1.PsFontInfoDictionary;
+import org.foray.ps.type1.PsPrivateDictionary;
-import org.axsl.ps.BoundingBox;
-
import org.apache.commons.logging.Log;
import java.io.IOException;
@@ -96,9 +94,6 @@
/** The font bounding box parsed from this file. */
private int[] fontBBox = null;
- /** The stemV value parsed from this file. */
- private int stemV = 0;
-
/** The PostScript interpreter used to parse this file. */
private PsInterpreter interpreter;
@@ -173,54 +168,6 @@
}
/**
- * Parses and returns the font bounding box.
- * @return The font bbox.
- */
- private int[] parseFontBBox() {
- final Object object = getFontDictionary().getItem("FontBBox");
- if (! (object instanceof PsArray)) {
- return null;
- }
- final PsArray psarray = (PsArray) object;
- if (psarray.size() != BoundingBox.BBOX_ENTRIES) {
- return null;
- }
- this.fontBBox = new int[BoundingBox.BBOX_ENTRIES];
- for (int i = 0; i < psarray.size(); i++) {
- final Object arrayItem = psarray.get(i);
- if (arrayItem instanceof PsInteger) {
- final PsInteger psInteger = (PsInteger) arrayItem;
- final int itemValue = psInteger.intValue();
- this.fontBBox[i] = itemValue;
- } else {
- return null;
- }
- }
- return this.fontBBox;
- }
-
- /**
- * Parses and returns the StemV value from the font file.
- * @return The StemV value.
- */
- private int parseStemV() {
- final PsDictionary privateDict = getPrivateDictionary();
- if (privateDict == null) {
- return 0;
- }
- final PsObject object = privateDict.getItem("StdVW");
- if (object == null || ! (object instanceof PsArray)) {
- return 0;
- }
- final PsArray psArray = (PsArray) object;
- final Object item = psArray.get(0);
- if (! (item instanceof PsInteger)) {
- return 0;
- }
- return ((PsInteger) item).intValue();
- }
-
- /**
* Caches the FontDictionary in an instance variable for easier access.
* @return The font dictionary for the font file.
*/
@@ -230,51 +177,17 @@
}
/**
- * Returns the FontInfo dictionary.
- * @return The FontInfo dictionary, or null if it does not exist.
- */
- private PsDictionary getFontInfoDictionary() {
- final PsFontDictionary fontDictionary = this.getFontDictionary();
- if (fontDictionary == null) {
- return null;
- }
- final PsObject psObject = fontDictionary.getItem("FontInfo");
- if (psObject == null) {
- return null;
- }
- if (psObject instanceof PsDictionary) {
- return (PsDictionary) psObject;
- }
- throw new IllegalStateException("FontInfo expected to be a PsDictionary");
- }
-
- /**
* Returns the private dictionary portion of the font file.
* @return The private dictionary portion of the font file.
*/
- private PsDictionary getPrivateDictionary() {
- final PsObject privateDict = getFontDictionary().getItem("Private");
- if (privateDict == null
- || ! (privateDict instanceof PsDictionary)) {
+ private PsPrivateDictionary getPrivateDictionary() {
+ if (this.fontDictionary == null) {
return null;
}
- return (PsDictionary) privateDict;
+ return this.fontDictionary.getPrivateDictionary();
}
/**
- * Returns the metrics dictionary portion of the font file.
- * @return The metrics dictionary portion of the font file.
- */
- PsDictionary getMetricsDictionary() {
- final PsObject metricsDict = getFontDictionary().getItem("Metrics");
- if (metricsDict == null
- || ! (metricsDict instanceof PsDictionary)) {
- return null;
- }
- return (PsDictionary) metricsDict;
- }
-
- /**
* Returns the full length of the raw font file.
* @return int the raw file length
*/
@@ -411,7 +324,7 @@
public int[] getFontBBox() {
if (this.fontBBox == null) {
parseDetail();
- this.fontBBox = parseFontBBox();
+ this.fontBBox = getFontDictionary().getFontBBox();
if (this.fontBBox == null) {
this.getLogger().error("Unable to parse Font BBox:\n"
+ " " + this.getReader().getDescription().toString());
@@ -425,15 +338,11 @@
* @return The stemV value.
*/
public int getStemV() {
- if (this.stemV == 0) {
- parseDetail();
- this.stemV = parseStemV();
- if (this.stemV == 0) {
- this.getLogger().error("Unable to parse StemV:\n"
- + " " + this.getReader().getDescription().toString());
- }
+ final PsPrivateDictionary privateDict = this.getPrivateDictionary();
+ if (privateDict == null) {
+ return 0;
}
- return this.stemV;
+ return privateDict.getStdVW().intValue();
}
/**
@@ -472,8 +381,7 @@
if (this.fontDictionary == null) {
return null;
}
- final PsObject psObject = this.fontDictionary.getItem("FontName");
- return psObject.toString();
+ return this.fontDictionary.getFontName();
}
/**
@@ -481,12 +389,11 @@
* @return The PostScript name of this font.
*/
public String getFamilyName() {
- final PsDictionary fontInfo = this.getFontInfoDictionary();
+ final PsFontInfoDictionary fontInfo = getFontDictionary().getFontInfoDictionary();
if (fontInfo == null) {
return null;
}
- final PsObject psObject = this.fontDictionary.getItem("FamilyName");
- return psObject.toString();
+ return fontInfo.getFamilyName();
}
/**
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java 2008-07-18 00:49:26 UTC (rev 10612)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java 2008-07-18 02:12:39 UTC (rev 10613)
@@ -28,8 +28,7 @@
package org.foray.ps;
-import org.foray.common.StringUtil;
-
+import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
@@ -257,7 +256,7 @@
final PsObject object = this.getItem(key);
if (object == null
|| ! (object instanceof PsString)) {
- return StringUtil.EMPTY_STRING;
+ return null;
}
final PsString string = (PsString) object;
return string.getValue();
@@ -273,10 +272,42 @@
final PsObject object = this.getItem(key);
if (object == null
|| ! (object instanceof PsName)) {
- return StringUtil.EMPTY_STRING;
+ return null;
}
final PsName string = (PsName) object;
return string.getValue();
}
+ /**
+ * Returns a value expected to be a Number from this dictionary.
+ * @param key The key to the expected Number value.
+ * @return The value for <code>key</code>, if it is found and is a {@link PsNumber}, or null
+ * otherwise.
+ */
+ public BigDecimal getNumber(final String key) {
+ final PsObject object = this.getItem(key);
+ if (object == null
+ || ! (object instanceof PsNumber)) {
+ return null;
+ }
+ final PsNumber number = (PsNumber) object;
+ return number.getValue();
+ }
+
+ /**
+ * Returns a value expected to be a Boolean from this dictionary.
+ * @param key The key to the expected Boolean value.
+ * @return The value for <code>key</code>, if it is found and is a {@link PsBoolean}, or null
+ * otherwise.
+ */
+ public Boolean getBoolean(final String key) {
+ final PsObject object = this.getItem(key);
+ if (object == null
+ || ! (object instanceof PsBoolean)) {
+ return null;
+ }
+ final PsBoolean theBoolean = (PsBoolean) object;
+ return theBoolean.getValue();
+ }
+
}
Added: trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionaryWrapper.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionaryWrapper.java (rev 0)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionaryWrapper.java 2008-07-18 02:12:39 UTC (rev 10613)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.ps;
+
+/**
+ * Abstract superclass for classes that wrap {@link PsDictionary} and provide specialized methods.
+ */
+public abstract class PsDictionaryWrapper {
+
+ /** The wrapped dictionary instance. */
+ private PsDictionary wrappedDictionary;
+
+ /**
+ * Constructor.
+ * @param dictionary The wrapped dictionary instance.
+ */
+ public PsDictionaryWrapper(final PsDictionary dictionary) {
+ if (dictionary == null) {
+ throw new NullPointerException("Wrapped dictionary cannot be null.");
+ }
+ this.wrappedDictionary = dictionary;
+ }
+
+ /**
+ * Returns the wrapped dictionary.
+ * @return The wrapped dictionary instance.
+ */
+ public PsDictionary getWrappedDictionary() {
+ return this.wrappedDictionary;
+ }
+
+}
Property changes on: trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionaryWrapper.java
___________________________________________________________________
Added: svn:keywords
+ "Author Id Rev Date URL"
Added: svn:eol-style
+ native
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontDictionary.java 2008-07-18 00:49:26 UTC (rev 10612)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontDictionary.java 2008-07-18 02:12:39 UTC (rev 10613)
@@ -28,44 +28,106 @@
package org.foray.ps.type1;
+import org.foray.ps.PsArray;
import org.foray.ps.PsDictionary;
+import org.foray.ps.PsDictionaryWrapper;
+import org.foray.ps.PsInteger;
import org.foray.ps.PsObject;
+import org.axsl.ps.BoundingBox;
+
/**
* Wrapper around a {@link PsDictionary} instance providing some convenience methods for Type 1
* fonts.
*/
-public class PsFontDictionary {
+public class PsFontDictionary extends PsDictionaryWrapper {
- /** The wrapped dictionary instance. */
- private PsDictionary wrappedDictionary;
-
/**
* Constructor.
* @param dictionary The wrapped dictionary instance.
*/
public PsFontDictionary(final PsDictionary dictionary) {
- if (dictionary == null) {
- throw new NullPointerException("Wrapped dictionary cannot be null.");
+ super(dictionary);
+ }
+
+ /**
+ * Returns the /FontName for this font dictionary.
+ * @return The /FontName.
+ */
+ public String getFontName() {
+ return this.getWrappedDictionary().getName("FontName");
+ }
+
+ /**
+ * Parses and returns the font bounding box.
+ * @return The font bbox.
+ */
+ public int[] getFontBBox() {
+ final Object object = this.getWrappedDictionary().getItem("FontBBox");
+ if (! (object instanceof PsArray)) {
+ return null;
}
- this.wrappedDictionary = dictionary;
+ final PsArray psarray = (PsArray) object;
+ if (psarray.size() != BoundingBox.BBOX_ENTRIES) {
+ return null;
+ }
+ final int[] fontBBox = new int[BoundingBox.BBOX_ENTRIES];
+ for (int i = 0; i < psarray.size(); i++) {
+ final Object arrayItem = psarray.get(i);
+ if (arrayItem instanceof PsInteger) {
+ final PsInteger psInteger = (PsInteger) arrayItem;
+ final int itemValue = psInteger.intValue();
+ fontBBox[i] = itemValue;
+ } else {
+ return null;
+ }
+ }
+ return fontBBox;
}
/**
- * Return the value for a given key from the wrapped dictionary.
- * @param key The key whose value should be retrieved.
- * @return The value.
+ * Returns the FontInfo dictionary.
+ * @return The FontInfo dictionary, or null if it does not exist.
*/
- public PsObject getItem(final String key) {
- return this.wrappedDictionary.getItem(key);
+ public PsFontInfoDictionary getFontInfoDictionary() {
+ final PsObject psObject = getWrappedDictionary().getItem("FontInfo");
+ if (psObject == null) {
+ return null;
+ }
+ if (psObject instanceof PsDictionary) {
+ return new PsFontInfoDictionary((PsDictionary) psObject);
+ }
+ throw new IllegalStateException("/FontInfo expected to be a PsDictionary");
}
/**
- * Returns the /FontName for this font dictionary.
- * @return The /FontName.
+ * Returns the Private dictionary.
+ * @return The Private dictionary, or null if it does not exist.
*/
- public String getFontName() {
- return this.wrappedDictionary.getName("FontName");
+ public PsPrivateDictionary getPrivateDictionary() {
+ final PsObject psObject = getWrappedDictionary().getItem("Private");
+ if (psObject == null) {
+ return null;
+ }
+ if (psObject instanceof PsDictionary) {
+ return new PsPrivateDictionary((PsDictionary) psObject);
+ }
+ throw new IllegalStateException("/Private expected to be a PsDictionary");
}
+ /**
+ * Returns the Metrics dictionary.
+ * @return The Metrics dictionary, or null if it does not exist.
+ */
+ public PsMetricsDictionary getMetricsDictionary() {
+ final PsObject psObject = getWrappedDictionary().getItem("Metrics");
+ if (psObject == null) {
+ return null;
+ }
+ if (psObject instanceof PsDictionary) {
+ return new PsMetricsDictionary((PsDictionary) psObject);
+ }
+ throw new IllegalStateException("/Metrics expected to be a PsDictionary");
+ }
+
}
Added: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontInfoDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontInfoDictionary.java (rev 0)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontInfoDictionary.java 2008-07-18 02:12:39 UTC (rev 10613)
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2008 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.ps.type1;
+
+import org.foray.ps.PsDictionary;
+import org.foray.ps.PsDictionaryWrapper;
+
+import java.math.BigDecimal;
+
+/**
+ * Wrapper around a {@link PsDictionary} instance providing some convenience methods for Type 1
+ * fonts.
+ */
+public class PsFontInfoDictionary extends PsDictionaryWrapper {
+
+ /** Key to the "version" entry. */
+ public static final String VERSION_KEY = "version";
+
+ /** Key to the "Notice" entry. */
+ public static final String NOTICE_KEY = "Notice";
+
+ /** Key to the "FullName" entry. */
+ public static final String FULL_NAME_KEY = "FullName";
+
+ /** Key to the "FamilyName" entry. */
+ public static final String FAMILY_NAME_KEY = "FamilyName";
+
+ /** Key to the "Weight" entry. */
+ public static final String WEIGHT_KEY = "Weight";
+
+ /** Key to the "ItalicAngle" entry. */
+ public static final String ITALIC_ANGLE_KEY = "ItalicAngle";
+
+ /** Key to the "isFixedPitch" entry. */
+ public static final String IS_FIXED_PITCH_KEY = "isFixedPitch";
+
+ /** Key to the "UnderlinePosition" entry. */
+ public static final String UNDERLINE_POSITION_KEY = "UnderlinePosition";
+
+ /** Key to the "UnderlineThickness" entry. */
+ public static final String UNDERLINE_THICKNESS_KEY = "UnderlineThickness";
+
+ /**
+ * Constructor.
+ * @param dictionary The wrapped dictionary instance.
+ */
+ public PsFontInfoDictionary(final PsDictionary dictionary) {
+ super(dictionary);
+ }
+
+ /**
+ * Returns the /version for this font dictionary.
+ * @return The /version.
+ */
+ public String getVersion() {
+ return this.getWrappedDictionary().getString(PsFontInfoDictionary.VERSION_KEY);
+ }
+
+ /**
+ * Returns the /Notice for this font dictionary.
+ * @return The /Notice.
+ */
+ public String getNotice() {
+ return this.getWrappedDictionary().getString(PsFontInfoDictionary.NOTICE_KEY);
+ }
+
+ /**
+ * Returns the /FullName for this font dictionary.
+ * @return The /FullName.
+ */
+ public String getFullName() {
+ return this.getWrappedDictionary().getString(PsFontInfoDictionary.FULL_NAME_KEY);
+ }
+
+ /**
+ * Returns the /FamilyName for this font dictionary.
+ * @return The /FamilyName.
+ */
+ public String getFamilyName() {
+ return this.getWrappedDictionary().getString(PsFontInfoDictionary.FAMILY_NAME_KEY);
+ }
+
+ /**
+ * Returns the /Weight for this font dictionary.
+ * @return The /Weight.
+ */
+ public String getWeight() {
+ return this.getWrappedDictionary().getString(PsFontInfoDictionary.WEIGHT_KEY);
+ }
+
+ /**
+ * Returns the /ItalicAngle for this font dictionary.
+ * @return The /ItalicAngle.
+ */
+ public BigDecimal getItalicAngle() {
+ return this.getWrappedDictionary().getNumber(PsFontInfoDictionary.ITALIC_ANGLE_KEY);
+ }
+
+ /**
+ * Returns the /isFixedPitch for this font dictionary.
+ * @return The /isFixedPitch.
+ */
+ public boolean isFixedPitch() {
+ return this.getWrappedDictionary().getBoolean(PsFontInfoDictionary.IS_FIXED_PITCH_KEY);
+ }
+
+ /**
+ * Returns the /UnderlinePosition for this font dictionary.
+ * @return The /UnderlinePosition.
+ */
+ public BigDecimal getUnderlinePosition() {
+ return this.getWrappedDictionary().getNumber(PsFontInfoDictionary.UNDERLINE_POSITION_KEY);
+ }
+
+ /**
+ * Returns the /UnderlineThickness for this font dictionary.
+ * @return The /UnderlineThickness.
+ */
+ public BigDecimal getUnderlineThickness() {
+ return this.getWrappedDictionary().getNumber(PsFontInfoDictionary.UNDERLINE_THICKNESS_KEY);
+ }
+
+}
Property changes on: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontInfoDictionary.java
___________________________________________________________________
Added: svn:keywords
+ "Author Id Rev Date URL"
Added: svn:eol-style
+ native
Added: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsMetricsDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsMetricsDictionary.java (rev 0)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsMetricsDictionary.java 2008-07-18 02:12:39 UTC (rev 10613)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.ps.type1;
+
+import org.foray.ps.PsDictionary;
+import org.foray.ps.PsDictionaryWrapper;
+
+public class PsMetricsDictionary extends PsDictionaryWrapper {
+
+ /**
+ * Constructor.
+ * @param dictionary The wrapped dictionary instance.
+ */
+ public PsMetricsDictionary(final PsDictionary dictionary) {
+ super(dictionary);
+ }
+
+}
Property changes on: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsMetricsDictionary.java
___________________________________________________________________
Added: svn:keywords
+ "Author Id Rev Date URL"
Added: svn:eol-style
+ native
Added: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsPrivateDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsPrivateDictionary.java (rev 0)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsPrivateDictionary.java 2008-07-18 02:12:39 UTC (rev 10613)
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2008 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.ps.type1;
+
+import org.foray.ps.PsArray;
+import org.foray.ps.PsDictionary;
+import org.foray.ps.PsDictionaryWrapper;
+import org.foray.ps.PsNumber;
+import org.foray.ps.PsObject;
+
+import java.math.BigDecimal;
+
+public class PsPrivateDictionary extends PsDictionaryWrapper {
+
+ /** Key to the "StdVW" entry. */
+ public static final String STD_VW_KEY = "StdVW";
+
+ /**
+ * Constructor.
+ * @param dictionary The wrapped dictionary instance.
+ */
+ public PsPrivateDictionary(final PsDictionary dictionary) {
+ super(dictionary);
+ }
+
+ /**
+ * Returns the StdVW value from the font file.
+ * @return The StdVW value, or null if it does not exist.
+ */
+ public BigDecimal getStdVW() {
+ final PsObject object = getWrappedDictionary().getItem(PsPrivateDictionary.STD_VW_KEY);
+ if (object == null || ! (object instanceof PsArray)) {
+ return null;
+ }
+ final PsArray psArray = (PsArray) object;
+ final Object item = psArray.get(0);
+ if (! (item instanceof PsNumber)) {
+ throw new IllegalStateException("/StdVW expected to be a PsNumber");
+ }
+ return ((PsNumber) item).getValue();
+ }
+
+}
Property changes on: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsPrivateDictionary.java
___________________________________________________________________
Added: svn:keywords
+ "Author Id Rev Date URL"
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2008-07-18 02:48:47
|
Revision: 10615
http://foray.svn.sourceforge.net/foray/?rev=10615&view=rev
Author: victormote
Date: 2008-07-18 02:48:55 +0000 (Fri, 18 Jul 2008)
Log Message:
-----------
Add Type 1 CharStrings dictionary wrapper classes, and add some more tests of pfb parsing.
Modified Paths:
--------------
trunk/foray/foray-font/src/javatest/org/foray/font/format/TestType1PfbFile.java
trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontDictionary.java
Added Paths:
-----------
trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsCharStringsDictionary.java
Modified: trunk/foray/foray-font/src/javatest/org/foray/font/format/TestType1PfbFile.java
===================================================================
--- trunk/foray/foray-font/src/javatest/org/foray/font/format/TestType1PfbFile.java 2008-07-18 02:18:19 UTC (rev 10614)
+++ trunk/foray/foray-font/src/javatest/org/foray/font/format/TestType1PfbFile.java 2008-07-18 02:48:55 UTC (rev 10615)
@@ -30,7 +30,10 @@
import org.foray.common.Logging;
import org.foray.font.TestFontServer4a;
+import org.foray.ps.type1.PsCharStringsDictionary;
import org.foray.ps.type1.PsFontDictionary;
+import org.foray.ps.type1.PsFontInfoDictionary;
+import org.foray.ps.type1.PsPrivateDictionary;
import org.axsl.font.FontException;
@@ -60,11 +63,30 @@
assertNotNull(reader);
final Type1PFBFile pfbFile = new Type1PFBFile(reader);
assertNotNull(pfbFile);
- final PsFontDictionary fontDictionary = pfbFile.getFontDictionary();
- assertNotNull(fontDictionary);
- final String fontName = fontDictionary.getFontName();
- /* Following value obtained from the AFM file. */
+ final PsFontDictionary fontDict = pfbFile.getFontDictionary();
+ assertNotNull(fontDict);
+
+ /* Test values below obtained from the AFM file. */
+
+ final PsFontInfoDictionary fontInfoDict = fontDict.getFontInfoDictionary();
+ assertNotNull(fontInfoDict);
+
+ final String fontName = fontDict.getFontName();
assertEquals("CMR10", fontName);
+
+ final int[] fontBBox = fontDict.getFontBBox();
+ assertEquals(4, fontBBox.length);
+ /* Following test fails. The AFM file shows -40, but the font file returns -251. */
+// assertEquals(-40, fontBBox[0]);
+ assertEquals(-250, fontBBox[1]);
+ assertEquals(1009, fontBBox[2]);
+ assertEquals(969, fontBBox[3]);
+
+ final PsPrivateDictionary privateDict = fontDict.getPrivateDictionary();
+ assertNotNull(privateDict);
+
+ final PsCharStringsDictionary charStringsDict = fontDict.getCharStringsDictionary();
+ assertNotNull(charStringsDict);
}
}
Added: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsCharStringsDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsCharStringsDictionary.java (rev 0)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsCharStringsDictionary.java 2008-07-18 02:48:55 UTC (rev 10615)
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2008 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.ps.type1;
+
+import org.foray.ps.PsArray;
+import org.foray.ps.PsDictionary;
+import org.foray.ps.PsDictionaryWrapper;
+import org.foray.ps.PsNumber;
+import org.foray.ps.PsObject;
+
+import java.math.BigDecimal;
+
+public class PsCharStringsDictionary extends PsDictionaryWrapper {
+
+ /** Key to the "StdVW" entry. */
+ public static final String STD_VW_KEY = "StdVW";
+
+ /**
+ * Constructor.
+ * @param dictionary The wrapped dictionary instance.
+ */
+ public PsCharStringsDictionary(final PsDictionary dictionary) {
+ super(dictionary);
+ }
+
+ /**
+ * Returns the StdVW value from the font file.
+ * @return The StdVW value, or null if it does not exist.
+ */
+ public BigDecimal getStdVW() {
+ final PsObject object = getWrappedDictionary().getItem(PsCharStringsDictionary.STD_VW_KEY);
+ if (object == null || ! (object instanceof PsArray)) {
+ return null;
+ }
+ final PsArray psArray = (PsArray) object;
+ final Object item = psArray.get(0);
+ if (! (item instanceof PsNumber)) {
+ throw new IllegalStateException("/StdVW expected to be a PsNumber");
+ }
+ return ((PsNumber) item).getValue();
+ }
+
+}
Property changes on: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsCharStringsDictionary.java
___________________________________________________________________
Added: svn:keywords
+ "Author Id Rev Date URL"
Added: svn:eol-style
+ native
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontDictionary.java 2008-07-18 02:18:19 UTC (rev 10614)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontDictionary.java 2008-07-18 02:48:55 UTC (rev 10615)
@@ -42,6 +42,24 @@
*/
public class PsFontDictionary extends PsDictionaryWrapper {
+ /** Key to the "FontInfo" entry. */
+ public static final String FONT_INFO_KEY = "FontInfo";
+
+ /** Key to the "FontName" entry. */
+ public static final String FONT_NAME_KEY = "FontName";
+
+ /** Key to the "FontBBox" entry. */
+ public static final String FONT_BBOX_KEY = "FontBBox";
+
+ /** Key to the "Private" entry. */
+ public static final String PRIVATE_KEY = "Private";
+
+ /** Key to the "Metrics" entry. */
+ public static final String METRICS_KEY = "Metrics";
+
+ /** Key to the "CharStrings" entry. */
+ public static final String CHAR_STRINGS_KEY = "CharStrings";
+
/**
* Constructor.
* @param dictionary The wrapped dictionary instance.
@@ -51,11 +69,26 @@
}
/**
+ * Returns the FontInfo dictionary.
+ * @return The FontInfo dictionary, or null if it does not exist.
+ */
+ public PsFontInfoDictionary getFontInfoDictionary() {
+ final PsObject psObject = getWrappedDictionary().getItem(PsFontDictionary.FONT_INFO_KEY);
+ if (psObject == null) {
+ return null;
+ }
+ if (psObject instanceof PsDictionary) {
+ return new PsFontInfoDictionary((PsDictionary) psObject);
+ }
+ throw new IllegalStateException("/FontInfo expected to be a PsDictionary");
+ }
+
+ /**
* Returns the /FontName for this font dictionary.
* @return The /FontName.
*/
public String getFontName() {
- return this.getWrappedDictionary().getName("FontName");
+ return this.getWrappedDictionary().getName(PsFontDictionary.FONT_NAME_KEY);
}
/**
@@ -63,7 +96,7 @@
* @return The font bbox.
*/
public int[] getFontBBox() {
- final Object object = this.getWrappedDictionary().getItem("FontBBox");
+ final Object object = this.getWrappedDictionary().getItem(PsFontDictionary.FONT_BBOX_KEY);
if (! (object instanceof PsArray)) {
return null;
}
@@ -86,26 +119,11 @@
}
/**
- * Returns the FontInfo dictionary.
- * @return The FontInfo dictionary, or null if it does not exist.
- */
- public PsFontInfoDictionary getFontInfoDictionary() {
- final PsObject psObject = getWrappedDictionary().getItem("FontInfo");
- if (psObject == null) {
- return null;
- }
- if (psObject instanceof PsDictionary) {
- return new PsFontInfoDictionary((PsDictionary) psObject);
- }
- throw new IllegalStateException("/FontInfo expected to be a PsDictionary");
- }
-
- /**
* Returns the Private dictionary.
* @return The Private dictionary, or null if it does not exist.
*/
public PsPrivateDictionary getPrivateDictionary() {
- final PsObject psObject = getWrappedDictionary().getItem("Private");
+ final PsObject psObject = getWrappedDictionary().getItem(PsFontDictionary.PRIVATE_KEY);
if (psObject == null) {
return null;
}
@@ -120,7 +138,7 @@
* @return The Metrics dictionary, or null if it does not exist.
*/
public PsMetricsDictionary getMetricsDictionary() {
- final PsObject psObject = getWrappedDictionary().getItem("Metrics");
+ final PsObject psObject = getWrappedDictionary().getItem(PsFontDictionary.METRICS_KEY);
if (psObject == null) {
return null;
}
@@ -130,4 +148,19 @@
throw new IllegalStateException("/Metrics expected to be a PsDictionary");
}
+ /**
+ * Returns the CharStrings dictionary.
+ * @return The CharStrings dictionary, or null if it does not exist.
+ */
+ public PsCharStringsDictionary getCharStringsDictionary() {
+ final PsObject psObject = getWrappedDictionary().getItem(PsFontDictionary.CHAR_STRINGS_KEY);
+ if (psObject == null) {
+ return null;
+ }
+ if (psObject instanceof PsDictionary) {
+ return new PsCharStringsDictionary((PsDictionary) psObject);
+ }
+ throw new IllegalStateException("/CharStrings expected to be a PsDictionary");
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-01-20 13:42:41
|
Revision: 10617
http://foray.svn.sourceforge.net/foray/?rev=10617&view=rev
Author: victormote
Date: 2009-01-20 13:42:30 +0000 (Tue, 20 Jan 2009)
Log Message:
-----------
Clean up checkstyle complaints.
Modified Paths:
--------------
trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java
trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java
trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/PatternGenerator.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java
trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsCharStringsDictionary.java
trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsMetricsDictionary.java
trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsPrivateDictionary.java
Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2009-01-20 12:49:30 UTC (rev 10616)
+++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2009-01-20 13:42:30 UTC (rev 10617)
@@ -65,9 +65,6 @@
*/
public abstract class AbstractDemoServlet extends HttpServlet {
- /** Constant needed for serialization. */
- private static final long serialVersionUID = -2834400719691501846L;
-
/** Constant for the "fo" request parameter. */
public static final String FO_REQUEST_PARAM = "fo";
@@ -77,6 +74,9 @@
/** Constant for the "xsl" request parameter. */
public static final String XSL_REQUEST_PARAM = "xsl";
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = -2834400719691501846L;
+
/** The logger. */
private Log logger = null;
Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java 2009-01-20 12:49:30 UTC (rev 10616)
+++ trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java 2009-01-20 13:42:30 UTC (rev 10617)
@@ -518,7 +518,7 @@
* backward, we will be sliding the left end of the viewbox over the right
* end of the file.
*/
- class ByteSearcher {
+ final class ByteSearcher {
/** The size, in bytes, to be read in. Set up here as a variable in
* case we want someday to try to optimize it. */
@@ -607,7 +607,7 @@
* @param readBackward True if we are searching backward, false if we
* are searching forward.
*/
- ByteSearcher(final byte[] bytesToFind, final long startRange,
+ private ByteSearcher(final byte[] bytesToFind, final long startRange,
final long endRange, final boolean readBackward) {
this.bytesToFind = bytesToFind;
this.startRange = startRange;
Modified: trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java 2009-01-20 12:49:30 UTC (rev 10616)
+++ trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java 2009-01-20 13:42:30 UTC (rev 10617)
@@ -949,7 +949,7 @@
/**
* Inner class for storing font family members.
*/
- private static class FontFamilyMember {
+ private final class FontFamilyMember {
/** The encoding for this instance. */
private final EncodingVector encoding;
@@ -993,7 +993,7 @@
* instance.
* @param simulateStretch he "simulate-stretch" value for this instance.
*/
- FontFamilyMember(
+ private FontFamilyMember(
final EncodingVector encoding,
final String style,
final String weight,
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/PatternGenerator.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/PatternGenerator.java 2009-01-20 12:49:30 UTC (rev 10616)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/PatternGenerator.java 2009-01-20 13:42:30 UTC (rev 10617)
@@ -211,10 +211,12 @@
/* End of Constants from TeX code. */
/* Start of struct definitions from TeX code. */
- private class Opword {
+ private final class Opword {
private int dot;
private int val;
private int op;
+
+ private Opword() { }
}
/* End of struct definitions from TeX code. */
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java 2009-01-20 12:49:30 UTC (rev 10616)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java 2009-01-20 13:42:30 UTC (rev 10617)
@@ -86,9 +86,6 @@
public abstract class EncodingVector extends Encoding
implements org.axsl.ps.EncodingVector, Serializable {
- /** Constant needed for serialization. */
- private static final long serialVersionUID = 6967489975814026068L;
-
/** The name of the undefined glyph. */
public static final String NOTDEF = ".notdef";
@@ -96,6 +93,9 @@
public static final String STANDARD_MACINTOSH_ORDERING
= "MacStandardEncoding";
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = 6967489975814026068L;
+
/**
* A map of all of the predefined encodings that have already been
* instantiated. The key to the map is a String containing the name of the
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsCharStringsDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsCharStringsDictionary.java 2009-01-20 12:49:30 UTC (rev 10616)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsCharStringsDictionary.java 2009-01-20 13:42:30 UTC (rev 10617)
@@ -36,6 +36,9 @@
import java.math.BigDecimal;
+/**
+ * A Type 1 font "CharStrings" dictionary.
+ */
public class PsCharStringsDictionary extends PsDictionaryWrapper {
/** Key to the "StdVW" entry. */
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsMetricsDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsMetricsDictionary.java 2009-01-20 12:49:30 UTC (rev 10616)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsMetricsDictionary.java 2009-01-20 13:42:30 UTC (rev 10617)
@@ -31,6 +31,9 @@
import org.foray.ps.PsDictionary;
import org.foray.ps.PsDictionaryWrapper;
+/**
+ * A Type 1 font "Metrics" dictionary.
+ */
public class PsMetricsDictionary extends PsDictionaryWrapper {
/**
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsPrivateDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsPrivateDictionary.java 2009-01-20 12:49:30 UTC (rev 10616)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsPrivateDictionary.java 2009-01-20 13:42:30 UTC (rev 10617)
@@ -36,6 +36,9 @@
import java.math.BigDecimal;
+/**
+ * A Type 1 font "Private" dictionary.
+ */
public class PsPrivateDictionary extends PsDictionaryWrapper {
/** Key to the "StdVW" entry. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-03-10 21:30:44
|
Revision: 10632
http://foray.svn.sourceforge.net/foray/?rev=10632&view=rev
Author: victormote
Date: 2009-03-10 21:30:35 +0000 (Tue, 10 Mar 2009)
Log Message:
-----------
1. Rename some instance variables for clarity.
2. Improvements to javadoc.
Modified Paths:
--------------
trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java
Modified: trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java 2009-02-25 03:49:15 UTC (rev 10631)
+++ trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java 2009-03-10 21:30:35 UTC (rev 10632)
@@ -38,7 +38,7 @@
public static final String EMPTY_STRING = "";
/** The null terminator character, used to mark the end of Strings in char arrays in some
- * applications. */
+ * applications, U+0000. */
public static final char NULL_TERMINATOR = 0;
/** The lowest integer value that cannot be expressed with one base-10
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java 2009-02-25 03:49:15 UTC (rev 10631)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java 2009-03-10 21:30:35 UTC (rev 10632)
@@ -289,7 +289,7 @@
while (p > 0
&& p < this.patternKeys.arraySize()) {
- if (this.patternKeys.getSc(p) == Character.MAX_VALUE) {
+ if (this.patternKeys.getKeyChar(p) == Character.MAX_VALUE) {
if (this.patternKeys.getKv().compareNullTerminated(
this.patternKeys.getLo(p), word, i) == 0) {
/* Data pointer is in eq[] */
@@ -304,7 +304,7 @@
}
return;
}
- final int d = sp - this.patternKeys.getSc(p);
+ final int d = sp - this.patternKeys.getKeyChar(p);
if (d == 0) {
if (sp == 0) {
break;
@@ -317,11 +317,11 @@
// the null char ( splitchar == 0 )
while (q > 0
&& q < this.patternKeys.arraySize()) {
- if (this.patternKeys.getSc(q) == Character.MAX_VALUE) {
+ if (this.patternKeys.getKeyChar(q) == Character.MAX_VALUE) {
/* Stop at compressed branch. */
break;
}
- if (this.patternKeys.getSc(q) == 0) {
+ if (this.patternKeys.getKeyChar(q) == 0) {
values = getValues(this.patternKeys.getEq(q));
int j = index;
for (int k = 0; k < values.length; k++) {
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java 2009-02-25 03:49:15 UTC (rev 10631)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java 2009-03-10 21:30:35 UTC (rev 10632)
@@ -41,42 +41,37 @@
import java.util.Stack;
/**
- * <p>A map whose key is always a String, and whose value is a char, usually used to store an index
- * into some other data structure.
- * This class is intended to serve as base class or helper class for natural-language dictionaries
+ * <p>A map whose key is always a {@link CharSequence} (usually a {@link String}), and whose value
+ * is a char, usually used to store an index into some other data structure.
+ * This class is intended to serve as a base class or helper class for natural-language dictionaries
* and similar data structures.</p>
*
- * <h2>Ternary Search Tree.</h2>
- *
* <p>A ternary search tree is a hybrid between a binary tree and a digital search tree (trie).
* Ternary trees have some nice properties, including the following:
* <ul>
* <li>The tree can be traversed in sorted order.</li>
* <li>Partial matches (wildcards) can be implemented.</li>
- * <li>Retrieval of all keys within a given distance from the target is
- * possible.</li>
- * <li>The storage requirements are higher than a binary tree but a lot less
- * than a trie.</li>
+ * <li>Retrieval of all keys within a given distance from the target is possible.</li>
+ * <li>The storage requirements are higher than a binary tree but a lot less than a trie.</li>
* <li>Performance is comparable with a hash table.
- * Sometimes it outperforms a hash function, and can usually determine a miss
- * faster than a hash.</li>
+ * Sometimes it outperforms a hash function, and can usually determine a miss faster than a
+ * hash.</li>
* </ul>
* </p>
*
* <p>In this implementation the value is a char (think "unsigned short"), and is stored in the leaf
* nodes of the tree.
* This limits the number of nodes to 65,536.
- * Branches that contain only one key are compressed to one node by storing a
- * pointer to the trailer substring of the key.
- * A compressed branch needs only one node per key plus the size of the string
- * key.
- * Compressed branches are decompressed as needed when another key with same
- * prefix is inserted. This saves a lot of space, especially for long keys.</p>
+ * Branches that contain only one key are compressed to one node by storing a pointer to the trailer
+ * substring of the key.
+ * A compressed branch needs only one node per key plus the size of the string key.
+ * Compressed branches are decompressed as needed when another key with same prefix is inserted.
+ * This saves a lot of space, especially for long keys.</p>
*
- * <p>This class could be extended to or embedded in a general map that would
- * allow arbitrary objects to be values in the map.
- * One scheme for doing so would be to create an array of the value Objects,
- * and use this class to store the indexes to that array.</p>
+ * <p>This class could be extended to or embedded in a general map that would allow arbitrary
+ * objects to be values in the map.
+ * One scheme for doing so would be to create an array of the value Objects, and use this class to
+ * store the indexes to that array.</p>
*/
public class TernaryTree implements Cloneable, Serializable {
@@ -89,49 +84,62 @@
/** Constant used for serialization. */
private static final long serialVersionUID = 240904407206584695L;
- /**
- * We use four arrays to represent a node.
- * It is tempting to group these four arrays into a private inner class,
- * and the original author of this class left documentation kind of
- * apologizing for not doing so.
- * However, experimentation shows that the extra object references created
- * when doing so more than doubles the size of the serialized instance, and
- * therefore presumably does approximately the same to memory consumption.
- * Since a light memory footprint is one of the main design considerations
- * for this class, we will use the original parallel arrays instead.
+ /*
+ * We use four arrays of equal size to represent the nodes in this tree.
+ * A given node /n/ is represented by the values in the arrays lo, hi, eq, and sc.
+ * It is tempting to group these four arrays into a private inner class, and the original author
+ * of this class left documentation kind of apologizing for not doing so.
+ * However, experimentation shows that the extra object references created when doing so more
+ * than doubles the size of the serialized instance, and therefore presumably does approximately
+ * the same to memory consumption.
+ * Since a light memory footprint is one of the main design considerations for this class, we
+ * will use the original parallel arrays instead.
*/
/**
- * Pointer to low branch and to rest of the key when it is
- * stored directly in this node, we don't have unions in java!
+ * If {@link #keyChar} is a valid Unicode character, this array contains the index to the node
+ * containing the "low" branch, that is the branch that should be traversed to find a char
+ * that is less than {@link #keyChar}.
+ * If {@link #keyChar} is equal to U+FFFF, the compressed branch indicator, then this array
+ * instead contains the index into {@link #compressedKeys} that contains the first char in the
+ * compressed portion of the key.
*/
private char[] lo;
/**
- * Pointer to high branch.
+ * The index to the node containing the "hi" branch, that is the branch that should be traversed
+ * to find a char that is greater than {@link #keyChar}.
*/
private char[] hi;
/**
- * Pointer to equal branch and to data when this node is a string
- * terminator.
+ * If {@link #keyChar} is a valid Unicode character, this array contains the index to the node
+ * containing the "equal" branch, that is the branch that should be traversed to find a char
+ * that is equal to {@link #keyChar}.
+ * If {@link #keyChar} is equal to U+0000, the string terminator, then this array instead
+ * contains value for this map element.
*/
private char[] eq;
/**
- * <P>The character stored in this node: splitchar
+ * <P>The character, which is part of the key, stored in this node.
* Two special values are reserved:</P>
- * <ul><li>0x0000 as string terminator</li>
- * <li>0xFFFF to indicate that the branch starting at
- * this node is compressed</li></ul>
- * <p>This shouldn't be a problem if we give the usual semantics to
- * strings since 0xFFFF is garanteed not to be an Unicode character.</p>
+ * <ul>
+ * <li>0x0000 is the string terminator. If the node contains this value, then the search is
+ * done and the value in {@link #eq} should be returned.</li>
+ * <li>0xFFFF to indicate that the branch starting at this node is compressed.
+ * This shouldn't be a problem if we give the usual semantics to strings since 0xFFFF is
+ * guaranteed not to be a valid Unicode character.</li>
+ * </ul>
*/
- private char[] sc;
+ private char[] keyChar;
- /** This vector holds the trailing of the keys when the branch is
- * compressed. */
- private CharVector kv;
+ /** This vector holds the compressed portion of a key when the branch is compressed.
+ * It is simply a series of word fragments, each followed by a
+ * {@link StringUtil#NULL_TERMINATOR}.
+ * The index to the start of the compressed portion of the key for a given node in the tree is
+ * found in the {@link #lo} value for the node. */
+ private CharVector compressedKeys;
/** The index of the root of the current branch?? */
private char root;
@@ -159,8 +167,8 @@
this.lo = new char[TernaryTree.BLOCK_SIZE];
this.hi = new char[TernaryTree.BLOCK_SIZE];
this.eq = new char[TernaryTree.BLOCK_SIZE];
- this.sc = new char[TernaryTree.BLOCK_SIZE];
- this.kv = new CharVector();
+ this.keyChar = new char[TernaryTree.BLOCK_SIZE];
+ this.compressedKeys = new CharVector();
}
/**
@@ -220,46 +228,46 @@
this.hi[pToUse] = 0;
if (len > 0) {
/* Indicates branch is compressed */
- this.sc[pToUse] = Character.MAX_VALUE;
+ this.keyChar[pToUse] = Character.MAX_VALUE;
/* Use "lo" to hold pointer to key. */
- this.lo[pToUse] = (char) this.kv.add(key, start, len);
- this.kv.add(StringUtil.NULL_TERMINATOR);
+ this.lo[pToUse] = (char) this.compressedKeys.add(key, start, len);
+ this.compressedKeys.add(StringUtil.NULL_TERMINATOR);
} else {
- this.sc[pToUse] = 0;
+ this.keyChar[pToUse] = 0;
this.lo[pToUse] = 0;
}
return pToUse;
}
- if (this.sc[pToUse] == Character.MAX_VALUE) {
+ if (this.keyChar[pToUse] == Character.MAX_VALUE) {
final char pp = this.freenode++;
this.lo[pp] = this.lo[pToUse];
this.eq[pp] = this.eq[pToUse];
this.lo[pToUse] = 0;
if (len > 0) {
- this.sc[pToUse] = this.kv.get(this.lo[pp]);
+ this.keyChar[pToUse] = this.compressedKeys.get(this.lo[pp]);
this.eq[pToUse] = pp;
this.lo[pp]++;
- if (this.kv.get(this.lo[pp]) == 0) {
+ if (this.compressedKeys.get(this.lo[pp]) == 0) {
this.lo[pp] = 0;
- this.sc[pp] = 0;
+ this.keyChar[pp] = 0;
this.hi[pp] = 0;
} else {
- this.sc[pp] = Character.MAX_VALUE;
+ this.keyChar[pp] = Character.MAX_VALUE;
}
} else {
- this.sc[pp] = Character.MAX_VALUE;
+ this.keyChar[pp] = Character.MAX_VALUE;
this.hi[pToUse] = pp;
- this.sc[pToUse] = 0;
+ this.keyChar[pToUse] = 0;
this.eq[pToUse] = value;
this.length++;
return pToUse;
}
}
final char s = key[start];
- if (s < this.sc[pToUse]) {
+ if (s < this.keyChar[pToUse]) {
this.lo[pToUse] = insert(this.lo[pToUse], key, start, value);
- } else if (s == this.sc[pToUse]) {
+ } else if (s == this.keyChar[pToUse]) {
if (s != 0) {
this.eq[pToUse] = insert(this.eq[pToUse], key, start + 1,
value);
@@ -297,8 +305,8 @@
char c;
while (p != 0) {
- if (this.sc[p] == Character.MAX_VALUE) {
- if (this.kv.compareNullTerminated(this.lo[p], key, i) == 0) {
+ if (this.keyChar[p] == Character.MAX_VALUE) {
+ if (this.compressedKeys.compareNullTerminated(this.lo[p], key, i) == 0) {
return this.eq[p];
}
return -1;
@@ -310,7 +318,7 @@
} else {
c = key.charAt(i);
}
- d = c - this.sc[p];
+ d = c - this.keyChar[p];
if (d == 0) {
if (c == 0) {
return this.eq[p];
@@ -358,8 +366,8 @@
System.arraycopy(this.eq, 0, na, 0, len);
this.eq = na;
na = new char[newsize];
- System.arraycopy(this.sc, 0, na, 0, len);
- this.sc = na;
+ System.arraycopy(this.keyChar, 0, na, 0, len);
+ this.keyChar = na;
}
/**
@@ -388,8 +396,8 @@
t.lo = this.lo.clone();
t.hi = this.hi.clone();
t.eq = this.eq.clone();
- t.sc = this.sc.clone();
- t.kv = (CharVector) this.kv.clone();
+ t.keyChar = this.keyChar.clone();
+ t.compressedKeys = (CharVector) this.compressedKeys.clone();
t.root = this.root;
t.freenode = this.freenode;
t.length = this.length;
@@ -453,7 +461,7 @@
* This method should be run only once, immediately after the tree is completely built.
*/
public void optimize() {
- /* Each node stores a character (splitchar) which is part of
+ /* Each node stores a character which is part of
* some key(s). In a compressed branch (one that only contain
* a single string key) the trailer of the key which is not
* already in nodes is stored externally in the kv array.
@@ -476,8 +484,8 @@
kx.alloc(1);
final TernaryTree map = new TernaryTree();
compact(kx, map, this.root);
- this.kv = kx;
- this.kv.trimToSize();
+ this.compressedKeys = kx;
+ this.compressedKeys.trimToSize();
}
/**
@@ -492,18 +500,18 @@
if (p == 0) {
return;
}
- if (this.sc[p] == Character.MAX_VALUE) {
- k = map.find(this.kv, this.lo[p]);
+ if (this.keyChar[p] == Character.MAX_VALUE) {
+ k = map.find(this.compressedKeys, this.lo[p]);
if (k < 0) {
final int start = this.lo[p];
- k = kx.addNullTerminated(this.kv, start);
+ k = kx.addNullTerminated(this.compressedKeys, start);
kx.add(StringUtil.NULL_TERMINATOR);
map.insert(kx, k, (char) k);
}
this.lo[p] = (char) k;
} else {
compact(kx, map, this.lo[p]);
- if (this.sc[p] != 0) {
+ if (this.keyChar[p] != 0) {
compact(kx, map, this.eq[p]);
}
compact(kx, map, this.hi[p]);
@@ -625,7 +633,7 @@
}
if (this.cur != 0
- && TernaryTree.this.sc[this.cur] == 0) {
+ && TernaryTree.this.keyChar[this.cur] == 0) {
return TernaryTree.this.lo[this.cur];
}
@@ -636,10 +644,10 @@
i.child++;
switch (i.child) {
case 1:
- if (TernaryTree.this.sc[i.parent] != 0) {
+ if (TernaryTree.this.keyChar[i.parent] != 0) {
res = TernaryTree.this.eq[i.parent];
this.ns.push(i.clone());
- this.ks.append(TernaryTree.this.sc[i.parent]);
+ this.ks.append(TernaryTree.this.keyChar[i.parent]);
} else {
i.child++;
this.ns.push(i.clone());
@@ -681,12 +689,12 @@
for (;;) {
// first go down on low branch until leaf or compressed branch
while (this.cur != 0) {
- if (TernaryTree.this.sc[this.cur] == Character.MAX_VALUE) {
+ if (TernaryTree.this.keyChar[this.cur] == Character.MAX_VALUE) {
leaf = true;
break;
}
this.ns.push(new Item((char) this.cur, '\u0000'));
- if (TernaryTree.this.sc[this.cur] == 0) {
+ if (TernaryTree.this.keyChar[this.cur] == 0) {
leaf = true;
break;
}
@@ -704,10 +712,10 @@
// The current node should be a data node and
// the key should be in the key stack (at least partially)
final StringBuilder buf = new StringBuilder(this.ks.toString());
- if (TernaryTree.this.sc[this.cur] == Character.MAX_VALUE) {
+ if (TernaryTree.this.keyChar[this.cur] == Character.MAX_VALUE) {
int p = TernaryTree.this.lo[this.cur];
- while (TernaryTree.this.kv.get(p) != 0) {
- buf.append(TernaryTree.this.kv.get(p++));
+ while (TernaryTree.this.compressedKeys.get(p) != 0) {
+ buf.append(TernaryTree.this.compressedKeys.get(p++));
}
}
this.curkey = buf.toString();
@@ -731,7 +739,7 @@
*/
protected CharVector getKv() {
/* TODO: Make this method private. It should not be exposed. */
- return this.kv;
+ return this.compressedKeys;
}
/**
@@ -739,9 +747,9 @@
* @param index The index to the element to be returned.
* @return An element of the sc array.
*/
- protected char getSc(final int index) {
+ protected char getKeyChar(final int index) {
/* TODO: Make this method private. It should not be exposed. */
- return this.sc[index];
+ return this.keyChar[index];
}
/**
@@ -781,7 +789,7 @@
*/
protected int arraySize() {
/* TODO: Make this method private. It should not be exposed. */
- return this.sc.length;
+ return this.keyChar.length;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-03-10 21:53:01
|
Revision: 10634
http://foray.svn.sourceforge.net/foray/?rev=10634&view=rev
Author: victormote
Date: 2009-03-10 21:53:00 +0000 (Tue, 10 Mar 2009)
Log Message:
-----------
Clean up some casting that is no longer needed with generics.
Modified Paths:
--------------
trunk/foray/foray-common/src/java/org/foray/common/CharVector.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java
Modified: trunk/foray/foray-common/src/java/org/foray/common/CharVector.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/CharVector.java 2009-03-10 21:51:38 UTC (rev 10633)
+++ trunk/foray/foray-common/src/java/org/foray/common/CharVector.java 2009-03-10 21:53:00 UTC (rev 10634)
@@ -96,7 +96,7 @@
/**
* {@inheritDoc}
*/
- public Object clone() {
+ public CharVector clone() {
final CharVector clone = new CharVector();
clone.backingArray = new char[this.nextIndex];
System.arraycopy(this.backingArray, 0, clone.backingArray, 0,
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java 2009-03-10 21:51:38 UTC (rev 10633)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java 2009-03-10 21:53:00 UTC (rev 10634)
@@ -397,7 +397,7 @@
t.hi = this.hi.clone();
t.eq = this.eq.clone();
t.keyChar = this.keyChar.clone();
- t.compressedKeys = (CharVector) this.compressedKeys.clone();
+ t.compressedKeys = this.compressedKeys.clone();
t.root = this.root;
t.freenode = this.freenode;
t.length = this.length;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-03-10 23:36:12
|
Revision: 10639
http://foray.svn.sourceforge.net/foray/?rev=10639&view=rev
Author: victormote
Date: 2009-03-10 23:35:57 +0000 (Tue, 10 Mar 2009)
Log Message:
-----------
Make the clone() method return a more specific type.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsGraphicsState.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsSystemDict.java
trunk/foray/scripts/checkstyle-config.xml
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java 2009-03-10 23:22:28 UTC (rev 10638)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java 2009-03-10 23:35:57 UTC (rev 10639)
@@ -394,7 +394,7 @@
/**
* {@inheritDoc}
*/
- public Object clone() {
+ public TernaryTree clone() {
final TernaryTree t = new TernaryTree();
t.lo = this.lo.clone();
t.hi = this.hi.clone();
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsGraphicsState.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsGraphicsState.java 2009-03-10 23:22:28 UTC (rev 10638)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsGraphicsState.java 2009-03-10 23:35:57 UTC (rev 10639)
@@ -144,7 +144,7 @@
/**
* {@inheritDoc}
*/
- public Object clone() {
+ public PsGraphicsState clone() {
PsGraphicsState clone;
try {
clone = (PsGraphicsState) super.clone();
@@ -155,14 +155,6 @@
}
/**
- * Makes a clone of this.
- * @return The newly created clone.
- */
- public PsGraphicsState makeClone() {
- return (PsGraphicsState) this.clone();
- }
-
- /**
* Sets the color space.
* @param colorSpace The new colorspace.
*/
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsSystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsSystemDict.java 2009-03-10 23:22:28 UTC (rev 10638)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsSystemDict.java 2009-03-10 23:35:57 UTC (rev 10639)
@@ -2118,7 +2118,7 @@
private void gsave() throws PsOperatorException {
final PsGraphicsStateStack graphicsStateStack = getInterpreter().getGraphicsStateStack();
final PsGraphicsState graphicsState = currentGS();
- final PsGraphicsState graphicsStateClone = graphicsState.makeClone();
+ final PsGraphicsState graphicsStateClone = graphicsState.clone();
graphicsStateStack.push(graphicsStateClone);
}
Modified: trunk/foray/scripts/checkstyle-config.xml
===================================================================
--- trunk/foray/scripts/checkstyle-config.xml 2009-03-10 23:22:28 UTC (rev 10638)
+++ trunk/foray/scripts/checkstyle-config.xml 2009-03-10 23:35:57 UTC (rev 10639)
@@ -215,35 +215,46 @@
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>
+
<module name="GenericIllegalRegexp">
<property name="ignoreComments" value="true"/>
<!-- . matches any character, so we need to escape it and use \. to match dots. -->
<property name="format" value="System\.exit"/>
<property name="message" value="Never exit the jvm, except in void main(String[])."/>
</module>
+
<module name="GenericIllegalRegexp">
<property name="ignoreComments" value="true"/>
<property name="format" value="printStackTrace"/>
<property name="message" value="Do not dump a stacktrace, except in void main(String[])."/>
</module>
+
<module name="GenericIllegalRegexp">
<property name="ignoreComments" value="true"/>
<property name="format" value=" System.out.print"/>
<property name="message" value="Use logging instead of System.out, except in void
main(String[])."/>
</module>
+
<module name="GenericIllegalRegexp">
<property name="ignoreComments" value="true"/>
<property name="format" value=" System.err.print"/>
<property name="message" value="Use logging instead of System.err, except in void
main(String[])."/>
</module>
+
<module name="GenericIllegalRegexp">
<property name="ignoreComments" value="true"/>
<property name="format" value="(FOP|fop|Fop)"/>
<property name="message" value="Avoid legacy references to FOP."/>
</module>
+ <module name="GenericIllegalRegexp">
+ <property name="ignoreComments" value="false"/>
+ <property name="format" value="Object clone()"/>
+ <property name="message" value="Return a more specific type when cloning."/>
+ </module>
+
</module>
<!-- Make sure each package has javadoc package.html -->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-03-10 23:48:29
|
Revision: 10640
http://foray.svn.sourceforge.net/foray/?rev=10640&view=rev
Author: victormote
Date: 2009-03-10 23:48:26 +0000 (Tue, 10 Mar 2009)
Log Message:
-----------
Conform project Eclipse compiler settings to the defaults.
Modified Paths:
--------------
trunk/foray/foray-app/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-areatree/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-common/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-core/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-font/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-fotree/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-graphic/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-hyphen/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-layout/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-mif/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-output/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-pdf/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-pioneer/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-pretty/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-ps/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-render/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-speech/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-text/.settings/org.eclipse.jdt.core.prefs
Modified: trunk/foray/foray-app/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-app/.settings/org.eclipse.jdt.core.prefs 2009-03-10 23:35:57 UTC (rev 10639)
+++ trunk/foray/foray-app/.settings/org.eclipse.jdt.core.prefs 2009-03-10 23:48:26 UTC (rev 10640)
@@ -1,4 +1,4 @@
-#Tue Mar 20 11:12:52 MDT 2007
+#Tue Mar 10 17:44:06 MDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,8 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
@@ -33,11 +34,14 @@
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
@@ -47,16 +51,20 @@
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.5
Modified: trunk/foray/foray-areatree/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-areatree/.settings/org.eclipse.jdt.core.prefs 2009-03-10 23:35:57 UTC (rev 10639)
+++ trunk/foray/foray-areatree/.settings/org.eclipse.jdt.core.prefs 2009-03-10 23:48:26 UTC (rev 10640)
@@ -1,4 +1,4 @@
-#Tue Mar 20 11:12:52 MDT 2007
+#Tue Mar 10 17:44:13 MDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,8 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
@@ -33,11 +34,14 @@
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
@@ -47,16 +51,20 @@
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.5
Modified: trunk/foray/foray-common/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-common/.settings/org.eclipse.jdt.core.prefs 2009-03-10 23:35:57 UTC (rev 10639)
+++ trunk/foray/foray-common/.settings/org.eclipse.jdt.core.prefs 2009-03-10 23:48:26 UTC (rev 10640)
@@ -1,4 +1,4 @@
-#Tue Mar 20 11:12:52 MDT 2007
+#Tue Mar 10 17:44:20 MDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,8 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
@@ -33,11 +34,14 @@
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
@@ -47,16 +51,20 @@
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.5
Modified: trunk/foray/foray-core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-core/.settings/org.eclipse.jdt.core.prefs 2009-03-10 23:35:57 UTC (rev 10639)
+++ trunk/foray/foray-core/.settings/org.eclipse.jdt.core.prefs 2009-03-10 23:48:26 UTC (rev 10640)
@@ -1,4 +1,4 @@
-#Tue Mar 20 11:12:52 MDT 2007
+#Tue Mar 10 17:44:26 MDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,8 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
@@ -33,11 +34,14 @@
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
@@ -47,16 +51,20 @@
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.5
Modified: trunk/foray/foray-font/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-font/.settings/org.eclipse.jdt.core.prefs 2009-03-10 23:35:57 UTC (rev 10639)
+++ trunk/foray/foray-font/.settings/org.eclipse.jdt.core.prefs 2009-03-10 23:48:26 UTC (rev 10640)
@@ -1,4 +1,4 @@
-#Tue Mar 20 11:12:52 MDT 2007
+#Tue Mar 10 17:44:32 MDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,8 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
@@ -33,11 +34,14 @@
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
@@ -47,16 +51,20 @@
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.5
Modified: trunk/foray/foray-fotree/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-fotree/.settings/org.eclipse.jdt.core.prefs 2009-03-10 23:35:57 UTC (rev 10639)
+++ trunk/foray/foray-fotree/.settings/org.eclipse.jdt.core.prefs 2009-03-10 23:48:26 UTC (rev 10640)
@@ -1,4 +1,4 @@
-#Tue Mar 20 11:12:52 MDT 2007
+#Tue Mar 10 17:44:39 MDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,8 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
@@ -33,11 +34,14 @@
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
@@ -47,16 +51,20 @@
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.5
Modified: trunk/foray/foray-graphic/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-graphic/.settings/org.eclipse.jdt.core.prefs 2009-03-10 23:35:57 UTC (rev 10639)
+++ trunk/foray/foray-graphic/.settings/org.eclipse.jdt.core.prefs 2009-03-10 23:48:26 UTC (rev 10640)
@@ -1,4 +1,4 @@
-#Tue Mar 20 11:12:52 MDT 2007
+#Tue Mar 10 17:44:45 MDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,8 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
@@ -33,11 +34,14 @@
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
@@ -47,16 +51,20 @@
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.5
Modified: trunk/foray/foray-hyphen/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-hyphen/.settings/org.eclipse.jdt.core.prefs 2009-03-10 23:35:57 UTC (rev 10639)
+++ trunk/foray/foray-hyphen/.settings/org.eclipse.jdt.core.prefs 2009-03-10 23:48:26 UTC (rev 10640)
@@ -1,4 +1,4 @@
-#Tue Mar 20 11:12:52 MDT 2007
+#Tue Mar 10 17:44:51 MDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,8 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
@@ -33,11 +34,14 @@
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
@@ -47,16 +51,20 @@
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt....
[truncated message content] |
|
From: <vic...@us...> - 2009-03-12 15:01:50
|
Revision: 10645
http://foray.svn.sourceforge.net/foray/?rev=10645&view=rev
Author: victormote
Date: 2009-03-12 15:01:40 +0000 (Thu, 12 Mar 2009)
Log Message:
-----------
Make the primitive vector classes use vector-like method names.
Modified Paths:
--------------
trunk/foray/foray-common/src/java/org/foray/common/ByteVector.java
trunk/foray/foray-common/src/java/org/foray/common/ByteVectorPacked.java
trunk/foray/foray-common/src/java/org/foray/common/CharVector.java
trunk/foray/foray-common/src/javatest/org/foray/common/TestByteVectorPacked.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/CharacterSequence4a.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java
Modified: trunk/foray/foray-common/src/java/org/foray/common/ByteVector.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/ByteVector.java 2009-03-12 14:49:57 UTC (rev 10644)
+++ trunk/foray/foray-common/src/java/org/foray/common/ByteVector.java 2009-03-12 15:01:40 UTC (rev 10645)
@@ -97,7 +97,7 @@
* @param index The 0-based index into the vector.
* @param val The byte value to be placed in the vector.
*/
- public void put(final int index, final byte val) {
+ public void set(final int index, final byte val) {
this.backingArray[index] = val;
}
Modified: trunk/foray/foray-common/src/java/org/foray/common/ByteVectorPacked.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/ByteVectorPacked.java 2009-03-12 14:49:57 UTC (rev 10644)
+++ trunk/foray/foray-common/src/java/org/foray/common/ByteVectorPacked.java 2009-03-12 15:01:40 UTC (rev 10645)
@@ -127,7 +127,7 @@
* @param value The half-byte value to be placed in the vector. This must be in the range
* 0x0 thru 0xF.
*/
- public void put(final int index, final byte value) {
+ public void set(final int index, final byte value) {
if (value < 0
|| value > WKConstants.MAX_4_BIT_UNSIGNED_BYTE) {
throw new IllegalArgumentException("Expected val in the range 0x0 to 0xF: " + value);
@@ -146,7 +146,7 @@
newValue = (byte) (newValue | shiftedValue);
}
- this.backingVector.put(byteIndex, newValue);
+ this.backingVector.set(byteIndex, newValue);
}
/**
Modified: trunk/foray/foray-common/src/java/org/foray/common/CharVector.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/CharVector.java 2009-03-12 14:49:57 UTC (rev 10644)
+++ trunk/foray/foray-common/src/java/org/foray/common/CharVector.java 2009-03-12 15:01:40 UTC (rev 10645)
@@ -126,7 +126,7 @@
* @param index The 0-based index into the vector.
* @param val The char value to be placed in the vector.
*/
- public void put(final int index, final char val) {
+ public void set(final int index, final char val) {
if (index >= this.length()) {
throw new IndexOutOfBoundsException("Index exceeds length of vector.");
}
@@ -146,7 +146,7 @@
final int startingTargetIndex = (char) alloc(size);
int targetIndex = startingTargetIndex;
for (int i = start; i < start + size; i++) {
- this.put(targetIndex, source[i]);
+ this.set(targetIndex, source[i]);
targetIndex ++;
}
return startingTargetIndex;
@@ -165,7 +165,7 @@
final int startingTargetIndex = (char) alloc(size);
int targetIndex = startingTargetIndex;
for (int i = start; i < start + size; i++) {
- this.put(targetIndex, source.charAt(i));
+ this.set(targetIndex, source.charAt(i));
targetIndex ++;
}
return startingTargetIndex;
Modified: trunk/foray/foray-common/src/javatest/org/foray/common/TestByteVectorPacked.java
===================================================================
--- trunk/foray/foray-common/src/javatest/org/foray/common/TestByteVectorPacked.java 2009-03-12 14:49:57 UTC (rev 10644)
+++ trunk/foray/foray-common/src/javatest/org/foray/common/TestByteVectorPacked.java 2009-03-12 15:01:40 UTC (rev 10645)
@@ -55,7 +55,7 @@
/* Put the content into a vector. */
for (int i = 0; i < TestByteVectorPacked.testSequence01.length; i++) {
- testVector.put(i, TestByteVectorPacked.testSequence01[i]);
+ testVector.set(i, TestByteVectorPacked.testSequence01[i]);
}
assertEquals(TestByteVectorPacked.testSequence01.length, testVector.length());
assertEquals(10, testVector.lengthInBytes());
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/CharacterSequence4a.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/CharacterSequence4a.java 2009-03-12 14:49:57 UTC (rev 10644)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/CharacterSequence4a.java 2009-03-12 15:01:40 UTC (rev 10645)
@@ -213,7 +213,7 @@
context);
if (textTransform != TextTransform.NONE) {
for (int i = 0; i < charArray.length(); i++) {
- charArray.put(i, applyTextTransform(context, charArray, i,
+ charArray.set(i, applyTextTransform(context, charArray, i,
textTransform));
}
}
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java 2009-03-12 14:49:57 UTC (rev 10644)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java 2009-03-12 15:01:40 UTC (rev 10645)
@@ -176,16 +176,16 @@
/* If the index is odd, place in the low-order bits. */
final byte currentValue = this.patternValues.get(packedIndex);
final byte newValue = (byte) (currentValue | packedValue);
- this.patternValues.put(packedIndex, newValue);
+ this.patternValues.set(packedIndex, newValue);
} else {
/* If the index is even, place in the high-order bits. */
final byte newValue = (byte) (packedValue
<< WKConstants.BITS_PER_NIBBLE);
- this.patternValues.put(packedIndex, newValue);
+ this.patternValues.set(packedIndex, newValue);
}
}
/* Add the null terminator. */
- this.patternValues.put(bytesNeeded - 1 + offset, (byte) 0);
+ this.patternValues.set(bytesNeeded - 1 + offset, (byte) 0);
return offset;
}
@@ -435,7 +435,7 @@
final CharVector c = new CharVector(2);
c.alloc(2);
for (int i = 0; i < length; i++) {
- c.put(0, inputArray[offset + i]);
+ c.set(0, inputArray[offset + i]);
final int nc = this.classes.find(c, 0);
if (nc < 0) {
/* Found a non-letter character. Abort. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-03-12 15:37:07
|
Revision: 10646
http://foray.svn.sourceforge.net/foray/?rev=10646&view=rev
Author: victormote
Date: 2009-03-12 15:36:57 +0000 (Thu, 12 Mar 2009)
Log Message:
-----------
Make the alloc method private.
Modified Paths:
--------------
trunk/foray/foray-common/src/java/org/foray/common/CharVector.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java
trunk/foray/foray-hyphen/src/javatest/org/foray/hyphen/TestTernaryTree.java
Modified: trunk/foray/foray-common/src/java/org/foray/common/CharVector.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/CharVector.java 2009-03-12 15:01:40 UTC (rev 10645)
+++ trunk/foray/foray-common/src/java/org/foray/common/CharVector.java 2009-03-12 15:36:57 UTC (rev 10646)
@@ -32,7 +32,6 @@
*/
package org.foray.common;
-
import java.io.Serializable;
/**
@@ -346,13 +345,11 @@
* @param size The number of elements (chars) to be allocated.
* @return The index to the beginning of the allocated elements (chars).
*/
- public int alloc(final int size) {
+ private int alloc(final int size) {
final int index = this.nextIndex;
if (this.nextIndex + size >= this.backingArray.length) {
- final char[] newArray = new char[this.backingArray.length
- + this.blockSize];
- System.arraycopy(this.backingArray, 0, newArray, 0,
- this.backingArray.length);
+ final char[] newArray = new char[this.backingArray.length + this.blockSize];
+ System.arraycopy(this.backingArray, 0, newArray, 0, this.backingArray.length);
this.backingArray = newArray;
}
this.nextIndex += size;
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java 2009-03-12 15:01:40 UTC (rev 10645)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java 2009-03-12 15:36:57 UTC (rev 10646)
@@ -433,7 +433,7 @@
final int length) {
final char[] word = new char[length];
final CharVector c = new CharVector(2);
- c.alloc(2);
+ c.add(Character.MIN_VALUE);
for (int i = 0; i < length; i++) {
c.set(0, inputArray[offset + i]);
final int nc = this.classes.find(c, 0);
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java 2009-03-12 15:01:40 UTC (rev 10645)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTree.java 2009-03-12 15:36:57 UTC (rev 10646)
@@ -484,7 +484,6 @@
// ok, compact kv array
final CharVector kx = new CharVector();
- kx.alloc(1);
final TernaryTree map = new TernaryTree();
compact(kx, map, this.root);
this.compressedKeys = kx;
Modified: trunk/foray/foray-hyphen/src/javatest/org/foray/hyphen/TestTernaryTree.java
===================================================================
--- trunk/foray/foray-hyphen/src/javatest/org/foray/hyphen/TestTernaryTree.java 2009-03-12 15:01:40 UTC (rev 10645)
+++ trunk/foray/foray-hyphen/src/javatest/org/foray/hyphen/TestTernaryTree.java 2009-03-12 15:36:57 UTC (rev 10646)
@@ -43,7 +43,7 @@
/* This test was adapted from the tested class's main() method, which was
* the previous mode for testing. The expected values recorded below are
* those that were produced by running said method immediately before
- * creating the class, and are not independently known to be correct.*/
+ * creating this test class, and are not independently known to be correct.*/
final TernaryTree map = new TernaryTree();
map.insert("Carlos", 'C');
map.insert("Car", 'r');
@@ -51,12 +51,13 @@
map.insert("pa", 'p');
map.optimize();
+ assertEquals('C', (char) map.find("Carlos"));
assertEquals('r', (char) map.find("Car"));
- assertEquals('C', (char) map.find("Carlos"));
+ assertEquals('l', (char) map.find("palos"));
+ assertEquals('p', (char) map.find("pa"));
assertEquals('\uFFFF', (char) map.find("alto"));
assertEquals(4, map.size());
assertEquals(10, map.getNodeCount());
- assertEquals(5, map.getKv().length());
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-03-12 16:04:00
|
Revision: 10649
http://foray.svn.sourceforge.net/foray/?rev=10649&view=rev
Author: victormote
Date: 2009-03-12 16:03:48 +0000 (Thu, 12 Mar 2009)
Log Message:
-----------
Add "add" method, and remove one dependency on alloc.
Modified Paths:
--------------
trunk/foray/foray-common/src/java/org/foray/common/ByteVector.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java
Modified: trunk/foray/foray-common/src/java/org/foray/common/ByteVector.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/ByteVector.java 2009-03-12 15:58:38 UTC (rev 10648)
+++ trunk/foray/foray-common/src/java/org/foray/common/ByteVector.java 2009-03-12 16:03:48 UTC (rev 10649)
@@ -93,6 +93,15 @@
}
/**
+ * Adds one element to the vector.
+ * @param value The byte value to be added to the vector.
+ */
+ public void add(final byte value) {
+ alloc(1);
+ set(this.nextIndex - 1, value);
+ }
+
+ /**
* Place an item in the vector at a specific index.
* @param index The 0-based index into the vector.
* @param val The byte value to be placed in the vector.
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java 2009-03-12 15:58:38 UTC (rev 10648)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java 2009-03-12 16:03:48 UTC (rev 10649)
@@ -143,7 +143,7 @@
*/
public HyphenationTree() {
/* This reserves index 0, which we don't use. */
- this.patternValues.alloc(1);
+ this.patternValues.add((byte) 0x0);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-03-12 17:40:59
|
Revision: 10651
http://foray.svn.sourceforge.net/foray/?rev=10651&view=rev
Author: victormote
Date: 2009-03-12 17:40:56 +0000 (Thu, 12 Mar 2009)
Log Message:
-----------
Move the dependency on the hyphenation patterns from the App project to the hyphenation project, so that tests will run properly when just run on the hyphenation package.
Modified Paths:
--------------
trunk/foray/foray-app/.classpath
trunk/foray/foray-hyphen/.classpath
Modified: trunk/foray/foray-app/.classpath
===================================================================
--- trunk/foray/foray-app/.classpath 2009-03-12 17:01:55 UTC (rev 10650)
+++ trunk/foray/foray-app/.classpath 2009-03-12 17:40:56 UTC (rev 10651)
@@ -37,7 +37,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/FOraySpeech"/>
<classpathentry kind="lib" path="/FOray Lib-Build/ant/ant.jar" sourcepath="/FOray Lib-Build/ant/ant-src.zip"/>
<classpathentry kind="lib" path="/FOray Lib-Build/junit/junit-4.4.jar" sourcepath="/FOray Lib-Build/junit/junit-4.4-src.jar"/>
- <classpathentry kind="lib" path="/FOray Lib/foray-hyphen-0.4-rsrc.jar"/>
<classpathentry kind="lib" path="/FOray Lib/commons-io-1.4.jar" sourcepath="/FOray Lib-Build/commons-io/commons-io-1.4-sources.jar"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-hyphen/.classpath
===================================================================
--- trunk/foray/foray-hyphen/.classpath 2009-03-12 17:01:55 UTC (rev 10650)
+++ trunk/foray/foray-hyphen/.classpath 2009-03-12 17:40:56 UTC (rev 10651)
@@ -11,5 +11,6 @@
<classpathentry kind="lib" path="/FOray Lib/icu4j_3_4_3.jar"/>
<classpathentry kind="lib" path="/FOray Lib-Build/ant/ant.jar"/>
<classpathentry kind="lib" path="/FOray Lib-Build/junit/junit-4.4.jar" sourcepath="/FOray Lib-Build/junit/junit-4.4-src.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/foray-hyphen-0.4-rsrc.jar"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-03-12 18:25:43
|
Revision: 10654
http://foray.svn.sourceforge.net/foray/?rev=10654&view=rev
Author: victormote
Date: 2009-03-12 18:25:16 +0000 (Thu, 12 Mar 2009)
Log Message:
-----------
1. Use the new ByteVectorPacked class to simplify the storage of the pattern values.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java
trunk/foray/lib/foray-hyphen-0.4-rsrc.jar
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java 2009-03-12 17:43:26 UTC (rev 10653)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java 2009-03-12 18:25:16 UTC (rev 10654)
@@ -33,7 +33,7 @@
package org.foray.hyphen;
-import org.foray.common.ByteVector;
+import org.foray.common.ByteVectorPacked;
import org.foray.common.CharVector;
import org.foray.common.StringUtil;
import org.foray.common.WKConstants;
@@ -98,6 +98,9 @@
* is appended */
private static final int QTY_MARKER_CHARS = 3;
+ /** Value indicating the termination of a pattern value in the vector. */
+ private static final byte PATTERN_VALUES_TERMINATOR = (byte) 0xF;
+
/** The source of this tree. Used by testing routines to make sure that the serialized versions
* are getting used. */
private transient Source source;
@@ -126,7 +129,7 @@
* The pattern values themselves are stored as bytes, and are expected to be
* in the range of 0x01 through 0x05.</p>
*/
- private ByteVector patternValues = new ByteVector();
+ private ByteVectorPacked patternValues = new ByteVectorPacked();
/** The hyphenation exceptions. */
private Map<String, Hyphenation4a> exceptions
@@ -158,36 +161,16 @@
* @see #unpackValues(int)
*/
private int packValues(final String values) {
- final int stringLength = values.length();
- /* Bytes needed is half the length of the String, plus one byte for the
- * zero terminator, ... */
- int bytesNeeded = (stringLength >> 1) + 1;
- if ((stringLength & 1) == 1) {
- /* ... unless the String size is odd, in which case we need to round
- * up. */
- bytesNeeded ++;
- }
- final int offset = this.patternValues.alloc(bytesNeeded);
- for (int stringIndex = 0; stringIndex < stringLength; stringIndex++) {
+ final int start = this.patternValues.length();
+ for (int stringIndex = 0; stringIndex < values.length(); stringIndex++) {
final byte packedValue = (byte) ((values.charAt(stringIndex)
- '0' + 1) & WKConstants.MAX_4_BIT_UNSIGNED_BYTE);
- final int packedIndex = (stringIndex >> 1) + offset;
- if ((stringIndex & 1) == 1) {
- /* If the index is odd, place in the low-order bits. */
- final byte currentValue = this.patternValues.get(packedIndex);
- final byte newValue = (byte) (currentValue | packedValue);
- this.patternValues.set(packedIndex, newValue);
- } else {
- /* If the index is even, place in the high-order bits. */
- final byte newValue = (byte) (packedValue
- << WKConstants.BITS_PER_NIBBLE);
- this.patternValues.set(packedIndex, newValue);
- }
+ this.patternValues.add(packedValue);
}
- /* Add the null terminator. */
- this.patternValues.set(bytesNeeded - 1 + offset, (byte) 0);
+ /* Add the termination marker. */
+ this.patternValues.add(HyphenationTree.PATTERN_VALUES_TERMINATOR);
- return offset;
+ return start;
}
/**
@@ -229,19 +212,10 @@
final StringBuilder buf = new StringBuilder();
int packedIndex = start;
byte packedValue = this.patternValues.get(packedIndex++);
- while (packedValue != 0) {
- /* Unpack the high-order nibble. */
- char c = (char) ((packedValue >>> WKConstants.BITS_PER_NIBBLE) - 1);
+ while (packedValue != HyphenationTree.PATTERN_VALUES_TERMINATOR) {
+ final char c = (char) (packedValue - 1);
buf.append(c);
- /* Unpack the low-order nibble. */
- c = (char) (packedValue & WKConstants.MAX_4_BIT_UNSIGNED_BYTE);
- if (c == 0) {
- break;
- }
- c = (char) (c - 1);
- buf.append(c);
-
/* Load the next byte. */
packedValue = this.patternValues.get(packedIndex++);
}
Modified: trunk/foray/lib/foray-hyphen-0.4-rsrc.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-03-12 18:38:30
|
Revision: 10655
http://foray.svn.sourceforge.net/foray/?rev=10655&view=rev
Author: victormote
Date: 2009-03-12 18:38:16 +0000 (Thu, 12 Mar 2009)
Log Message:
-----------
Now that we don't have to zero-terminate the vector, leave the zeros alone, and store all values with their native value.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java
trunk/foray/lib/foray-hyphen-0.4-rsrc.jar
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java 2009-03-12 18:25:16 UTC (rev 10654)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java 2009-03-12 18:38:16 UTC (rev 10655)
@@ -33,10 +33,10 @@
package org.foray.hyphen;
+import org.foray.common.Bit;
import org.foray.common.ByteVectorPacked;
import org.foray.common.CharVector;
import org.foray.common.StringUtil;
-import org.foray.common.WKConstants;
import org.axsl.hyphen.HyphenationException;
@@ -163,8 +163,11 @@
private int packValues(final String values) {
final int start = this.patternValues.length();
for (int stringIndex = 0; stringIndex < values.length(); stringIndex++) {
- final byte packedValue = (byte) ((values.charAt(stringIndex)
- - '0' + 1) & WKConstants.MAX_4_BIT_UNSIGNED_BYTE);
+ /* Convert an ASCII numeral to its numeric value. For example, an ASCII numeral 0 (0x30)
+ * converts to 0x00. */
+ final byte rawValue = (byte) (values.charAt(stringIndex) - '0');
+ /* Ensure that all high-order bits are gone. */
+ final byte packedValue = Bit.maskHighOrderBits(rawValue);
this.patternValues.add(packedValue);
}
/* Add the termination marker. */
@@ -213,7 +216,7 @@
int packedIndex = start;
byte packedValue = this.patternValues.get(packedIndex++);
while (packedValue != HyphenationTree.PATTERN_VALUES_TERMINATOR) {
- final char c = (char) (packedValue - 1);
+ final char c = (char) packedValue;
buf.append(c);
/* Load the next byte. */
Modified: trunk/foray/lib/foray-hyphen-0.4-rsrc.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-03-14 14:48:31
|
Revision: 10671
http://foray.svn.sourceforge.net/foray/?rev=10671&view=rev
Author: victormote
Date: 2009-03-14 14:48:19 +0000 (Sat, 14 Mar 2009)
Log Message:
-----------
1. Move natural language definitions and word lists to separate directories, to prevent them from being included in the jar file for hyphenation patterns, and for better organization.
2. Rebuild patterns jar file without the extraneous content.
Modified Paths:
--------------
trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java
trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationServer4a.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/util/ValidateChars.java
trunk/foray/foray-hyphen/src/javatest/org/foray/hyphen/TestHyphenationServer4a.java
trunk/foray/lib/foray-hyphen-0.4-rsrc.jar
Added Paths:
-----------
trunk/foray/foray-hyphen/resource/natural-language/
trunk/foray/foray-hyphen/resource/natural-language/mah-language.xml
trunk/foray/foray-hyphen/resource/word-list/
trunk/foray/foray-hyphen/resource/word-list/eng-word-list.xml
trunk/foray/foray-hyphen/resource/word-list/mah-word-list.xml
Removed Paths:
-------------
trunk/foray/foray-hyphen/resource/hyph-patterns/eng-word-list.xml
trunk/foray/foray-hyphen/resource/hyph-patterns/mah-language.xml
trunk/foray/foray-hyphen/resource/hyph-patterns/mah-word-list.xml
Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2009-03-14 13:23:34 UTC (rev 10670)
+++ trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2009-03-14 14:48:19 UTC (rev 10671)
@@ -169,10 +169,9 @@
*/
public static HyphenationServer makeHyphenationServer(final Log logger,
final SessionConfig configuration) {
- final URL hyphenationDir =
- configuration.optionHyphenationBaseDirectory();
- return new org.foray.hyphen.HyphenationServer4a(logger,
- hyphenationDir);
+ final URL hyphenationDir = configuration.optionHyphenationBaseDirectory();
+ final URL naturalLanguageDir = configuration.optionNaturalLanguageBaseDirectory();
+ return new org.foray.hyphen.HyphenationServer4a(logger, hyphenationDir, naturalLanguageDir);
}
/**
Modified: trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java
===================================================================
--- trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java 2009-03-14 13:23:34 UTC (rev 10670)
+++ trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java 2009-03-14 14:48:19 UTC (rev 10671)
@@ -204,6 +204,18 @@
}
/**
+ * Returns the "natural-language-base-directory" configuration item.
+ * @return The "natural-language-base-directory" configuration item.
+ */
+ public URL optionNaturalLanguageBaseDirectory() {
+ final URL value = (URL) getValue("natural-language-base-directory");
+ if (value == null) {
+ return optionBaseDirectory();
+ }
+ return value;
+ }
+
+ /**
* Returns the "language" configuration item.
* @return The "language" configuration item.
*/
Deleted: trunk/foray/foray-hyphen/resource/hyph-patterns/eng-word-list.xml
===================================================================
--- trunk/foray/foray-hyphen/resource/hyph-patterns/eng-word-list.xml 2009-03-14 13:23:34 UTC (rev 10670)
+++ trunk/foray/foray-hyphen/resource/hyph-patterns/eng-word-list.xml 2009-03-14 14:48:19 UTC (rev 10671)
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE axsl-word-list
- PUBLIC "-//aXSL//DTD Word List V0.1//EN"
- "http://www.axsl.org/dtds/0.1/en/axsl-word-list.dtd">
-
-<!--
- A partial, open-source, public-domain word list for the English
- language.
--->
-
-<axsl-word-list iso-639="eng" hyphen-char="-">
- <word>com-put-er</word>
- <word>fre-quen-cy</word>
- <word>in-quire</word>
- <word>pass-port</word>
- <word>star-light</word>
-</axsl-word-list>
-
-<!-- Last Line of File -->
Deleted: trunk/foray/foray-hyphen/resource/hyph-patterns/mah-language.xml
===================================================================
--- trunk/foray/foray-hyphen/resource/hyph-patterns/mah-language.xml 2009-03-14 13:23:34 UTC (rev 10670)
+++ trunk/foray/foray-hyphen/resource/hyph-patterns/mah-language.xml 2009-03-14 14:48:19 UTC (rev 10671)
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE axsl-natural-language
- PUBLIC "-//aXSL//DTD Natural Language V0.1//EN"
- "http://www.axsl.org/dtds/0.1/en/axsl-natural-language.dtd">
-
-<!-- $Id$ -->
-
-<!--
-Natural language definition for the the Marshallese language.
--->
-
-<axsl-natural-language iso-639="mah">
- <letter-range description="'a' thru 'z'" start="U+0061" end="U+007A"/>
- <letter-range description="'A' thru 'Z'" start="U+0041" end="U+005A"/>
- <letter description="A-macron" value="U+0041 U+0304"/>
- <letter description="a-macron" value="U+0061 U+0304"/>
- <letter description="N-macron" value="U+004E U+0304"/>
- <letter description="n-macron" value="U+006E U+0304"/>
- <letter description="O-macron" value="U+004F U+0304"/>
- <letter description="o-macron" value="U+006F U+0304"/>
- <letter description="U-macron" value="U+0055 U+0304"/>
- <letter description="u-macron" value="U+0075 U+0304"/>
- <letter description="L-cedilla" value="U+004C U+0327"/>
- <letter description="l-cedilla" value="U+006C U+0327"/>
- <letter description="M-cedilla" value="U+004D U+0327"/>
- <letter description="m-cedilla" value="U+006D U+0327"/>
- <letter description="N-cedilla" value="U+004E U+0327"/>
- <letter description="n-cedilla" value="U+006E U+0327"/>
- <letter description="O-cedilla" value="U+004F U+0327"/>
- <letter description="o-cedilla" value="U+006F U+0327"/>
-</axsl-natural-language>
Deleted: trunk/foray/foray-hyphen/resource/hyph-patterns/mah-word-list.xml
===================================================================
--- trunk/foray/foray-hyphen/resource/hyph-patterns/mah-word-list.xml 2009-03-14 13:23:34 UTC (rev 10670)
+++ trunk/foray/foray-hyphen/resource/hyph-patterns/mah-word-list.xml 2009-03-14 14:48:19 UTC (rev 10671)
@@ -1,1119 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE axsl-word-list
- PUBLIC "-//aXSL//DTD Word List V0.1//EN"
- "http://www.axsl.org/dtds/0.1/en/axsl-word-list.dtd">
-
-<axsl-word-list iso-639="mah" hyphen-char="-">
-
- <!-- The entries in this list were contributed by Dave Utter, missionary to
- the Marshall Islands, and are in the public domain. -->
-
- <word>M̧aaj</word>
- <word>ņņooj</word>
- <word>ņaib</word>
- <word>ņo</word>
- <word>ņoņ-ņoņ-me-ej</word>
- <word>ņo-jak</word>
- <word>ņo-oje</word>
- <word>ļā</word>
- <word>ļae</word>
- <word>ļak</word>
- <word>ļa-lem</word>
- <word>ļat</word>
- <word>ļa-tip-n̄ōl</word>
- <word>ļā-m̧o-ran</word>
- <word>ļe</word>
- <word>ļe-iō</word>
- <word>ļōļ-ļap</word>
- <word>ļo-ļā-tāt</word>
- <word>ļō-ka-jem̧</word>
- <word>ļō-ka-tip</word>
- <word>ļo̧k-jen-aa-</word>
- <word>ļo̧k-jen-ami</word>
- <word>ļō-kōm̧</word>
- <word>ļok-tōk</word>
- <word>ļok-tōk-tōk</word>
- <word>ļok-wan</word>
- <word>ļo̧n̄</word>
- <word>ļon̄-tak</word>
- <word>ļo-rak</word>
- <word>ļo-te</word>
- <word>ļō-m̧a</word>
- <word>ļō-m̧a-ro</word>
- <word>ļwe</word>
- <word>A-ņok-ņak</word>
- <word>Ab-ņō-ņō</word>
- <word>Ad-de-bou-lul</word>
- <word>Ad-di-dik</word>
- <word>Ae</word>
- <word>Ae</word>
- <word>Ae-bōj</word>
- <word>Ae-bōj-bōj</word>
- <word>Aen̄-wān̄-wā</word>
- <word>Ae-ran</word>
- <word>Ae-rar</word>
- <word>Aet</word>
- <word>Ae-tok</word>
- <word>Ae-tōl</word>
- <word>Ai-dik</word>
- <word>Āier-ļo̧k-wōt</word>
- <word>Aik</word>
- <word>Ail-paro</word>
- <word>Ain</word>
- <word>Ain-bat</word>
- <word>Ai-ni-kier</word>
- <word>Ai-re</word>
- <word>Ai-ru-wa-ro</word>
- <word>Ait-we-rōk</word>
- <word>Āj</word>
- <word>A-jā-dik</word>
- <word>A-jā-dik-ļo̧k</word>
- <word>A-je-ed-ed</word>
- <word>Ā-jin-kōj</word>
- <word>Aj-ji-kad</word>
- <word>Aj-ju-kub</word>
- <word>Āj-mour</word>
- <word>Ak-ki</word>
- <word>Ak-wāāl</word>
- <word>Āl</word>
- <word>A-ļap</word>
- <word>A-lej</word>
- <word>A-le-ko̧</word>
- <word>A-li-jer-ļo̧k</word>
- <word>Ā-li-kin-jep-jep</word>
- <word>Ā-lik-lik</word>
- <word>A-lik-kar</word>
- <word>Al-lok</word>
- <word>Al-lu-ke</word>
- <word>Al-n̄ūr-n̄ūr</word>
- <word>Ā-lōk-ļo̧k</word>
- <word>A-lok-lok</word>
- <word>Al-wōj</word>
- <word>A-mej</word>
- <word>An̄</word>
- <word>A-n̄al</word>
- <word>A-nan</word>
- <word>Ān-bwin-nōm̧</word>
- <word>Ā-neņ</word>
- <word>Ā-ned</word>
- <word>Ā-ne-o</word>
- <word>A-ni-lo-wa</word>
- <word>Ā-nin</word>
- <word>An-kil-i-ri-ab</word>
- <word>An-miin̄</word>
- <word>An-mooņ</word>
- <word>An-nan̄</word>
- <word>A-nōk</word>
- <word>Aoļ</word>
- <word>Aor</word>
- <word>Ap-lep</word>
- <word>arp</word>
- <word>Āt</word>
- <word>A-ta-bun̄</word>
- <word>A-ta-ji-nem-jen</word>
- <word>A-tak</word>
- <word>A-ta-ke</word>
- <word>Ā-tāt</word>
- <word>At-laļ</word>
- <word>A-to</word>
- <word>At-tū-ko-ko</word>
- <word>Au-jiid</word>
- <word>A-wa</word>
- <word>A-m̧a</word>
- <word>Am̧-win</word>
- <word>Baar</word>
- <word>Baat</word>
- <word>Bab-būb</word>
- <word>Ba-dik</word>
- <word>Bai-jin</word>
- <word>Bak-bōk</word>
- <word>Bar</word>
- <word>Ba-rōk</word>
- <word>Ba-to</word>
- <word>Ba-tur</word>
- <word>Bbaar</word>
- <word>Bbi-jin-jin</word>
- <word>Bbōl</word>
- <word>Beal</word>
- <word>Blue</word>
- <word>Bo̧-bo</word>
- <word>Bō-dan̄</word>
- <word>Bōj-ļo̧k</word>
- <word>Bōj-rak</word>
- <word>Bok</word>
- <word>Bō-kā</word>
- <word>Bōk-lō-kōt</word>
- <word>Bo̧k-wōj</word>
- <word>Bōl</word>
- <word>Bō-lōk</word>
- <word>Bōn-bōn</word>
- <word>Bo̧o̧k</word>
- <word>Bō-ra-</word>
- <word>Bō-ro̧-ro̧</word>
- <word>Bōr-waj</word>
- <word>Bō-ta-ta</word>
- <word>Bo̧-ti</word>
- <word>Bōt-ter</word>
- <word>Bo̧un</word>
- <word>Bo̧ur</word>
- <word>Bo̧ur</word>
- <word>Bū-ļo̧-ke</word>
- <word>Bu-ļōn</word>
- <word>Bu-ļuļ-ļuļ</word>
- <word>Bū-ļuud-dik</word>
- <word>Bu-kun iju</word>
- <word>Bu-kwe</word>
- <word>Bu-kwe-lō-lō</word>
- <word>Bu-kwie-</word>
- <word>Bu-kwien</word>
- <word>Bu-kwōn</word>
- <word>Bū-n̄al</word>
- <word>Bun̄-raak</word>
- <word>Bun̄-tōn</word>
- <word>Būn-tōn ne</word>
- <word>Bun̄-tōn ne-em̧</word>
- <word>Bu-n̄ut</word>
- <word>Bū-ron̄</word>
- <word>Bū-rook-lep</word>
- <word>Bū-rō-rō</word>
- <word>Bū-rō-rō</word>
- <word>Bū-ton̄</word>
- <word>Bū-tūk-tūk</word>
- <word>Bu-wat</word>
- <word>Bwi-dak</word>
- <word>Bwij-jin</word>
- <word>Bwij-wo-ļā</word>
- <word>Bwi-li-kō-</word>
- <word>Bwil-ji-</word>
- <word>Bwi-lo̧k</word>
- <word>Bwi-ni/e</word>
- <word>Ce-ment</word>
- <word>Co-lor</word>
- <word>Daan</word>
- <word>Dā-de</word>
- <word>Dāil</word>
- <word>Dān-nin kōm-jaaļ-aļ</word>
- <word>Dā-pil-pil</word>
- <word>Dam̧-dem̧</word>
- <word>Da-m̧ok</word>
- <word>Da-m̧wij</word>
- <word>De-ļo̧n̄</word>
- <word>Deb-lo̧k</word>
- <word>Deor</word>
- <word>De-pak-pak</word>
- <word>Dep-dep</word>
- <word>De-pe-te</word>
- <word>De-pet-pet</word>
- <word>Det-tan</word>
- <word>De-m̧ak</word>
- <word>De-m̧an</word>
- <word>Di</word>
- <word>Di-buk</word>
- <word>Di-e-de</word>
- <word>Di-en mej</word>
- <word>Di-kāāļ-āl</word>
- <word>Di-laik</word>
- <word>Do̧-lel</word>
- <word>Doon</word>
- <word>Doo-re</word>
- <word>Dou-lul</word>
- <word>Du-mej</word>
- <word>Eņ</word>
- <word>E-ņo̧uk</word>
- <word>Eļ-ļā</word>
- <word>Eļ-ļo̧k</word>
- <word>Eļ-tan pā</word>
- <word>Eļ-tan pein</word>
- <word>Eļ-tok</word>
- <word>E-a-buk-wi</word>
- <word>E-ak-pel</word>
- <word>Ean̄</word>
- <word>Eb</word>
- <word>E-ba-je</word>
- <word>Eb-baar</word>
- <word>Eb-bōj</word>
- <word>E-beb</word>
- <word>Ed-jon̄</word>
- <word>E-jaak</word>
- <word>E-je</word>
- <word>E-jej</word>
- <word>E-jouj</word>
- <word>Ej-m̧aan</word>
- <word>E-ke</word>
- <word>Ek-kein</word>
- <word>Ek-kō-ļo-ļo</word>
- <word>Ek-kōl</word>
- <word>Ek-kō-pal</word>
- <word>Ek-kwaļ</word>
- <word>Ek-tak</word>
- <word>El</word>
- <word>El-lo-we-tak</word>
- <word>Em-mej</word>
- <word>En̄-jake</word>
- <word>Eo-ļap</word>
- <word>Eo-eo</word>
- <word>Eo-lo̧k</word>
- <word>Eo̧n̄</word>
- <word>Eo̧-ron̄</word>
- <word>Ep-pāl-pāl</word>
- <word>Ep-peer-ir</word>
- <word>Ep-pepe</word>
- <word>Ep-rōļ</word>
- <word>Er-ļo̧k</word>
- <word>E-ran</word>
- <word>Er-m̧we</word>
- <word>Et</word>
- <word>E-tan wōt n̄e</word>
- <word>E-tao</word>
- <word>Et-ta</word>
- <word>Et-ti-no</word>
- <word>Et-to-ļo̧k</word>
- <word>Em̧</word>
- <word>Flute</word>
- <word>Fork</word>
- <word>Glass</word>
- <word>Gray</word>
- <word>Hōn-ni</word>
- <word>Ia-bun̄</word>
- <word>Iā-da-tōl-tōl</word>
- <word>I-āe-kwōj</word>
- <word>I-a-n̄ak</word>
- <word>I-a-ron̄-ron̄</word>
- <word>I-beb</word>
- <word>I-bwij-lep-lep</word>
- <word>I-dik</word>
- <word>I-din̄</word>
- <word>I-ep</word>
- <word>Iio</word>
- <word>I-iōk</word>
- <word>I-jel-lo̧-kun</word>
- <word>Ij-jir</word>
- <word>I-joļ</word>
- <word>I-jo-ke</word>
- <word>I-kōn̄</word>
- <word>I-kūr</word>
- <word/>
- <word>Il</word>
- <word>I-lām</word>
- <word>I-lān</word>
- <word>Il-bōk</word>
- <word>I-len</word>
- <word>Ilowaan</word>
- <word>Im</word>
- <word>Im-ki-li</word>
- <word>I-ne-ea</word>
- <word>I-neem̧-m̧an</word>
- <word>I-nej</word>
- <word>I-ne-lep</word>
- <word>I-ne-pa-ta</word>
- <word>I-n̄im-maļ</word>
- <word>I-n̄in̄</word>
- <word>In̄-n̄ūr</word>
- <word>In̄-ūti</word>
- <word>Ip</word>
- <word>I-pen</word>
- <word>I-pep</word>
- <word>I-per</word>
- <word>Ir</word>
- <word>Ir</word>
- <word>Ir-ir</word>
- <word>I-ruj</word>
- <word>I-taak</word>
- <word>I-ti-tōk</word>
- <word>I-tōk</word>
- <word>I-tōm</word>
- <word>I-tōn</word>
- <word>It-tin</word>
- <word>It-tūt</word>
- <word>I-tūk</word>
- <word>It-we-ļo̧k</word>
- <word>Iur</word>
- <word>Iuun</word>
- <word>I-m̧aaj-aj</word>
- <word>Jaļ</word>
- <word>Jaaļ</word>
- <word>Ja-baer</word>
- <word>Ja-bōn</word>
- <word>Jā-de</word>
- <word>Ja-kōļ</word>
- <word>Ja-kol</word>
- <word>Jā-le-le</word>
- <word>Jā-min</word>
- <word>Jān</word>
- <word>Jān</word>
- <word>Jā-nij</word>
- <word>Ja-n̄ūt</word>
- <word>Jāp</word>
- <word>Ja-ri-ot</word>
- <word>Jar-lep-ju</word>
- <word>Ja-rōb</word>
- <word>Ja-rom</word>
- <word>Ja-rom-rom</word>
- <word>Jar-ron̄-ron̄</word>
- <word>Ja-tier</word>
- <word>Ja-toļ</word>
- <word>Ja-tōl-tōl</word>
- <word>Ja-tōp-tōp</word>
- <word>Ja-tū</word>
- <word>Jeļ-ļo̧k</word>
- <word>Je-ļa-te</word>
- <word>Jeļ-mā-ne</word>
- <word>Je-ļo</word>
- <word>Je-ban</word>
- <word>Jeb-ba-re</word>
- <word>Jeb-lo-kwan</word>
- <word>Je-boul-ul</word>
- <word>Jeb-wāāl-el</word>
- <word>Je-do̧u-jij</word>
- <word>Jed-pā-nit</word>
- <word>Jeek-ļo̧k</word>
- <word>Jee-pep-ļo̧k</word>
- <word>Jeir-ro</word>
- <word>Jej-jet</word>
- <word>Jej-jet kūt-i-e-</word>
- <word>Jej-jo</word>
- <word>Jek-ļaj</word>
- <word>Je-kad-kad</word>
- <word>Je-kāi-ro</word>
- <word>Jel-jel - im - Kouj</word>
- <word>Jel-paak</word>
- <word>Je-ma</word>
- <word>Je-mād</word>
- <word>Je-mā-lu-ut</word>
- <word>Je-mān</word>
- <word>Je-mam̧</word>
- <word>Je-me</word>
- <word>Je-me-me</word>
- <word>Jem-jein</word>
- <word>Jem-jem</word>
- <word>Jen-kwan</word>
- <word>Je-no-lo̧k</word>
- <word>Je-or</word>
- <word>Je-pak</word>
- <word>Je-pan</word>
- <word>Je-pāp-pāp</word>
- <word>Je-pe</word>
- <word>Je-pen</word>
- <word>Jep-jep</word>
- <word>Jep-ļaak</word>
- <word>Jep-lōk-lōk</word>
- <word>Jep-tak</word>
- <word>Je-rak</word>
- <word>Je-rak-rōk</word>
- <word>Je-ra-m̧ōl</word>
- <word>Jer-waan</word>
- <word>Jem̧-ļo̧k</word>
- <word>Je-m̧aan</word>
- <word>Ji-bu-kwi</word>
- <word>Ji-bun̄</word>
- <word>Ji-bur-lep</word>
- <word>Ji-buun</word>
- <word>Ji-buun bo̧o̧k</word>
- <word>Ji-bwi-</word>
- <word>Jid-dik</word>
- <word>Ji-dim-kij</word>
- <word>Jid-pān</word>
- <word>Jij</word>
- <word>Ji-jet</word>
- <word>Ji-kiier</word>
- <word>Ji-kū</word>
- <word>Ji-kur</word>
- <word>Ji-lel</word>
- <word>Jil-lo̧k</word>
- <word>Jil-n̄uul</word>
- <word>Ji-mat-tan</word>
- <word>Jim-ma-rok</word>
- <word>Jin-jin</word>
- <word>Jin-ka-dool</word>
- <word>Jin-tōb</word>
- <word>Ji-peļ-ļo̧k</word>
- <word>Ji-ped</word>
- <word>Ji-pij</word>
- <word>Ji-po̧-kwe</word>
- <word>Jir</word>
- <word>Ji-ri-lo̧k</word>
- <word>Ji-rūm̧-le</word>
- <word>Ji-tōn-bō-ro</word>
- <word>Ji-m̧a</word>
- <word>Ji-m̧win ne</word>
- <word>Jjeor</word>
- <word>Jo̧</word>
- <word>Jo-ņak</word>
- <word>Jo-jo-ļāār</word>
- <word>Jo-jo-mar</word>
- <word>Jok-dād</word>
- <word>Jo-koņ</word>
- <word>Jo-koņ-an</word>
- <word>Jok-wane</word>
- <word>Jok-wōd</word>
- <word>Jon</word>
- <word>Jo-n̄ak</word>
- <word>Jo-n̄an</word>
- <word>Jo-n̄e</word>
- <word>Jo-n-iak</word>
- <word>Jo̧o̧ļ</word>
- <word>Jook</word>
- <word>Jo-ol</word>
- <word>Jo-on</word>
- <word>Jo-or</word>
- <word>Jo-or</word>
- <word>Joor-tak</word>
- <word>Jo-rom</word>
- <word>Jo-rom</word>
- <word>Jo-ro-me</word>
- <word>Jo-tal</word>
- <word>Jo-ur-ur</word>
- <word>Jo-m̧ō-kaj</word>
- <word>Ju bū-ru-on</word>
- <word>Juļ</word>
- <word>Ju-jāl-tok</word>
- <word>Ju-o-ke</word>
- <word>Ju-rōk</word>
- <word>Ju-rōn</word>
- <word>Juuj</word>
- <word>Juun-m̧aad</word>
- <word>Juuri</word>
- <word>Ju-wa</word>
- <word>Ju-wa-ļōn̄-ļōn̄</word>
- <word>Kaņ</word>
- <word>Kāāj</word>
- <word>Kaal</word>
- <word>Kaa-lik-kar</word>
- <word>Kāā-lōt</word>
- <word>Kaal-wōj</word>
- <word>Kaa-mi-jak</word>
- <word>Kaa-n̄al</word>
- <word>Kaar-maj-jete</word>
- <word>Kaa-tok-i</word>
- <word>Kaa-tu-we</word>
- <word>Kab</word>
- <word>Kab</word>
- <word>Kab-bok-bok</word>
- <word>Kab-bu-kwe</word>
- <word>Ka-bwi-jer</word>
- <word>Ka-bwij-lōn̄</word>
- <word>Ka-bwi-lo̧k-lo̧k māj</word>
- <word>Kā-i-lar</word>
- <word>Kai-ok</word>
- <word>Kai-ur</word>
- <word>Ka-jep-ļo̧k-ļo̧k</word>
- <word>Ka-jer-aam̧-m̧an</word>
- <word>Ka-ji-tū-kin</word>
- <word>Kaj-je</word>
- <word>Kaj-ji-er</word>
- <word>Kaj-jo</word>
- <word>Kaj-jo-jo</word>
- <word>Kaj-jō-jō</word>
- <word>Kaj-ju</word>
- <word>Kaj-juur</word>
- <word>Kāj-mour</word>
- <word>Ka-ju</word>
- <word>Ka-juu-ri</word>
- <word>Kā-ke</word>
- <word>Kak-ki-je</word>
- <word>Ka-kōļ</word>
- <word>Ka-kōļ-ļa-</word>
- <word>Ka-kū-tō-tō</word>
- <word>Kal-bu-bu</word>
- <word>Kal-buuj</word>
- <word>Kal-bwin</word>
- <word>Ka-li-jek-ļo̧k</word>
- <word>Kal-lib</word>
- <word>Kal-lim-jek</word>
- <word>Ka-lo</word>
- <word>Ka-lōk</word>
- <word>Kā-lo̧k</word>
- <word>Kā-lōk-lōk</word>
- <word>Ka-mel</word>
- <word>Kaa-mi-jak</word>
- <word>Ka-ne</word>
- <word>Kan-kan</word>
- <word>Kanniōken</word>
- <word>Kanōke</word>
- <word>Ka-n̄ūr</word>
- <word>Ka-n̄ur-n̄ur</word>
- <word>Ka-ōr-ōr</word>
- <word>Ka-pa-ta</word>
- <word>Ka-peel</word>
- <word>Kapi-</word>
- <word>Ka-pi-ju-ku-nen-</word>
- <word>Ka-pi-lōk</word>
- <word>Ka-pi-lōn̄</word>
- <word>Ka-pit</word>
- <word>Kap-lo</word>
- <word>Kap-pu-kot</word>
- <word>Ka-rā-jet</word>
- <word>Kā-re</word>
- <word>Kā-re-re</word>
- <word>Ka-ro</word>
- <word>Kar-pen</word>
- <word>Kar-waan</word>
- <word>Kar-wūn</word>
- <word>kas-ta-net</word>
- <word>Ka-tiin</word>
- <word>Kat-mā-ne</word>
- <word>Kat-tar</word>
- <word>Kat-tu</word>
- <word>Kau-ļa-ļo</word>
- <word>Kauk</word>
- <word>Ka-m̧a-kūt</word>
- <word>Ka-m̧o</word>
- <word>Ke-eņe</word>
- <word>Ke-ean̄</word>
- <word>Keej</word>
- <word>Keel-waan</word>
- <word>Keid (-i)</word>
- <word>Kein kā-ā-men</word>
- <word>Ke-jak-ļo̧k-jeņ</word>
- <word>Kek</word>
- <word>Ke-kaa-ke</word>
- <word>Ke-ke</word>
- <word>Ke-kōl</word>
- <word>Ke-lo̧k</word>
- <word>Ke-no̧-kwōl</word>
- <word>Ke-paak</word>
- <word>Ke-tak</word>
- <word>Ki-di-a</word>
- <word>Ki-eb</word>
- <word>Ki-el</word>
- <word>Kii-ji</word>
- <word>Kii-li</word>
- <word>Kij</word>
- <word>Ki-jak</word>
- <word>Kij-dik</word>
- <word>Ki-je-ļo̧k</word>
- <word>Kij-en-mej</word>
- <word>Ki-jer</word>
- <word>Ki-ji</word>
- <word>Kij-jien</word>
- <word>Kij-n̄e-n̄e</word>
- <word>Ki-joon</word>
- <word>Ki-joor-or</word>
- <word>Kil-bū-rō-rō</word>
- <word>Ki-len</word>
- <word>Ki-lep</word>
- <word>Ki-lin</word>
- <word>Kil-meej</word>
- <word>Ki-naļ</word>
- <word>Ki-naak</word>
- <word>Ki-ne</word>
- <word>Ki-o-jaļ-jaļ</word>
- <word>Ki-u-di</word>
- <word>Kkaal</word>
- <word>Kkan̄</word>
- <word>Kke-kaak</word>
- <word>Kkōl</word>
- <word>Kkōl-ja-ke</word>
- <word>Kkor-kor</word>
- <word>Kkūm̧-kūm̧</word>
- <word>Kō-ņak</word>
- <word>Kō-ļaak</word>
- <word>Ko-ļei-aat</word>
- <word>Kō-ļo</word>
- <word>Kō-ļo̧k</word>
- <word>Kōb</word>
- <word>Ko-ba</word>
- <word>Kō-ba</word>
- <word>Kō-bwe-bwe-in</word>
- <word>Kō-jaa-ļe</word>
- <word>Kō-jak-kōl-kōl</word>
- <word>Kō-jan̄-jan̄</word>
- <word>Kō-jer-bal</word>
- <word>Kōj-jaad</word>
- <word>Kōj-ja-tōl-tōli</word>
- <word>Kōj-je-ro̧-ro</word>
- <word>Kōj-jem̧-ļo̧k</word>
- <word>Kōj-jo̧</word>
- <word>Kō-jo̧</word>
- <word>Kōj-pa-rok</word>
- <word>Kō-kai-jur-jur</word>
- <word>Kō-kaj-ri-ri</word>
- <word>Ko̧-ko-ņe</word>
- <word>Kōl-la</word>
- <word>Kōl-laaj-rak</word>
- <word>Kōl-la-dik-dik</word>
- <word>Kōl-le-jar</word>
- <word>Kō-maaj-aj</word>
- <word>Kō-mat</word>
- <word>Kō-ma-tōr</word>
- <word>Kōm-ma-tōr</word>
- <word>Kōm-me-jā-je</word>
- <word>Kōm-men̄</word>
- <word>Ko-na</word>
- <word>Ko-n̄il</word>
- <word>Kōn-ja-</word>
- <word>Kōn-naa-nōk</word>
- <word>Kōn-wa-</word>
- <word>Kooļ-oļ</word>
- <word>Ko̧o̧j</word>
- <word>Ko̧o̧l</word>
- <word>Kooļ</word>
- <word>Koon</word>
- <word>Ko-pā</word>
- <word>Kō-pā-le</word>
- <word>Kō-peļ</word>
- <word>Kō-pooļ</word>
- <word>Kō-pooj</word>
- <word>Kō-poo-jak</word>
- <word>Kō-po-po</word>
- <word>Kōp-pāāt</word>
- <word>Kōp-pao</word>
- <word>Kōp-po-jak</word>
- <word>Kor</word>
- <word>Ko-rak</word>
- <word>Kōt-ļo̧k</word>
- <word>Kō-taan</word>
- <word>Ko-tak</word>
- <word>Kōt-rāe</word>
- <word>Kōt-teep</word>
- <word>Kōt-tō-bal-bal</word>
- <word>Kou-tiej</word>
- <word>Ko-wa</word>
- <word>Ko-m̧aan</word>
- <word>Kom̧-laļ</word>
- <word>Kō-m̧ō-rāik</word>
- <word>Kōm̧-m̧a-kūt</word>
- <word>Ku-ņaa-</word>
- <word>Kūb-boņ</word>
- <word>Kū-bwe</word>
- <word>Kū-bwij</word>
- <word>Ku-ne</word>
- <word>Kū-rae</word>
- <word>Kū-ra-wūn</word>
- <word>Kū-riij</word>
- <word>Kūr-ro</word>
- <word>Kut</word>
- <word>Kū-tan̄-tan̄</word>
- <word>Kū-tim</word>
- <word>Kū-ti-mi</word>
- <word>Kū-tim-tim</word>
- <word>Kū-tō-tō</word>
- <word>Kūt-ti-liek</word>
- <word>Kwa-ļe</word>
- <word>Kwaļ-koļ</word>
- <word>Kwe-lep</word>
- <word>Kwi</word>
- <word>Kwi-dik</word>
- <word>Kwi-dik i-den</word>
- <word>Kwō-deak</word>
- <word>Kwō-le</word>
- <word>Kwō-le-le</word>
- <word>Kwō-pej</word>
- <word>Lamb</word>
- <word>La-m̧ōj</word>
- <word>Lead</word>
- <word>Lej-no-no</word>
- <word>Lel</word>
- <word>Lem-lem</word>
- <word>Lem-n̄oul</word>
- <word>Len-nab</word>
- <word>Lep</word>
- <word>Le-per</word>
- <word>Le-vai-a-tan</word>
- <word>Li-aaj-lo̧ļ</word>
- <word>Li-aak-ļo̧k</word>
- <word>Li-a-nij</word>
- <word>Li-āp</word>
- <word>Li-bo-bo</word>
- <word>L-ibōn</word>
- <word>Li-je-n̄ūr-n̄ūr</word>
- <word>Li-je-m̧ōr-m̧ōr</word>
- <word>Li-kaak-rak</word>
- <word>Lik-ko</word>
- <word>Li-kō-pej-n̄ak</word>
- <word>Lik-tūt</word>
- <word>Li-ma-buk-wi</word>
- <word>Li-mi</word>
- <word>Li-pen</word>
- <word>Lip-po̧ņ</word>
- <word>Li-m̧aaj-ņo-ņo</word>
- <word>Li-m̧a-rein</word>
- <word>Li-m̧ō</word>
- <word>Llor</word>
- <word>Llor</word>
- <word>Llo-taan</word>
- <word>Lōļ-ļap</word>
- <word>Lōļ-n̄o̧n̄</word>
- <word>Lo-ļo̧k-jeņ</word>
- <word>Loaf</word>
- <word>Lōb</word>
- <word>Lo̧-jil-n̄i-</word>
- <word>Lo̧-jil-n̄ūm̧</word>
- <word>Lo̧k</word>
- <word>Lo̧k</word>
- <word>Lōk-lōk</word>
- <word>Lok-wan</word>
- <word>Lō-lō</word>
- <word>Lō-lōu-ke</word>
- <word>Lo-mi-je-</word>
- <word>Lōn̄ mā-jid-jid</word>
- <word>Lo̧-n̄iin</word>
- <word>Lo̧-n̄iim̧</word>
- <word>Lōn̄-n̄a</word>
- <word>Lo̧-n̄ō</word>
- <word>Lo̧-pi-den</word>
- <word>Lo-ri-</word>
- <word>Lō-ta</word>
- <word>Lo̧u-rō</word>
- <word>Lo-waan</word>
- <word>Lo-m̧a-ļo</word>
- <word>Luk-kuun</word>
- <word>Lu-kwar-kwar</word>
- <word>Luk-wōj</word>
- <word>Luk-wōn</word>
- <word>Luk-wōn bon̄</word>
- <word>Lur</word>
- <word>Lu-tōk</word>
- <word>Lyre</word>
- <word>Ma-ļon̄</word>
- <word>Ma-ļūt-tōk</word>
- <word>Māāņ-āņ</word>
- <word>Māāl</word>
- <word>Māāl</word>
- <word>Māār</word>
- <word>Maat</word>
- <word>Mā-de-pep</word>
- <word>Ma-kij-kij</word>
- <word>Mā-lej-jon̄</word>
- <word>Mā-lij</word>
- <word>Mā-lim</word>
- <word>Māl-le</word>
- <word>Mā-lōt-lōt</word>
- <word>Mā-ni</word>
- <word>Mar</word>
- <word>Ma-rok ji-lōn̄-lōn̄</word>
- <word>Ma-ro-ro</word>
- <word>Mat</word>
- <word>Ma-tōk</word>
- <word>Me-ļaaj</word>
- <word>Me-ļe-ļe</word>
- <word>Me-ļo̧k-ļo̧k</word>
- <word>Med</word>
- <word>Me-dek</word>
- <word>Me-jaļ</word>
- <word>Me-jān</word>
- <word>Me-jek</word>
- <word>Me-jen-ma</word>
- <word>Mej-kai-ie</word>
- <word>Mej-ki</word>
- <word>Me-kar-ta</word>
- <word>Me-ļan</word>
- <word>Mel-kwaar-ar</word>
- <word>Men̄</word>
- <word>Men-ā-dik</word>
- <word>Men-men-bwij</word>
- <word>Men-nin-mour</word>
- <word>Me-no̧k-no̧k</word>
- <word>Me-o̧</word>
- <word>Me-o-eo</word>
- <word>Me-ra</word>
- <word>Me-tal</word>
- <word>Me-tal-tōl</word>
- <word>Mi-jel</word>
- <word>Mme-ļo</word>
- <word>Mmej</word>
- <word>Mo</word>
- <word>Mo̧</word>
- <word>Mo̧k</word>
- <word>Mo̧k-wōj</word>
- <word>Mo̧n̄</word>
- <word>Mōōb-ōb</word>
- <word>Mo̧o̧n</word>
- <word>Moot</word>
- <word>Naaj-dik</word>
- <word>Na-bōj</word>
- <word>N̄aj</word>
- <word>N̄ar-n̄ar</word>
- <word>N̄at</word>
- <word>N̄a-tū</word>
- <word>Ne-em̧</word>
- <word>Nei-em</word>
- <word>Ne-jier</word>
- <word>Ne-jū</word>
- <word>Ne-mak</word>
- <word>N̄i</word>
- <word>Ni-n̄a</word>
- <word>Nit-bwil</word>
- <word>Nit-bwil-li</word>
- <word>N̄n̄at</word>
- <word>N̄n̄ūr</word>
- <word>No-bōm̧-ba</word>
- <word>Noe</word>
- <word>Nōō-re</word>
- <word>Nu-kier</word>
- <word>Nu-kū</word>
- <word>Nu-kuj</word>
- <word>Nu-kun</word>
- <word>Nu-kum̧</word>
- <word>N̄ū-ta</word>
- <word>O</word>
- <word>O</word>
- <word>O-ļe-o̧</word>
- <word>Ō-ļōļ</word>
- <word>O-bab</word>
- <word>Ōj-jej</word>
- <word>Ok-pej</word>
- <word>Ōn-ļo̧k</word>
- <word>O-pe-ne</word>
- <word>Or-ļo̧k</word>
- <word>O-ran̄-ļo̧k</word>
- <word>Or-or</word>
- <word>O-war</word>
- <word>Pā</word>
- <word>Paan</word>
- <word>Pāān̄-kōļ</word>
- <word>Pā-le-le</word>
- <word>Pāl-lin</word>
- <word>Pā-lo</word>
- <word>Pāl-pel</word>
- <word>Pa-n̄ij-n̄ij</word>
- <word>Pa-ri-jet</word>
- <word>Pa-rōk</word>
- <word>Pa-ta</word>
- <word>Peļ-ļo̧k</word>
- <word>Pe-ļaak</word>
- <word>Pe-ļak</word>
- <word>Pe-da-kil-kil</word>
- <word>Ped-de-ja-ke</word>
- <word>Ped-en-pā</word>
- <word>Ped-kat</word>
- <word>Pe-do-wan</word>
- <word>Pej-in</word>
- <word>Pej-lo̧k</word>
- <word>Pel-jo</word>
- <word>Pe-na-wi-ia</word>
- <word>Pe-o̧o̧t</word>
- <word>Pet</word>
- <word>Pi-ļōļ</word>
- <word>Pij-ļe-ļe</word>
- <word>Pi-kin wōt juon</word>
- <word>Pikōt</word>
- <word>Pikpikūr</word>
- <word>Piliej</word>
- <word>Pilin̄lin̄</word>
- <word>Pinej jenkwan</word>
- <word>Pi-o̧</word>
- <word>Pi-o-lōt</word>
- <word>Pi-ti</word>
- <word>Pi-tōn</word>
- <word>Pit-pit</word>
- <word>Pit-to</word>
- <word>Po</word>
- <word>Pok</word>
- <word>Pok-tak</word>
- <word>Po-tak</word>
- <word>Ppaļ</word>
- <word>Ppaļ</word>
- <word>Pu-kot</word>
- <word>Pu-waļ</word>
- <word>Quart</word>
- <word>Rā</word>
- <word>Rā</word>
- <word>Raan-tak</word>
- <word>Ra-bōl-bōl</word>
- <word>Rae-lep</word>
- <word>Rā-jet</word>
- <word>Rā-je-tak</word>
- <word>Rak</word>
- <word>Rā-peļ-ta-</word>
- <word>Rā-rōk</word>
- <word>Raut</word>
- <word>Ree-aar</word>
- <word>Re-je-tak</word>
- <word>Ri-rar</word>
- <word>Ri-ver</word>
- <word>Ro̧</word>
- <word>Ro-ļo̧k</word>
- <word>Rō-jan̄</word>
- <word>Rō-kean̄-</word>
- <word>Ro̧k-lep</word>
- <word>Ro̧k-rok</word>
- <word>Ro̧-kuj</word>
- <word>Rom</word>
- <word>Ro-maak</word>
- <word>Rō-n̄a-</word>
- <word>Ro-oje</word>
- <word>Ro-ro</word>
- <word>Ror-ror</word>
- <word>Rōm̧</word>
- <word>Rrā</word>
- <word>Rre</word>
- <word>Rū-bu-kwi</word>
- <word>Ru-je</word>
- <word>Rū-kaa-nij</word>
- <word>Run̄-ļo̧k</word>
- <word>Ru-ru-we</word>
- <word>Rūt-to-un</word>
- <word>Ruum̧</word>
- <word>Ru-waak</word>
- <word>Sa-bat</word>
- <word>Sen-ser</word>
- <word>Si-dar</word>
- <word>Sim-bal</word>
- <word>Spoon</word>
- <word>Sul-fur</word>
- <word>Ta-</word>
- <word>Tāān̄</word>
- <word>Tab</word>
- <word>Tab</word>
- <word>Ta-bu</word>
- <word>Tak-</word>
- <word>Tam-bo-rin</word>
- <word>Tar-rin</word>
- <word>Tā-m̧oņ</word>
- <word>Te-aak</word>
- <word>Te-bōļ</word>
- <word>Teep</word>
- <word>Tein̄</word>
- <word>Ti-jem̧ba</word>
- <word>Ti-lek-ek</word>
- <word>Tip-dik-dik</word>
- <word>Ti-pi-ji</word>
- <word>Tip-n̄ōl</word>
- <word>Ti-m̧oņ</word>
- <word>To</word>
- <word>Tō-ņak</word>
- <word>To̧-ļūm</word>
- <word>Tō-bal-bal</word>
- <word>Tōb-tōb</word>
- <word>Tōb-we</word>
- <word>Tō-ke-ak</word>
- <word>To-ļaj</word>
- <...
[truncated message content] |
|
From: <vic...@us...> - 2009-03-15 18:22:16
|
Revision: 10687
http://foray.svn.sourceforge.net/foray/?rev=10687&view=rev
Author: victormote
Date: 2009-03-15 18:21:21 +0000 (Sun, 15 Mar 2009)
Log Message:
-----------
Move the TernaryTreeMap class from the hyphenation module to the common module, where it can be more widely used.
Modified Paths:
--------------
trunk/foray/foray-common/src/javatest/org/foray/common/TestFOrayCommon.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java
trunk/foray/foray-hyphen/src/javatest/org/foray/hyphen/TestFOrayHyphen.java
Added Paths:
-----------
trunk/foray/foray-common/src/java/org/foray/common/TernaryTreeMap.java
trunk/foray/foray-common/src/javatest/org/foray/common/TestTernaryTree.java
Removed Paths:
-------------
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTreeMap.java
trunk/foray/foray-hyphen/src/javatest/org/foray/hyphen/TestTernaryTree.java
Copied: trunk/foray/foray-common/src/java/org/foray/common/TernaryTreeMap.java (from rev 10686, trunk/foray/foray-hyphen/src/java/org/foray/hyphen/TernaryTreeMap.java)
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/TernaryTreeMap.java (rev 0)
+++ trunk/foray/foray-common/src/java/org/foray/common/TernaryTreeMap.java 2009-03-15 18:21:21 UTC (rev 10687)
@@ -0,0 +1,797 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+/*
+ * Known Constributors:
+ * Carlos Villegas <ca...@un...> (Original author)
+ */
+
+package org.foray.common;
+
+
+import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.Stack;
+
+/**
+ * <p>A map whose key is always a {@link CharSequence} (usually a {@link String}), and whose value
+ * is a char, usually used to store an index into some other data structure.
+ * This class is intended to serve as a base class or helper class for natural-language dictionaries
+ * and similar data structures.</p>
+ *
+ * <p>A ternary search tree is a hybrid between a binary tree and a digital search tree (trie).
+ * Ternary trees have some nice properties, including the following:
+ * <ul>
+ * <li>The tree can be traversed in sorted order.</li>
+ * <li>Partial matches (wildcards) can be implemented.</li>
+ * <li>Retrieval of all keys within a given distance from the target is possible.</li>
+ * <li>The storage requirements are higher than a binary tree but a lot less than a trie.</li>
+ * <li>Performance is comparable with a hash table.
+ * Sometimes it outperforms a hash function, and can usually determine a miss faster than a
+ * hash.</li>
+ * </ul>
+ * </p>
+ *
+ * <p>In this implementation the value is a char (think "unsigned short"), and is stored in the leaf
+ * nodes of the tree.
+ * This limits the number of nodes to 65,536.
+ * Branches that contain only one key are compressed to one node by storing a pointer to the trailer
+ * substring of the key.
+ * A compressed branch needs only one node per key plus the size of the string key.
+ * Compressed branches are decompressed as needed when another key with same prefix is inserted.
+ * This saves a lot of space, especially for long keys.</p>
+ *
+ * <p>This class could be extended to or embedded in a general map that would allow arbitrary
+ * objects to be values in the map.
+ * One scheme for doing so would be to create an array of the value Objects, and use this class to
+ * store the indexes to that array.</p>
+ */
+
+public class TernaryTreeMap implements Cloneable, Serializable {
+ /* TODO: After all other API-related to-do items are cleaned up, consider moving this class
+ * to Common module. */
+
+ /** Allocation size for arrays. */
+ private static final int BLOCK_SIZE = 2048;
+
+ /** Constant used for serialization. */
+ private static final long serialVersionUID = 240904407206584695L;
+
+ /*
+ * We use four arrays of equal size to represent the nodes in this tree.
+ * A given node /n/ is represented by the values in the arrays lo, hi, eq, and sc.
+ * It is tempting to group these four arrays into a private inner class, and the original author
+ * of this class left documentation kind of apologizing for not doing so.
+ * However, experimentation shows that the extra object references created when doing so more
+ * than doubles the size of the serialized instance, and therefore presumably does approximately
+ * the same to memory consumption.
+ * Since a light memory footprint is one of the main design considerations for this class, we
+ * will use the original parallel arrays instead.
+ */
+
+ /**
+ * If {@link #keyChar} is a valid Unicode character, this array contains the index to the node
+ * containing the "low" branch, that is the branch that should be traversed to find a char
+ * that is less than {@link #keyChar}.
+ * If {@link #keyChar} is equal to U+FFFF, the compressed branch indicator, then this array
+ * instead contains the index into {@link #compressedKeys} that contains the first char in the
+ * compressed portion of the key.
+ */
+ private char[] lo;
+
+ /**
+ * The index to the node containing the "hi" branch, that is the branch that should be traversed
+ * to find a char that is greater than {@link #keyChar}.
+ */
+ private char[] hi;
+
+ /**
+ * If {@link #keyChar} is a valid Unicode character, this array contains the index to the node
+ * containing the "equal" branch, that is the branch that should be traversed to find a char
+ * that is equal to {@link #keyChar}.
+ * If {@link #keyChar} is equal to U+0000, the string terminator, then this array instead
+ * contains value for this map element.
+ */
+ private char[] eq;
+
+ /**
+ * <P>The character, which is part of the key, stored in this node.
+ * Two special values are reserved:</P>
+ * <ul>
+ * <li>0x0000 is the string terminator. If the node contains this value, then the search is
+ * done and the value in {@link #eq} should be returned.</li>
+ * <li>0xFFFF to indicate that the branch starting at this node is compressed.
+ * This shouldn't be a problem if we give the usual semantics to strings since 0xFFFF is
+ * guaranteed not to be a valid Unicode character.</li>
+ * </ul>
+ */
+ private char[] keyChar;
+
+ /** This vector holds the compressed portion of a key when the branch is compressed.
+ * It is simply a series of word fragments, each followed by a
+ * {@link StringUtil#NULL_TERMINATOR}.
+ * The index to the start of the compressed portion of the key for a given node in the tree is
+ * found in the {@link #lo} value for the node. */
+ private CharVector compressedKeys;
+
+ /** The index of the root of the current branch?? */
+ private char root;
+
+ /** The index to the next available node. */
+ private char freenode;
+
+ /** The number of key-value pairs mapped in the tree.
+ * This is not necessarily the same as the number of nodes in the tree, because of branch
+ * compression, and because it frequently takes more than one node to store the chars in a
+ * key. */
+ private int length;
+
+ /**
+ * Constructor.
+ */
+ public TernaryTreeMap() {
+ init();
+ }
+
+ /**
+ * Initializes the basic data structures of the tree.
+ */
+ private void init() {
+ this.root = 0;
+ this.freenode = 1;
+ this.length = 0;
+ this.lo = new char[TernaryTreeMap.BLOCK_SIZE];
+ this.hi = new char[TernaryTreeMap.BLOCK_SIZE];
+ this.eq = new char[TernaryTreeMap.BLOCK_SIZE];
+ this.keyChar = new char[TernaryTreeMap.BLOCK_SIZE];
+ this.compressedKeys = new CharVector();
+ }
+
+ /**
+ * Put part or all of one char[] in the map.
+ * @param key The key to be added.
+ * @param value The value.
+ */
+ public void put(final char[] key, final char value) {
+ put(key, 0, value);
+ }
+
+ /**
+ * Put part or all of one char[] in the map.
+ * @param key The key to be added.
+ * @param start The index to the first char in <code>key</code> to be added.
+ * @param value The value.
+ */
+ public void put(final char[] key, final int start, final char value) {
+ put(key, start, key.length, value);
+ }
+
+ /**
+ * Put part or all of one char[] in the map.
+ * @param key The key to be added.
+ * @param start The index to the first char in <code>key</code> to be added.
+ * @param end The index to the first char in <code>key</code>, after <code>start</code> that should NOT be added.
+ * @param value The value.
+ */
+ public void put(final char[] key, final int start, final int end, final char value) {
+ final String keyString = new String(key, start, end - start);
+ put(keyString, value);
+ }
+
+ /**
+ * Put one String or other CharSequence in the map.
+ * @param key The key to be added.
+ * @param value The value.
+ */
+ public void put(final CharSequence key, final char value) {
+ this.put(key, 0, value);
+ }
+
+ /**
+ * Put one String or other CharSequence in the map.
+ * @param key The key to be added.
+ * @param start The index to the first char in <code>key</code> to be added.
+ * @param value The value.
+ */
+ public void put(final CharSequence key, final int start, final char value) {
+ put(key, start, key.length(), value);
+ }
+
+ /**
+ * Put one String or other CharSequence in the map.
+ * @param key The key to be added.
+ * @param start The index to the first char in <code>key</code> to be added.
+ * @param end The index to the first char in <code>key</code>, after <code>start</code> that should NOT be added.
+ * @param value The value.
+ */
+ public void put(final CharSequence key, final int start, final int end, final char value) {
+ ensureCapacity(this.getNodeCount() + end - start + 1);
+ this.root = put(this.root, key, start, end, value);
+ }
+
+ /**
+ * The actual insertion function, which is recursive.
+ * @param p The initial root value.
+ * @param key The key to be added.
+ * @param start The index to the first char in <code>key</code> to be added.
+ * @param end The index to the first char in <code>key</code>, after <code>start</code> that should NOT be added.
+ * @param value The value.
+ * @return The updated root value.
+ */
+ private char put(final char p, final CharSequence key, final int start, final int end, final char value) {
+ char pToUse = p;
+ final int len = end - start;
+ if (pToUse == 0) {
+ // this means there is no branch, this node will start a new branch.
+ // Instead of doing that, we store the key somewhere else and create
+ // only one node with a pointer to the key
+ pToUse = this.freenode++;
+ /* Holds data. */
+ this.eq[pToUse] = value;
+ this.length++;
+ this.hi[pToUse] = 0;
+ if (len > 0) {
+ /* Indicates branch is compressed */
+ this.keyChar[pToUse] = Character.MAX_VALUE;
+ /* Use "lo" to hold pointer to key. */
+ this.lo[pToUse] = (char) this.compressedKeys.add(key, start, len);
+ this.compressedKeys.add(StringUtil.NULL_TERMINATOR);
+ } else {
+ this.keyChar[pToUse] = 0;
+ this.lo[pToUse] = 0;
+ }
+ return pToUse;
+ }
+
+ if (this.keyChar[pToUse] == Character.MAX_VALUE) {
+ final char pp = this.freenode++;
+ this.lo[pp] = this.lo[pToUse];
+ this.eq[pp] = this.eq[pToUse];
+ this.lo[pToUse] = 0;
+ if (len > 0) {
+ this.keyChar[pToUse] = this.compressedKeys.get(this.lo[pp]);
+ this.eq[pToUse] = pp;
+ this.lo[pp]++;
+ if (this.compressedKeys.get(this.lo[pp]) == 0) {
+ this.lo[pp] = 0;
+ this.keyChar[pp] = 0;
+ this.hi[pp] = 0;
+ } else {
+ this.keyChar[pp] = Character.MAX_VALUE;
+ }
+ } else {
+ this.keyChar[pp] = Character.MAX_VALUE;
+ this.hi[pToUse] = pp;
+ this.keyChar[pToUse] = 0;
+ this.eq[pToUse] = value;
+ this.length++;
+ return pToUse;
+ }
+ }
+ final char s = key.charAt(start);
+ if (s < this.keyChar[pToUse]) {
+ this.lo[pToUse] = put(this.lo[pToUse], key, start, end, value);
+ } else if (s == this.keyChar[pToUse]) {
+ if (s != 0) {
+ this.eq[pToUse] = put(this.eq[pToUse], key, start + 1, end, value);
+ } else {
+ // key already in tree, overwrite data
+ this.eq[pToUse] = value;
+ }
+
+ } else {
+ this.hi[pToUse] = put(this.hi[pToUse], key, start, end, value);
+ }
+ return pToUse;
+ }
+
+ /**
+ * Returns the mapped "value" for a given char array.
+ * @param key The key whose value is needed.
+ * @return The mapped value.
+ */
+ public int get(final char[] key) {
+ return get(key, 0);
+ }
+
+ /**
+ * Returns the mapped "value" for a given char array.
+ * @param key The key whose value is needed.
+ * @param start The index to the first element in <code>key</code> which should be considered part of the key.
+ * @return The mapped value.
+ */
+ public int get(final char[] key, final int start) {
+ return get(key, start, key.length);
+ }
+
+ /**
+ * Returns the mapped "value" for a given char array.
+ * @param key The key whose value is needed.
+ * @param start The index to the first element in <code>key</code> which should be considered part of the key.
+ * @param end The index to the first element in <code>key</code>, after <code>start</code>, which should NOT be
+ * considered part of the key.
+ * @return The mapped value, if <code>key</code> is in the map. Otherwise, returns -1;
+ */
+ public int get(final char[] key, final int start, final int end) {
+ final int length = end - start;
+ final String keyString = new String(key, start, length);
+ return get(keyString);
+ }
+
+ /**
+ * Returns the mapped "value" for a given String or other CharSequence key.
+ * @param key The key whose value is needed.
+ * @return The mapped value.
+ */
+ public int get(final CharSequence key) {
+ return get(key, 0);
+ }
+
+ /**
+ * Returns the mapped "value" for a given String or other CharSequence key.
+ * @param key The key whose value is needed.
+ * @param start The index to the first element in <code>key</code> which should be considered part of the key.
+ * @return The mapped value.
+ */
+ public int get(final CharSequence key, final int start) {
+ return get(key, start, key.length());
+ }
+
+ /**
+ * Returns the mapped "value" for a given String or other CharSequence key.
+ * @param key The key whose value is needed.
+ * @param start The index to the first element in <code>key</code> which should be considered part of the key.
+ * @param end The index to the first element in <code>key</code>, after <code>start</code>, which should NOT be
+ * considered part of the key.
+ * @return The mapped value, if <code>key</code> is in the map. Otherwise, returns -1;
+ */
+ public int get(final CharSequence key, final int start, final int end) {
+ int d;
+ char p = this.root;
+ int i = start;
+ char c;
+
+ while (p != 0) {
+ if (this.keyChar[p] == Character.MAX_VALUE) {
+ if (this.compressedKeys.compareNullTerminated(this.lo[p], key, i, end) == 0) {
+ return this.eq[p];
+ }
+ return -1;
+ }
+ if (i >= end) {
+ /* If we are past the end of the key, then pretend like we have a
+ * null-terminator. */
+ c = 0;
+ } else {
+ c = key.charAt(i);
+ }
+ d = c - this.keyChar[p];
+ if (d == 0) {
+ if (c == 0) {
+ return this.eq[p];
+ }
+ i++;
+ p = this.eq[p];
+ } else if (d < 0) {
+ p = this.lo[p];
+ } else {
+ p = this.hi[p];
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Ensures that the internal data structures have enough nodes to handle a given number of nodes.
+ * @param newCapacity The new number of nodes that needs to be ensured.
+ */
+ private void ensureCapacity(final int newCapacity) {
+ if (newCapacity > this.eq.length) {
+ redimNodeArrays(this.eq.length + TernaryTreeMap.BLOCK_SIZE);
+ }
+ }
+
+ /**
+ * Resizes the arrays.
+ * @param newsize The new number of nodes in the tree.
+ */
+ private void redimNodeArrays(final int newsize) {
+ int len = 0;
+ if (newsize < this.lo.length) {
+ len = newsize;
+ } else {
+ len = this.lo.length;
+ }
+ char[] na = new char[newsize];
+ System.arraycopy(this.lo, 0, na, 0, len);
+ this.lo = na;
+ na = new char[newsize];
+ System.arraycopy(this.hi, 0, na, 0, len);
+ this.hi = na;
+ na = new char[newsize];
+ System.arraycopy(this.eq, 0, na, 0, len);
+ this.eq = na;
+ na = new char[newsize];
+ System.arraycopy(this.keyChar, 0, na, 0, len);
+ this.keyChar = na;
+ }
+
+ /**
+ * Returns the number of key-value pairs in this map.
+ * This can be different from the number of nodes in the tree because of the compressed
+ * branches.
+ * @return The number of key-value pairs in this map.
+ */
+ public int size() {
+ return this.length;
+ }
+
+ /**
+ * Returns the number of nodes in the tree.
+ * @return The number of nodes in the tree.
+ */
+ int getNodeCount() {
+ return this.freenode;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public TernaryTreeMap clone() {
+ final TernaryTreeMap t = new TernaryTreeMap();
+ t.lo = this.lo.clone();
+ t.hi = this.hi.clone();
+ t.eq = this.eq.clone();
+ t.keyChar = this.keyChar.clone();
+ t.compressedKeys = this.compressedKeys.clone();
+ t.root = this.root;
+ t.freenode = this.freenode;
+ t.length = this.length;
+
+ return t;
+ }
+
+ /**
+ * Recursively insert the median first and then the median of the
+ * lower and upper halves, and so on in order to get a balanced
+ * tree. The array of keys is assumed to be sorted in ascending
+ * order.
+ * @param keys The array of keys to be processed.
+ * @param values The array of values to be processed.
+ * @param offset The offset from the computed median at which the item
+ * should be inserted.
+ * @param upperBound The highest index which should be used in the new
+ * median computation.
+ */
+ private void insertBalanced(final String[] keys, final char[] values,
+ final int offset, final int upperBound) {
+ if (upperBound < 1) {
+ return;
+ }
+
+ /* Compute the median index as 1/2 of the upperBound. */
+ final int median = upperBound >> 1;
+
+ /* Insert the median key into the tree. */
+ put(keys[median + offset], values[median + offset]);
+
+ /* Recursively insert into the lower half of the branch. */
+ insertBalanced(keys, values, offset, median);
+
+ /* Recursively insert into the upper half of the branch. */
+ insertBalanced(keys, values, offset + median + 1,
+ upperBound - median - 1);
+ }
+
+ /**
+ * Balance the tree for best search performance.
+ */
+ private void balance() {
+ int i = 0;
+ final int n = this.length;
+ final String[] k = new String[n];
+ final char[] v = new char[n];
+ final Iterator iter = new Iterator();
+ while (iter.hasMoreElements()) {
+ v[i] = iter.getValue();
+ k[i++] = iter.nextElement();
+ }
+ init();
+ insertBalanced(k, v, 0, n);
+ // With uniform letter distribution sc[root] should be around 'm'
+ }
+
+ /**
+ * Allows the map to internally optimize itself for faster performance and possible memory
+ * reduction.
+ * This method should be run only once, immediately after the tree is completely built.
+ */
+ public void optimize() {
+ /* Each node stores a character which is part of
+ * some key(s). In a compressed branch (one that only contain
+ * a single string key) the trailer of the key which is not
+ * already in nodes is stored externally in the kv array.
+ * As items are inserted, key substrings decrease.
+ * Some substrings may completely disappear when the whole
+ * branch is totally decompressed.
+ * The tree is traversed to find the key substrings actually
+ * used. In addition, duplicate substrings are removed using
+ * a map (implemented with a TernaryTree!).
+ */
+
+ /* First balance the tree for best performance. */
+ balance();
+
+ /* Redimension the node arrays. */
+ redimNodeArrays(this.freenode);
+
+ // ok, compact kv array
+ final CharVector kx = new CharVector();
+ final TernaryTreeMap map = new TernaryTreeMap();
+ compact(kx, map, this.root);
+ this.compressedKeys = kx;
+ this.compressedKeys.trimToSize();
+ }
+
+ /**
+ * Compacts the trailing key vector.
+ * @param kx The new trailing key vector.
+ * @param map The map being used to look for duplicates.
+ * @param p The index to the node being tested.
+ */
+ private void compact(final CharVector kx, final TernaryTreeMap map,
+ final char p) {
+ int k;
+ if (p == 0) {
+ return;
+ }
+ if (this.keyChar[p] == Character.MAX_VALUE) {
+ k = map.get(this.compressedKeys, this.lo[p]);
+ if (k < 0) {
+ final int start = this.lo[p];
+ k = kx.addNullTerminated(this.compressedKeys, start);
+ kx.add(StringUtil.NULL_TERMINATOR);
+ map.put(kx, k, (char) k);
+ }
+ this.lo[p] = (char) k;
+ } else {
+ compact(kx, map, this.lo[p]);
+ if (this.keyChar[p] != 0) {
+ compact(kx, map, this.eq[p]);
+ }
+ compact(kx, map, this.hi[p]);
+ }
+ }
+
+ /**
+ * Inner class Iterator implementation.
+ */
+ public class Iterator implements Enumeration<String> {
+
+ /** Current node index. */
+ private int cur;
+
+ /** Current key. */
+ private String curkey;
+
+ /**
+ * Inner class Cloneable implementation.
+ */
+ private class Item implements Cloneable {
+ /** The parent char of the Item. */
+ private char parent;
+
+ /** The child char of the Item. */
+ private char child;
+
+ /**
+ * No-argument constructor.
+ */
+ public Item() {
+ this.parent = 0;
+ this.child = 0;
+ }
+
+ /**
+ * Constructor.
+ * @param parent Index to the parent node.
+ * @param child Index to the child node.
+ */
+ public Item(final char parent, final char child) {
+ this.parent = parent;
+ this.child = child;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Item clone() {
+ return new Item(this.parent, this.child);
+ }
+
+ }
+
+ /** Node stack. */
+ private Stack<TernaryTreeMap.Iterator.Item> ns;
+
+ /** Key stack implemented with a StringBuffer. */
+ private StringBuilder ks;
+
+ /**
+ * Constructor.
+ */
+ public Iterator() {
+ this.cur = -1;
+ this.ns = new Stack<TernaryTreeMap.Iterator.Item>();
+ this.ks = new StringBuilder();
+ rewind();
+ }
+
+ /**
+ * Rewinds the iterator to point to its first item.
+ */
+ public void rewind() {
+ this.ns.removeAllElements();
+ this.ks.setLength(0);
+ this.cur = TernaryTreeMap.this.root;
+ run();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String nextElement() {
+ final String res = new String(this.curkey);
+ this.cur = up();
+ run();
+ return res;
+ }
+
+ /**
+ * Returns the value of the current key of the iterator.
+ * @return The index value of the current key of the iterator.
+ */
+ public char getValue() {
+ if (this.cur >= 0) {
+ return TernaryTreeMap.this.eq[this.cur];
+ }
+ return 0;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean hasMoreElements() {
+ return this.cur != -1;
+ }
+
+ /**
+ * Move up one level in the tree??
+ * @return The index to the next level up in the tree??
+ */
+ private int up() {
+ Item i = new Item();
+ int res = 0;
+
+ if (this.ns.empty()) {
+ return -1;
+ }
+
+ if (this.cur != 0
+ && TernaryTreeMap.this.keyChar[this.cur] == 0) {
+ return TernaryTreeMap.this.lo[this.cur];
+ }
+
+ boolean climb = true;
+
+ while (climb) {
+ i = this.ns.pop();
+ i.child++;
+ switch (i.child) {
+ case 1:
+ if (TernaryTreeMap.this.keyChar[i.parent] != 0) {
+ res = TernaryTreeMap.this.eq[i.parent];
+ this.ns.push(i.clone());
+ this.ks.append(TernaryTreeMap.this.keyChar[i.parent]);
+ } else {
+ i.child++;
+ this.ns.push(i.clone());
+ res = TernaryTreeMap.this.hi[i.parent];
+ }
+ climb = false;
+ break;
+
+ case 2:
+ res = TernaryTreeMap.this.hi[i.parent];
+ this.ns.push(i.clone());
+ if (this.ks.length() > 0) {
+ this.ks.setLength(this.ks.length() - 1); // pop
+ }
+ climb = false;
+ break;
+
+ default:
+ if (this.ns.empty()) {
+ return -1;
+ }
+ climb = true;
+ break;
+ }
+ }
+ return res;
+ }
+
+ /**
+ * Traverse the tree to find next key.
+ * @return The index to the next item in the map??
+ */
+ private int run() {
+ if (this.cur == -1) {
+ return -1;
+ }
+
+ boolean leaf = false;
+ for (;;) {
+ // first go down on low branch until leaf or compressed branch
+ while (this.cur != 0) {
+ if (TernaryTreeMap.this.keyChar[this.cur] == Character.MAX_VALUE) {
+ leaf = true;
+ break;
+ }
+ this.ns.push(new Item((char) this.cur, '\u0000'));
+ if (TernaryTreeMap.this.keyChar[this.cur] == 0) {
+ leaf = true;
+ break;
+ }
+ this.cur = TernaryTreeMap.this.lo[this.cur];
+ }
+ if (leaf) {
+ break;
+ }
+ // nothing found, go up one node and try again
+ this.cur = up();
+ if (this.cur == -1) {
+ return -1;
+ }
+ }
+ // The current node should be a data node and
+ // the key should be in the key stack (at least partially)
+ final StringBuilder buf = new StringBuilder(this.ks.toString());
+ if (TernaryTreeMap.this.keyChar[this.cur] == Character.MAX_VALUE) {
+ int p = TernaryTreeMap.this.lo[this.cur];
+ while (TernaryTreeMap.this.compressedKeys.get(p) != 0) {
+ buf.append(TernaryTreeMap.this.compressedKeys.get(p++));
+ }
+ ...
[truncated message content] |
|
From: <vic...@us...> - 2009-03-15 18:30:40
|
Revision: 10689
http://foray.svn.sourceforge.net/foray/?rev=10689&view=rev
Author: victormote
Date: 2009-03-15 18:30:20 +0000 (Sun, 15 Mar 2009)
Log Message:
-----------
Clean up some documentation and to-do items.
Modified Paths:
--------------
trunk/foray/foray-common/src/java/org/foray/common/TernaryTreeMap.java
trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java
Modified: trunk/foray/foray-common/src/java/org/foray/common/TernaryTreeMap.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/TernaryTreeMap.java 2009-03-15 18:25:04 UTC (rev 10688)
+++ trunk/foray/foray-common/src/java/org/foray/common/TernaryTreeMap.java 2009-03-15 18:30:20 UTC (rev 10689)
@@ -73,8 +73,6 @@
*/
public class TernaryTreeMap implements Cloneable, Serializable {
- /* TODO: After all other API-related to-do items are cleaned up, consider moving this class
- * to Common module. */
/** Allocation size for arrays. */
private static final int BLOCK_SIZE = 2048;
Modified: trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java
===================================================================
--- trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java 2009-03-15 18:25:04 UTC (rev 10688)
+++ trunk/foray/foray-hyphen/src/java/org/foray/hyphen/HyphenationTree.java 2009-03-15 18:30:20 UTC (rev 10689)
@@ -225,26 +225,9 @@
}
/**
- * <p>Search for all possible partial matches of word starting at a given index, and update the
- * interletter values. In other words, it
- * does something like:</p>
- * <code>
- * for(i = 0; i < patterns.length; i++) {
- * if ( word.substring(index).startsWidth(patterns[i]) )
- * update_interletter_values(patterns[i]);
- * }
- * </code>
- * <p>But it is done in an efficient way since the patterns are
- * stored in a ternary tree. In fact, this is the whole purpose
- * of having the tree: doing this search without having to test
- * every single pattern. The number of patterns for languages
- * such as English range from 4000 to 10000. Thus, doing thousands
- * of string comparisons for each word to hyphenate would be
- * really slow without the tree. The tradeoff is memory, but
- * using a ternary tree instead of a trie, almost halves the
- * the memory used by Lout or TeX. It's also faster than using
- * a hash table</p>
- * @param word The null-terminated word to match.
+ * <p>Search for all possible partial matches of a given word starting at a given index, and update the
+ * interletter values accordingly.
+ * @param word The word to match.
* @param startingWordIndex The starting index in word that should be tested.
* @param il The interletter values array that should be updated.
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-03-16 18:43:19
|
Revision: 10697
http://foray.svn.sourceforge.net/foray/?rev=10697&view=rev
Author: victormote
Date: 2009-03-16 18:42:56 +0000 (Mon, 16 Mar 2009)
Log Message:
-----------
1. Partial conversion to JUnit 4 annotation-based syntax.
2. Add @Ignore annotation to TernaryTestMap test that is currently failing.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayAll.java
trunk/foray/foray-common/src/javatest/org/foray/common/TestFOrayCommon.java
trunk/foray/foray-common/src/javatest/org/foray/common/TestTernaryTreeMap.java
trunk/foray/lib/foray-hyphen-0.4-rsrc.jar
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayAll.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayAll.java 2009-03-16 18:08:49 UTC (rev 10696)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayAll.java 2009-03-16 18:42:56 UTC (rev 10697)
@@ -37,32 +37,26 @@
import org.foray.ps.TestFOrayPS;
import org.foray.render.TestFOrayRender;
-import junit.framework.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
import junit.framework.TestSuite;
/**
* Master Test harness for all FOray modules.
*/
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ TestFOrayCommon.class,
+ TestFOrayPS.class,
+ TestFOrayFont.class,
+ TestFOrayGraphic.class,
+ TestFOrayHyphen.class,
+ TestFOrayFOTree.class,
+ TestFOrayAreaTree.class,
+ TestFOrayRender.class,
+ TestFOrayApp.class,
+})
public class TestFOrayAll extends TestSuite {
- /**
- * Builds a test suite for modules in FOray.
- * @return The built test suite.
- */
- public static Test suite() {
- final TestSuite testSuite = new TestSuite("All FOray Tests");
-
- testSuite.addTest(TestFOrayCommon.suite());
- testSuite.addTest(TestFOrayPS.suite());
- testSuite.addTest(TestFOrayFont.suite());
- testSuite.addTest(TestFOrayGraphic.suite());
- testSuite.addTest(TestFOrayHyphen.suite());
- testSuite.addTest(TestFOrayFOTree.suite());
- testSuite.addTest(TestFOrayAreaTree.suite());
- testSuite.addTest(TestFOrayRender.suite());
- testSuite.addTest(TestFOrayApp.suite());
-
- return testSuite;
- }
-
}
Modified: trunk/foray/foray-common/src/javatest/org/foray/common/TestFOrayCommon.java
===================================================================
--- trunk/foray/foray-common/src/javatest/org/foray/common/TestFOrayCommon.java 2009-03-16 18:08:49 UTC (rev 10696)
+++ trunk/foray/foray-common/src/javatest/org/foray/common/TestFOrayCommon.java 2009-03-16 18:42:56 UTC (rev 10697)
@@ -28,17 +28,27 @@
package org.foray.common;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
import java.io.File;
import java.io.IOException;
import java.util.Properties;
-import junit.framework.Test;
import junit.framework.TestCase;
-import junit.framework.TestSuite;
/**
* Handles testing for the FOrayCommon module.
*/
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ TestBit.class,
+ TestByteVectorPacked.class,
+ TestCharVector.class,
+ TestStringUtil.class,
+ TestTernaryTreeMap.class,
+ TestUnicodeChar.class,
+})
public class TestFOrayCommon extends TestCase {
/**
@@ -64,21 +74,4 @@
return new File(sandbox, "/resource/test/");
}
- /**
- * Builds a test suite for all classes in this module.
- * @return The built test suite.
- */
- public static Test suite() {
- final TestSuite testSuite = new TestSuite("FOray Common");
-
- testSuite.addTestSuite(TestBit.class);
- testSuite.addTestSuite(TestByteVectorPacked.class);
- testSuite.addTestSuite(TestCharVector.class);
- testSuite.addTestSuite(TestStringUtil.class);
- testSuite.addTestSuite(TestTernaryTreeMap.class);
- testSuite.addTestSuite(TestUnicodeChar.class);
-
- return testSuite;
- }
-
}
Modified: trunk/foray/foray-common/src/javatest/org/foray/common/TestTernaryTreeMap.java
===================================================================
--- trunk/foray/foray-common/src/javatest/org/foray/common/TestTernaryTreeMap.java 2009-03-16 18:08:49 UTC (rev 10696)
+++ trunk/foray/foray-common/src/javatest/org/foray/common/TestTernaryTreeMap.java 2009-03-16 18:42:56 UTC (rev 10697)
@@ -28,16 +28,20 @@
package org.foray.common;
+import org.junit.Ignore;
+import org.junit.Test;
+
import junit.framework.TestCase;
/**
* JUnit test class for the class {@link TernaryTreeMap}.
*/
-public class TestTernaryTreeMap extends TestCase {
+public class TestTernaryTreeMap {
/**
* Functional test which adds some key-value pairs to a TernaryTree, then queries the tree, testing the output.
*/
+ @Test
public void testOutput01() {
/* Check the CharSequence putters for whole words. */
TernaryTreeMap map = new TernaryTreeMap();
@@ -100,61 +104,62 @@
*/
private void checkGetters(final TernaryTreeMap map) {
/* Check the CharSequence getters for whole words. */
- assertEquals('C', (char) map.get("Carlos"));
- assertEquals('r', (char) map.get("Car"));
- assertEquals('l', (char) map.get("palos"));
- assertEquals('p', (char) map.get("pa"));
- assertEquals(-1, map.get("alto"));
- assertEquals(-1, map.get("C"));
+ TestCase.assertEquals('C', (char) map.get("Carlos"));
+ TestCase.assertEquals('r', (char) map.get("Car"));
+ TestCase.assertEquals('l', (char) map.get("palos"));
+ TestCase.assertEquals('p', (char) map.get("pa"));
+ TestCase.assertEquals(-1, map.get("alto"));
+ TestCase.assertEquals(-1, map.get("C"));
/* Check the CharSequence getters for words starting in the middle of a string. */
- assertEquals('C', (char) map.get("ABCCarlos", 3));
- assertEquals('r', (char) map.get("ABCCar", 3));
- assertEquals('l', (char) map.get("ABCpalos", 3));
- assertEquals('p', (char) map.get("ABCpa", 3));
- assertEquals(-1, map.get("ABCalto", 3));
- assertEquals(-1, map.get("ABCC", 3));
+ TestCase.assertEquals('C', (char) map.get("ABCCarlos", 3));
+ TestCase.assertEquals('r', (char) map.get("ABCCar", 3));
+ TestCase.assertEquals('l', (char) map.get("ABCpalos", 3));
+ TestCase.assertEquals('p', (char) map.get("ABCpa", 3));
+ TestCase.assertEquals(-1, map.get("ABCalto", 3));
+ TestCase.assertEquals(-1, map.get("ABCC", 3));
/* Check the CharSequence getters for words starting and ending in the middle of a string. */
- assertEquals('C', (char) map.get("ABCCarlosXYZ", 3, 9));
- assertEquals('r', (char) map.get("ABCCarXYZ", 3, 6));
- assertEquals('l', (char) map.get("ABCpalosXYZ", 3, 8));
- assertEquals('p', (char) map.get("ABCpaABCXYZ", 3, 5));
- assertEquals(-1, map.get("ABCaltoXYZ", 3, 7));
- assertEquals(-1, map.get("ABCCXYZ", 3, 4));
+ TestCase.assertEquals('C', (char) map.get("ABCCarlosXYZ", 3, 9));
+ TestCase.assertEquals('r', (char) map.get("ABCCarXYZ", 3, 6));
+ TestCase.assertEquals('l', (char) map.get("ABCpalosXYZ", 3, 8));
+ TestCase.assertEquals('p', (char) map.get("ABCpaABCXYZ", 3, 5));
+ TestCase.assertEquals(-1, map.get("ABCaltoXYZ", 3, 7));
+ TestCase.assertEquals(-1, map.get("ABCCXYZ", 3, 4));
/* Check the char[] getters for whole words. */
- assertEquals('C', (char) map.get("Carlos".toCharArray()));
- assertEquals('r', (char) map.get("Car".toCharArray()));
- assertEquals('l', (char) map.get("palos".toCharArray()));
- assertEquals('p', (char) map.get("pa".toCharArray()));
- assertEquals(-1, map.get("alto".toCharArray()));
- assertEquals(-1, map.get("C".toCharArray()));
+ TestCase.assertEquals('C', (char) map.get("Carlos".toCharArray()));
+ TestCase.assertEquals('r', (char) map.get("Car".toCharArray()));
+ TestCase.assertEquals('l', (char) map.get("palos".toCharArray()));
+ TestCase.assertEquals('p', (char) map.get("pa".toCharArray()));
+ TestCase.assertEquals(-1, map.get("alto".toCharArray()));
+ TestCase.assertEquals(-1, map.get("C".toCharArray()));
/* Check the char[] getters for words starting in the middle of a string. */
- assertEquals('C', (char) map.get("ABCCarlos".toCharArray(), 3));
- assertEquals('r', (char) map.get("ABCCar".toCharArray(), 3));
- assertEquals('l', (char) map.get("ABCpalos".toCharArray(), 3));
- assertEquals('p', (char) map.get("ABCpa".toCharArray(), 3));
- assertEquals(-1, map.get("ABCalto".toCharArray(), 3));
- assertEquals(-1, map.get("ABCC".toCharArray(), 3));
+ TestCase.assertEquals('C', (char) map.get("ABCCarlos".toCharArray(), 3));
+ TestCase.assertEquals('r', (char) map.get("ABCCar".toCharArray(), 3));
+ TestCase.assertEquals('l', (char) map.get("ABCpalos".toCharArray(), 3));
+ TestCase.assertEquals('p', (char) map.get("ABCpa".toCharArray(), 3));
+ TestCase.assertEquals(-1, map.get("ABCalto".toCharArray(), 3));
+ TestCase.assertEquals(-1, map.get("ABCC".toCharArray(), 3));
/* Check the char[] getters for words starting and ending in the middle of a string. */
- assertEquals('C', (char) map.get("ABCCarlosXYZ".toCharArray(), 3, 9));
- assertEquals('r', (char) map.get("ABCCarXYZ".toCharArray(), 3, 6));
- assertEquals('l', (char) map.get("ABCpalosXYZ".toCharArray(), 3, 8));
- assertEquals('p', (char) map.get("ABCpaABCXYZ".toCharArray(), 3, 5));
- assertEquals(-1, map.get("ABCaltoXYZ".toCharArray(), 3, 7));
- assertEquals(-1, map.get("ABCCXYZ".toCharArray(), 3, 4));
+ TestCase.assertEquals('C', (char) map.get("ABCCarlosXYZ".toCharArray(), 3, 9));
+ TestCase.assertEquals('r', (char) map.get("ABCCarXYZ".toCharArray(), 3, 6));
+ TestCase.assertEquals('l', (char) map.get("ABCpalosXYZ".toCharArray(), 3, 8));
+ TestCase.assertEquals('p', (char) map.get("ABCpaABCXYZ".toCharArray(), 3, 5));
+ TestCase.assertEquals(-1, map.get("ABCaltoXYZ".toCharArray(), 3, 7));
+ TestCase.assertEquals(-1, map.get("ABCCXYZ".toCharArray(), 3, 4));
- assertEquals(4, map.size());
+ TestCase.assertEquals(4, map.size());
/* TODO: We don't fully understand the node count here. */
- assertEquals(10, map.getNodeCount());
+ TestCase.assertEquals(10, map.getNodeCount());
}
/**
* Test the case where we put a compressed node in, then later put in a node that goes past that compressed node.
*/
+ @Test
public void testOutput02() {
/* Check the CharSequence putters for whole words. */
final TernaryTreeMap map = new TernaryTreeMap();
@@ -162,16 +167,18 @@
map.put("Carlos", 'C');
map.optimize();
- assertEquals('C', (char) map.get("Carlos"));
- assertEquals('r', (char) map.get("Car"));
- assertEquals(-1, map.get("alto"));
- assertEquals(-1, map.get("C"));
- assertEquals(2, map.size());
+ TestCase.assertEquals('C', (char) map.get("Carlos"));
+ TestCase.assertEquals('r', (char) map.get("Car"));
+ TestCase.assertEquals(-1, map.get("alto"));
+ TestCase.assertEquals(-1, map.get("C"));
+ TestCase.assertEquals(2, map.size());
}
/**
* A test culled from a real-world failure.
*/
+ @Test
+ @Ignore
public void testPut01() {
final TernaryTreeMap map = new TernaryTreeMap();
map.put("40", '1');
Modified: trunk/foray/lib/foray-hyphen-0.4-rsrc.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-03-19 16:44:16
|
Revision: 10716
http://foray.svn.sourceforge.net/foray/?rev=10716&view=rev
Author: victormote
Date: 2009-03-19 16:44:01 +0000 (Thu, 19 Mar 2009)
Log Message:
-----------
Conform to new aXSL requirements for Pdf gradients.
Modified Paths:
--------------
trunk/foray/foray-graphic/.classpath
trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPattern.java
Modified: trunk/foray/foray-graphic/.classpath
===================================================================
--- trunk/foray/foray-graphic/.classpath 2009-03-19 15:13:07 UTC (rev 10715)
+++ trunk/foray/foray-graphic/.classpath 2009-03-19 16:44:01 UTC (rev 10716)
@@ -30,5 +30,6 @@
<classpathentry kind="lib" path="/FOray Lib/xercesImpl-2.7.1.jar" sourcepath="/FOray Lib-Build/xerces/Xerces-J-src.2.7.1.zip"/>
<classpathentry kind="lib" path="/FOray Lib-Build/junit/junit-4.4.jar" sourcepath="/FOray Lib-Build/junit/junit-4.4-src.jar"/>
<classpathentry kind="lib" path="/FOray Lib/commons-io-1.4.jar" sourcepath="/FOray Lib-Build/commons-io/commons-io-1.4-sources.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/axslPdf"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java
===================================================================
--- trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java 2009-03-19 15:13:07 UTC (rev 10715)
+++ trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java 2009-03-19 16:44:01 UTC (rev 10716)
@@ -42,7 +42,6 @@
import org.foray.pdf.object.PDFDocument;
import org.foray.pdf.object.PDFLink;
import org.foray.pdf.object.PDFPage;
-import org.foray.pdf.object.PDFPattern;
import org.foray.pdf.object.PDFString;
import org.foray.pdf.object.PDFXObject;
@@ -51,6 +50,7 @@
import org.axsl.font.FontUtility;
import org.axsl.graphic.GraphicException;
import org.axsl.graphic.output.GraphicOutputContext;
+import org.axsl.pdf.PdfPattern;
import org.apache.commons.logging.Log;
@@ -584,9 +584,7 @@
final ColorSpace aColorSpace = ColorSpace.getInstance(
ColorSpace.CS_sRGB);
- final PDFPattern myPat = PDFPattern.createGradient(false,
- aColorSpace,
- someColors, null, theCoords, this.pdfDoc);
+ final PdfPattern myPat = this.pdfDoc.createGradient(false, aColorSpace, someColors, null, theCoords);
this.write(myPat.getSetterString(fill));
} else if (paint instanceof TexturePaint) { }
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2009-03-19 15:13:07 UTC (rev 10715)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2009-03-19 16:44:01 UTC (rev 10716)
@@ -36,11 +36,14 @@
package org.foray.pdf.object;
+import org.foray.common.ColorUtil;
+
import org.axsl.font.Font;
import org.axsl.font.FontUse;
import org.axsl.graphic.Graphic;
import org.axsl.pdf.PdfException;
import org.axsl.pdf.PdfPageLabelStyle;
+import org.axsl.pdf.PdfPattern;
import org.axsl.pdf.PdfVersion;
import org.axsl.ps.Encoding;
@@ -83,6 +86,10 @@
/** A bogus object added to the location list to ensure capacity. */
private static final Integer LOCATION_PLACEHOLDER = new Integer(0);
+ /** Constant indicating the number of components in a radial shading, that
+ * is, 6. */
+ private static final int QTY_RADIAL_SHADING_COMPONENTS = 6;
+
/** A binary comment as recommended by the PDF spec (3.4.1). */
private static final String BINARY_COMMENT = new String(new char[] {
(char) 0xAA,
@@ -775,4 +782,102 @@
this.getRoot().addPageLabel(startingPageIndex, newPageLabel);
}
+ /**
+ * {@inheritDoc}
+ */
+ public PdfPattern createGradient(final boolean radial, final ColorSpace theColorSpace, final List<Color> theColors,
+ final List<Double> theBounds, final List<Double> theCoords) {
+ PDFShading myShad;
+ PDFFunction myfunky;
+ PDFFunction myfunc;
+ List<Double> theCzero;
+ List<Double> theCone;
+ PDFPattern myPattern;
+ final double interpolation = 1.000;
+ final List<PDFFunction> theFunctions = new ArrayList<PDFFunction>();
+
+ int currentPosition;
+ final int lastPosition = theColors.size() - 1;
+
+
+ // if 5 elements, the penultimate element is 3.
+ // do not go beyond that, because you always need
+ // to have a next color when creating the function.
+
+ for (currentPosition = 0; currentPosition < lastPosition;
+ currentPosition++) { // for every consecutive color pair
+ Color currentColor = theColors.get(currentPosition);
+ Color nextColor = theColors.get(currentPosition + 1);
+ /* The colorspace must be consistent. */
+ if (theColorSpace.getType()
+ != currentColor.getColorSpace().getType()) {
+ currentColor = ColorUtil.convertColorSpace(currentColor,
+ theColorSpace);
+ }
+
+ if (theColorSpace.getType()
+ != nextColor.getColorSpace().getType()) {
+ nextColor = ColorUtil.convertColorSpace(nextColor,
+ theColorSpace);
+ }
+
+ theCzero = colorToDoubleList(currentColor);
+ theCone = colorToDoubleList(nextColor);
+
+ myfunc = new PDFFunction(this, 2, null, null,
+ theCzero, theCone, interpolation);
+
+ theFunctions.add(myfunc);
+
+ } // end of for every consecutive color pair
+
+ myfunky = new PDFFunction(this, PDFFunction.TYPE_STITCHING, null,
+ null, theFunctions, theBounds, null);
+ if (radial) {
+ if (theCoords.size() == PDFDocument.QTY_RADIAL_SHADING_COMPONENTS) {
+ myShad = new PDFShading(this, PDFShading.TYPE_RADIAL,
+ theColorSpace, null, null,
+ false, theCoords, null, myfunky,
+ null);
+ } else { // if the center x, center y, and radius specifiy
+ // the gradient, then assume the same center x, center y,
+ // and radius of zero for the other necessary component
+ final List<Double> newCoords = new ArrayList<Double>();
+ newCoords.add(theCoords.get(0));
+ newCoords.add(theCoords.get(1));
+ newCoords.add(theCoords.get(2));
+ newCoords.add(theCoords.get(0));
+ newCoords.add(theCoords.get(1));
+ newCoords.add(new Double(0.0));
+ myShad = new PDFShading(this, PDFShading.TYPE_RADIAL,
+ theColorSpace,
+ null, null, false, newCoords, null, myfunky,
+ null);
+ }
+ } else {
+ myShad = new PDFShading(this, 2, theColorSpace,
+ null, null, false, theCoords, null, myfunky, null);
+ }
+ myPattern = new PDFPattern(this, 2, myShad, null,
+ null, null);
+ return myPattern;
+ }
+
+ /**
+ * Convert a color to a list of its components.
+ * @param theColor The color to be converted.
+ * @return The list of the color components.
+ */
+ static List<Double> colorToDoubleList(final Color theColor) {
+ final List<Double> theColorVector = new ArrayList<Double>();
+ if (theColor == null) {
+ return theColorVector;
+ }
+ final float[] colorComponents = theColor.getColorComponents(null);
+ for (int i = 0; i < colorComponents.length; i++) {
+ theColorVector.add(new Double(colorComponents[i]));
+ }
+ return theColorVector;
+ }
+
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPattern.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPattern.java 2009-03-19 15:13:07 UTC (rev 10715)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPattern.java 2009-03-19 16:44:01 UTC (rev 10716)
@@ -28,12 +28,8 @@
package org.foray.pdf.object;
-import org.foray.common.ColorUtil;
import org.foray.common.ps.PsUtil;
-import java.awt.Color;
-import java.awt.color.ColorSpace;
-import java.util.ArrayList;
import java.util.List;
/**
@@ -47,12 +43,8 @@
*
* All PDF Functions have a FunctionType (0,2,3, or 4), a Domain, and a Range.
*/
-public class PDFPattern extends PDFPathPaint {
+public class PDFPattern extends PDFPathPaint implements org.axsl.pdf.PdfPattern {
- /** Constant indicating the number of components in a radial shading, that
- * is, 6. */
- private static final int QTY_RADIAL_SHADING_COMPONENTS = 6;
-
/** The resources associated with this pattern. */
private PDFResources resources = null;
@@ -186,113 +178,6 @@
}
/**
- * Static method for creating a gradient pattern.
- * @param radial Indicates whether the gradient is a radial gradient.
- * @param theColorSpace The color space for the gradient.
- * @param theColors The colors for the gradient.
- * @param theBounds The bounds of the gradient.
- * @param theCoords The coordinates of the gradient.
- * @param document The parent PDF document.
- * @return The pattern for the gradient.
- */
- public static PDFPattern createGradient(final boolean radial,
- final ColorSpace theColorSpace, final List<Color> theColors,
- final List<Double> theBounds, final List<Double> theCoords,
- final PDFDocument document) {
- PDFShading myShad;
- PDFFunction myfunky;
- PDFFunction myfunc;
- List<Double> theCzero;
- List<Double> theCone;
- PDFPattern myPattern;
- final double interpolation = 1.000;
- final List<PDFFunction> theFunctions = new ArrayList<PDFFunction>();
-
- int currentPosition;
- final int lastPosition = theColors.size() - 1;
-
-
- // if 5 elements, the penultimate element is 3.
- // do not go beyond that, because you always need
- // to have a next color when creating the function.
-
- for (currentPosition = 0; currentPosition < lastPosition;
- currentPosition++) { // for every consecutive color pair
- Color currentColor = theColors.get(currentPosition);
- Color nextColor = theColors.get(currentPosition + 1);
- /* The colorspace must be consistent. */
- if (theColorSpace.getType()
- != currentColor.getColorSpace().getType()) {
- currentColor = ColorUtil.convertColorSpace(currentColor,
- theColorSpace);
- }
-
- if (theColorSpace.getType()
- != nextColor.getColorSpace().getType()) {
- nextColor = ColorUtil.convertColorSpace(nextColor,
- theColorSpace);
- }
-
- theCzero = colorToDoubleList(currentColor);
- theCone = colorToDoubleList(nextColor);
-
- myfunc = new PDFFunction(document, 2, null, null,
- theCzero, theCone, interpolation);
-
- theFunctions.add(myfunc);
-
- } // end of for every consecutive color pair
-
- myfunky = new PDFFunction(document, PDFFunction.TYPE_STITCHING, null,
- null, theFunctions, theBounds, null);
- if (radial) {
- if (theCoords.size() == PDFPattern.QTY_RADIAL_SHADING_COMPONENTS) {
- myShad = new PDFShading(document, PDFShading.TYPE_RADIAL,
- theColorSpace, null, null,
- false, theCoords, null, myfunky,
- null);
- } else { // if the center x, center y, and radius specifiy
- // the gradient, then assume the same center x, center y,
- // and radius of zero for the other necessary component
- final List<Double> newCoords = new ArrayList<Double>();
- newCoords.add(theCoords.get(0));
- newCoords.add(theCoords.get(1));
- newCoords.add(theCoords.get(2));
- newCoords.add(theCoords.get(0));
- newCoords.add(theCoords.get(1));
- newCoords.add(new Double(0.0));
- myShad = new PDFShading(document, PDFShading.TYPE_RADIAL,
- theColorSpace,
- null, null, false, newCoords, null, myfunky,
- null);
- }
- } else {
- myShad = new PDFShading(document, 2, theColorSpace,
- null, null, false, theCoords, null, myfunky, null);
- }
- myPattern = new PDFPattern(document, 2, myShad, null,
- null, null);
- return myPattern;
- }
-
- /**
- * Convert a color to a list of its components.
- * @param theColor The color to be converted.
- * @return The list of the color components.
- */
- static List<Double> colorToDoubleList(final Color theColor) {
- final List<Double> theColorVector = new ArrayList<Double>();
- if (theColor == null) {
- return theColorVector;
- }
- final float[] colorComponents = theColor.getColorComponents(null);
- for (int i = 0; i < colorComponents.length; i++) {
- theColorVector.add(new Double(colorComponents[i]));
- }
- return theColorVector;
- }
-
- /**
* represent as PDF. Whatever the FunctionType is, the correct
* representation spits out. The sets of required and optional
* attributes are different for each type, but if a required
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-03-19 17:02:05
|
Revision: 10717
http://foray.svn.sourceforge.net/foray/?rev=10717&view=rev
Author: victormote
Date: 2009-03-19 17:01:51 +0000 (Thu, 19 Mar 2009)
Log Message:
-----------
Remove unnecessary dependency on PDFDocument.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFLink.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java
Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java
===================================================================
--- trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java 2009-03-19 16:44:01 UTC (rev 10716)
+++ trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java 2009-03-19 17:01:51 UTC (rev 10717)
@@ -278,7 +278,7 @@
PDFLink link = null;
if (externalLink) {
final String pdfdest = "/XYZ " + dest;
- link = new PDFLink(this.pdfDoc, pdfPage, linkRectangle, pdfdest);
+ link = new PDFLink(pdfPage, linkRectangle, pdfdest);
} else {
link = pdfPage.makeLink(linkRectangle, dest, false);
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFLink.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFLink.java 2009-03-19 16:44:01 UTC (rev 10716)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFLink.java 2009-03-19 17:01:51 UTC (rev 10717)
@@ -51,56 +51,48 @@
/**
* Create a PDFLink object.
- * @param doc The parent PDF document.
* @param page The page on which this link exists.
* @param rect The rectangle which outlines the link. All dimension in the
* rectangle should be expressed in 1/1000ths of a user space unit.
*/
- private PDFLink(final PDFDocument doc, final PDFPage page,
- final Rectangle2D rect) {
- super(doc, rect);
+ private PDFLink(final PDFPage page, final Rectangle2D rect) {
+ super(page.getPDFDocument(), rect);
}
/**
* Constructor for a link to a named destination.
- * @param doc The parent PDF document.
* @param page The page on which this link exists.
* @param rect The rectangle which outlines the link. All dimension in the
* rectangle should be expressed in 1/1000ths of a user space unit.
* @param destinationName The name of the destination to which this link
* points.
*/
- public PDFLink(final PDFDocument doc, final PDFPage page,
- final Rectangle2D rect, final String destinationName) {
- this(doc, page, rect);
- this.destinationName = new PDFTextString(doc, destinationName);
+ public PDFLink(final PDFPage page, final Rectangle2D rect, final String destinationName) {
+ this(page, rect);
+ this.destinationName = new PDFTextString(page.getPDFDocument(), destinationName);
}
/**
* Constructor for a link to a named destination.
- * @param doc The parent PDF document.
* @param page The page on which this link exists.
* @param rect The rectangle which outlines the link. All dimension in the
* rectangle should be expressed in 1/1000ths of a user space unit.
* @param destination The destination to which this link points.
*/
- public PDFLink(final PDFDocument doc, final PDFPage page,
- final Rectangle2D rect, final PDFDestination destination) {
- this(doc, page, rect);
+ public PDFLink(final PDFPage page, final Rectangle2D rect, final PDFDestination destination) {
+ this(page, rect);
this.destination = destination;
}
/**
* Constructor for a link to an action.
- * @param doc The parent PDF document.
* @param page The page on which this link exists.
* @param rect The rectangle which outlines the link. All dimension in the
* rectangle should be expressed in 1/1000ths of a user space unit.
* @param action The action to be activated by this link.
*/
- public PDFLink(final PDFDocument doc, final PDFPage page,
- final Rectangle2D rect, final PDFAction action) {
- this(doc, page, rect);
+ public PDFLink(final PDFPage page, final Rectangle2D rect, final PDFAction action) {
+ this(page, rect);
this.action = action;
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java 2009-03-19 16:44:01 UTC (rev 10716)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java 2009-03-19 17:01:51 UTC (rev 10717)
@@ -194,9 +194,9 @@
} else { // URI
action = new PDFUri(destination);
}
- link = new PDFLink(pdfDoc, this, rect, action);
+ link = new PDFLink(this, rect, action);
} else { // linkType is internal
- link = new PDFLink(pdfDoc, this, rect, destination);
+ link = new PDFLink(this, rect, destination);
}
getAnnotList().addAnnotation(link);
return link;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-18 21:32:35
|
Revision: 10722
http://foray.svn.sourceforge.net/foray/?rev=10722&view=rev
Author: victormote
Date: 2009-04-18 21:32:25 +0000 (Sat, 18 Apr 2009)
Log Message:
-----------
Use new aXSL Gradient interface to clean up a dependency that FOrayGraphic had on FOrayPDF.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java
trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
Added Paths:
-----------
trunk/foray/foray-common/src/java/org/foray/common/Gradient4a.java
Added: trunk/foray/foray-common/src/java/org/foray/common/Gradient4a.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/Gradient4a.java (rev 0)
+++ trunk/foray/foray-common/src/java/org/foray/common/Gradient4a.java 2009-04-18 21:32:25 UTC (rev 10722)
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2009 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.common;
+
+import org.axsl.common.Gradient;
+
+import java.awt.Color;
+import java.awt.color.ColorSpace;
+import java.util.List;
+
+/**
+ * Describes a radial or linear gradient.
+ */
+public class Gradient4a implements Gradient {
+
+ /** Indicates whether the gradient is linear or radial. */
+ private boolean radial;
+
+ /** The color space for the gradient. */
+ private ColorSpace colorSpace;
+
+ /** The colors in the gradient. */
+ private List<Color> colors;
+
+ /** The bounds of the gradient. */
+ private List<Double> bounds;
+
+ /** The coordinates of the gradient. */
+ private List<Double> coordinates;
+
+ /**
+ * Constructor.
+ * @param radial Indicates whether the gradient is linear or radial.
+ * @param colorSpace The color space for the gradient.
+ * @param colors The colors in the gradient.
+ * @param bounds The bounds of the gradient.
+ * @param coordinates The coordinates of the gradient.
+ */
+ public Gradient4a(final boolean radial, final ColorSpace colorSpace, final List<Color> colors,
+ final List<Double> bounds, final List<Double> coordinates) {
+ this.radial = radial;
+ this.colorSpace = colorSpace;
+ this.colors = colors;
+ this.bounds = bounds;
+ this.coordinates = coordinates;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isRadial() {
+ return this.radial;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ColorSpace getColorSpace() {
+ return this.colorSpace;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<Color> getColors() {
+ return this.colors;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<Double> getBounds() {
+ return this.bounds;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<Double> getCoordinates() {
+ return this.coordinates;
+ }
+
+}
Property changes on: trunk/foray/foray-common/src/java/org/foray/common/Gradient4a.java
___________________________________________________________________
Added: svn:keywords
+ "Author Id Rev Date URL"
Added: svn:eol-style
+ native
Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java
===================================================================
--- trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java 2009-04-18 19:47:38 UTC (rev 10721)
+++ trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java 2009-04-18 21:32:25 UTC (rev 10722)
@@ -34,10 +34,10 @@
package org.foray.graphic.batik;
import org.foray.common.CharacterOutputStream;
+import org.foray.common.Gradient4a;
import org.foray.common.WKConstants;
import org.foray.common.ps.PsColor;
import org.foray.common.ps.PsUtil;
-import org.foray.pdf.object.PDFDocument;
import org.foray.pdf.object.PDFString;
import org.axsl.font.FontConsumer;
@@ -47,7 +47,6 @@
import org.axsl.graphic.GraphicException;
import org.axsl.graphic.output.GraphicOutputContext;
import org.axsl.pdf.PdfPage;
-import org.axsl.pdf.PdfPattern;
import org.apache.commons.logging.Log;
@@ -145,9 +144,6 @@
* 2. */
public static final byte QTY_ELEMENTS_LINEAR = 2;
- /** The PDF Document being created. */
- private PDFDocument pdfDoc;
-
/** The current stream to add PDF commands to. */
private CharacterOutputStream currentStream;
@@ -201,9 +197,6 @@
this.currentStream = new CharacterOutputStream(outputStream, true);
this.comment("%%%% Start FOrayGraphic SVG-to-PDF conversion. %%%%");
- /* TODO: What we really need here is a new GraphicsState, not a complete
- * new document. */
- this.pdfDoc = new PDFDocument(null, null);
this.logger = logger;
this.fontConsumer = fontConsumer;
this.pdfContext = pdfContext;
@@ -420,7 +413,6 @@
*/
public void dispose() {
this.comment("%%%% End FOrayGraphic SVG-to-PDF conversion. %%%%");
- this.pdfDoc = null;
this.currentStream = null;
this.graphicsStateStack = null;
}
@@ -597,10 +589,14 @@
someColors.add(c1);
someColors.add(c2);
- final ColorSpace aColorSpace = ColorSpace.getInstance(
- ColorSpace.CS_sRGB);
- final PdfPattern myPat = this.pdfDoc.createGradient(false, aColorSpace, someColors, null, theCoords);
- this.write(myPat.getSetterString(fill));
+ final ColorSpace aColorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
+ final Gradient4a gradient = new Gradient4a(false, aColorSpace, someColors, null, theCoords);
+ final String gradientName = this.pdfContext.getGradientName(gradient);
+ if (fill) {
+ this.write("/Pattern cs /" + gradientName + " scn" + WKConstants.LINEFEED);
+ } else {
+ this.write("/Pattern CS /" + gradientName + " SCN" + WKConstants.LINEFEED);
+ }
} else if (paint instanceof TexturePaint) { }
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2009-04-18 19:47:38 UTC (rev 10721)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2009-04-18 21:32:25 UTC (rev 10722)
@@ -38,12 +38,12 @@
import org.foray.common.ColorUtil;
+import org.axsl.common.Gradient;
import org.axsl.font.Font;
import org.axsl.font.FontUse;
import org.axsl.graphic.Graphic;
import org.axsl.pdf.PdfException;
import org.axsl.pdf.PdfPageLabelStyle;
-import org.axsl.pdf.PdfPattern;
import org.axsl.pdf.PdfVersion;
import org.axsl.ps.Encoding;
@@ -774,6 +774,15 @@
/**
* {@inheritDoc}
*/
+ public String getGradientName(final Gradient gradient) {
+ /* TODO: See if this gradient already exists before creating it again. */
+ final PDFPattern pattern = this.createGradient(gradient);
+ return pattern.getName();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public void addPageLabelRange(final int startingPageIndex,
final PdfPageLabelStyle labelStyle, final CharSequence labelPrefix,
final int startingPageNumber) {
@@ -785,8 +794,13 @@
/**
* {@inheritDoc}
*/
- public PdfPattern createGradient(final boolean radial, final ColorSpace theColorSpace, final List<Color> theColors,
- final List<Double> theBounds, final List<Double> theCoords) {
+ public PDFPattern createGradient(final Gradient gradient) {
+ final boolean radial = gradient.isRadial();
+ final ColorSpace theColorSpace = gradient.getColorSpace();
+ final List<Color> theColors = gradient.getColors();
+ final List<Double> theBounds = gradient.getBounds();
+ final List<Double> theCoords = gradient.getCoordinates();
+
PDFShading myShad;
PDFFunction myfunky;
PDFFunction myfunc;
Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2009-04-18 19:47:38 UTC (rev 10721)
+++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2009-04-18 21:32:25 UTC (rev 10722)
@@ -36,6 +36,7 @@
import org.foray.common.CharacterOutputStream;
import org.foray.common.Mime;
+import org.foray.common.StringUtil;
import org.foray.common.WKConstants;
import org.foray.output.OutputConfig;
import org.foray.ps.BoundingBox4a;
@@ -44,6 +45,7 @@
import org.foray.ps.filter.RunLengthEncodeFilter;
import org.foray.render.PrintRenderer;
+import org.axsl.common.Gradient;
import org.axsl.common.value.RuleStyle;
import org.axsl.font.Font;
import org.axsl.font.FontUse;
@@ -1361,4 +1363,12 @@
return psFont.getName();
}
+ /**
+ * {@inheritDoc}
+ */
+ public String getGradientName(final Gradient gradient) {
+ /* TODO: Implement this. */
+ return StringUtil.EMPTY_STRING;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-21 14:43:02
|
Revision: 10730
http://foray.svn.sourceforge.net/foray/?rev=10730&view=rev
Author: victormote
Date: 2009-04-21 14:42:52 +0000 (Tue, 21 Apr 2009)
Log Message:
-----------
Push the conversion from FontUse to FontPdf further upstream.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java
trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java 2009-04-21 14:35:31 UTC (rev 10729)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java 2009-04-21 14:42:52 UTC (rev 10730)
@@ -28,16 +28,14 @@
package org.foray.pdf.object;
-import org.foray.common.Mime;
import org.foray.common.WKConstants;
import org.foray.pdf.PDFGraphicsState;
import org.axsl.font.FontConsumer;
-import org.axsl.font.FontUse;
-import org.axsl.font.output.FontPdf;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
import org.axsl.pdf.PdfException;
+import org.axsl.pdf.PdfFont;
import org.axsl.pdf.PdfLineCapStyle;
import org.axsl.pdf.PdfTextRenderingMode;
@@ -128,18 +126,16 @@
/**
* {@inheritDoc}
*/
- public void setFont(final FontUse newFont, final float newFontSize) throws PdfException {
- final FontPdf fontPdf = (FontPdf) newFont.getFontOutput(Mime.PDF.getMimeString());
- final PDFFont pdfFont = this.getPDFDocument().getPdfFont(fontPdf);
+ public void setFont(final PdfFont newFont, final float newFontSize) throws PdfException {
openTextObject();
boolean anyChange = false;
- anyChange |= this.getGS().setFont(pdfFont);
+ anyChange |= this.getGS().setFont(newFont);
anyChange |= this.getGS().setFontSize(newFontSize);
if (! anyChange) {
// Nothing needs to change.
return;
}
- final String psStyleName = pdfFont.getName();
+ final String psStyleName = newFont.getName();
add("/" + psStyleName + " " + newFontSize + " Tf" + EOL);
}
Modified: trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2009-04-21 14:35:31 UTC (rev 10729)
+++ trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2009-04-21 14:42:52 UTC (rev 10730)
@@ -33,6 +33,7 @@
package org.foray.render.pdf;
+import org.foray.common.Mime;
import org.foray.common.WKConstants;
import org.foray.output.OutputConfig;
import org.foray.render.PrintRenderer;
@@ -43,6 +44,7 @@
import org.axsl.common.value.RuleStyle;
import org.axsl.font.Font;
import org.axsl.font.FontUse;
+import org.axsl.font.output.FontPdf;
import org.axsl.galley.Area;
import org.axsl.galley.AreaNode;
import org.axsl.galley.Bookmark;
@@ -66,6 +68,7 @@
import org.axsl.pdf.PdfDocument;
import org.axsl.pdf.PdfEncryption;
import org.axsl.pdf.PdfException;
+import org.axsl.pdf.PdfFont;
import org.axsl.pdf.PdfLineCapStyle;
import org.axsl.pdf.PdfOutlineItem;
import org.axsl.pdf.PdfOutlineParent;
@@ -465,7 +468,9 @@
if (size < 1) {
return;
}
- getContentStream().setFont(fontUse, toPoints(area.traitFontSize()));
+ final FontPdf fontPdf = (FontPdf) fontUse.getFontOutput(Mime.PDF.getMimeString());
+ final PdfFont pdfFont = this.getPDFDocument().getPdfFont(fontPdf);
+ getContentStream().setFont(pdfFont, toPoints(area.traitFontSize()));
/* Paint the text. */
final CharSequence textToWrite = text.subSequence(startIndex, startIndex + size);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-21 17:28:15
|
Revision: 10733
http://foray.svn.sourceforge.net/foray/?rev=10733&view=rev
Author: victormote
Date: 2009-04-21 17:28:06 +0000 (Tue, 21 Apr 2009)
Log Message:
-----------
Conform to aXSL changes which effectively move the responsibility for writing text into a PDF from the PDF system to the Font system.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/FontUse4a.java
trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/FontUse4a.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FontUse4a.java 2009-04-21 15:20:36 UTC (rev 10732)
+++ trunk/foray/foray-font/src/java/org/foray/font/FontUse4a.java 2009-04-21 17:28:06 UTC (rev 10733)
@@ -41,6 +41,7 @@
import org.apache.commons.logging.Log;
+import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
@@ -61,6 +62,10 @@
*/
public class FontUse4a implements org.axsl.font.FontUse {
+ /** Constant indicating the number of chars needed to depict one 16-bit
+ * Unicode character using the PDF ASCII Hex notation. */
+ private static final int UNICODE_STRING_SIZE = 4;
+
/** The parent ConsumerFont. */
private ConsumerFont4a consumerFont;
@@ -494,4 +499,162 @@
return true;
}
+ /**
+ * Converts a String to the content that should be written into a PDF to
+ * show that String.
+ * @param theString The input String, that is, the text that needs to be
+ * shown in the PDF.
+ * @param kerningActive Indicates whether kerning should be applied when
+ * writing this text.
+ * @return The String that should actually be written into the PDF to show
+ * the input text.
+ */
+ public String textToPdf(final CharSequence theString, final boolean kerningActive) {
+ final Font font = this.getFont();
+ final StringBuilder buffer = new StringBuilder();
+ buffer.append("[");
+ buffer.append(startTextDelimiter(font));
+ for (int i = 0; i < theString.length(); i++) {
+ final int codePoint = Character.codePointAt(theString, i);
+ if (Character.isSupplementaryCodePoint(codePoint)) {
+ i++;
+ }
+ if (codePoint == '\u200B') {
+ /* Zero-width space. Until we learn better, we just omit it
+ * from the output. */
+ continue;
+ }
+ final int ch = encodeCharacter(codePoint);
+ addCharToBuffer(buffer, ch, font);
+ if (i + 1 < theString.length()
+ && kerningActive) {
+ addKerning(font, theString.charAt(i), theString.charAt(i + 1),
+ buffer);
+ }
+ }
+ buffer.append(endTextDelimiter(font));
+ buffer.append("]TJ" + WKConstants.LINEFEED_STRING);
+ return buffer.toString();
+ }
+
+ /**
+ * Add a character to the buffer.
+ * @param buffer The buffer to which the character should be added.
+ * @param glyphIndex The glyph index to be added.
+ * @param font The font being used.
+ */
+ private void addCharToBuffer(final StringBuilder buffer,
+ final int glyphIndex, final Font font) {
+ if (font.getFontComplexity() == Font.Complexity.COMPOSITE) {
+ buffer.append(getUnicodeString(glyphIndex));
+ return;
+ }
+ /* Font is a simple font. */
+ if (glyphIndex > WKConstants.MAX_7_BIT_UNSIGNED_VALUES - 1) {
+ buffer.append("\\");
+ buffer.append(Integer.toOctalString(glyphIndex));
+ return;
+ }
+ int glyphIndexToUse = glyphIndex;
+ if (glyphIndexToUse < 0) {
+ glyphIndexToUse = ' ';
+ }
+ final char c = (char) glyphIndexToUse;
+ switch (c) {
+ case '(':
+ case ')':
+ case '\\': {
+ buffer.append("\\");
+ break;
+ }
+ }
+ buffer.append(c);
+ }
+
+ /**
+ * Computes how much kerning is needed, and, if any, writes it into the
+ * output.
+ * @param font The Font containing the kerning information to be used.
+ * @param char1 The Unicode code point of the first (left in a left-to-right
+ * system) character.
+ * @param char2 The Unicode code point of the second (right in left-to-right
+ * system) character.
+ * @param buf The StringBuffer to which any kerning information should be
+ * written.
+ */
+ private void addKerning(final Font font, final char char1,
+ final char char2, final StringBuilder buf) {
+ /* Note that kerning is written into a PDF file in units of 1/1000 of a text space unit,
+ * which is exactly what the font system returns. Therefore no consideration needs to be
+ * given here to the size of the font. */
+ final int kernAmount = font.kern(char1, char2);
+ if (kernAmount == 0) {
+ return;
+ }
+ buf.append(endTextDelimiter(font));
+ buf.append(- kernAmount);
+ buf.append(startTextDelimiter(font));
+ }
+
+ /**
+ * Returns the char that denotes the start of text.
+ * @param font The font being used.
+ * @return The char that denotes the start of text.
+ */
+ private char startTextDelimiter(final Font font) {
+ if (font.getFontComplexity() == Font.Complexity.COMPOSITE) {
+ return '<';
+ }
+ return '(';
+ }
+
+ /**
+ * Returns the char that denotes the end of text.
+ * @param font The font being used.
+ * @return The char that denotes the end of text.
+ */
+ private char endTextDelimiter(final Font font) {
+ if (font.getFontComplexity() == Font.Complexity.COMPOSITE) {
+ return '>';
+ }
+ return ')';
+ }
+
+ /**
+ * Convert a char to a multibyte hex representation.
+ * @param c The character to be converted.
+ * @return The string representation of the character.
+ */
+ public String getUnicodeString(final int c) {
+ StringBuilder buf = new StringBuilder(FontUse4a.UNICODE_STRING_SIZE);
+ byte[] uniBytes = null;
+ int codePoint = c;
+ /* TODO: Handle Unicode characters > 0xFFFF better. */
+ if (codePoint < Character.MIN_VALUE
+ || codePoint > Character.MAX_VALUE) {
+ codePoint = ' ';
+ }
+ final char[] a = {(char) codePoint};
+ try {
+ uniBytes = new String(a).getBytes("UnicodeBigUnmarked");
+ } catch (final UnsupportedEncodingException e) {
+ uniBytes = new String(a).getBytes();
+ }
+
+ for (int i = 0; i < uniBytes.length; i++) {
+ int b = uniBytes[i];
+ if (uniBytes[i] < 0) {
+ b += WKConstants.MAX_8_BIT_UNSIGNED_VALUES;
+ }
+
+ final String hexString = Integer.toHexString(b);
+ if (hexString.length() == 1) {
+ buf = buf.append("0" + hexString);
+ } else {
+ buf = buf.append(hexString);
+ }
+ }
+ return buf.toString();
+ }
+
}
Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java
===================================================================
--- trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java 2009-04-21 15:20:36 UTC (rev 10732)
+++ trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java 2009-04-21 17:28:06 UTC (rev 10733)
@@ -39,7 +39,6 @@
import org.foray.common.WKConstants;
import org.foray.common.ps.PsColor;
import org.foray.common.ps.PsUtil;
-import org.foray.pdf.object.PDFString;
import org.axsl.font.FontConsumer;
import org.axsl.font.FontException;
@@ -720,7 +719,7 @@
this.write(matrixString + "cm");
this.write("1 0 0 -1 0 0 Tm ");
- final String outputString = PDFString.textToPdf(s, font.getFontUse(), true);
+ final String outputString = font.getFontUse().textToPdf(s, true);
this.write(outputString);
this.write("ET");
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java 2009-04-21 15:20:36 UTC (rev 10732)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java 2009-04-21 17:28:06 UTC (rev 10733)
@@ -119,7 +119,7 @@
return;
}
openTextObject();
- final String stringOut = PDFString.textToPdf(text, this.getGS().getFont().getFont().getFontUse(), kern);
+ final String stringOut = this.getGS().getFont().getFont().getFontUse().textToPdf(text, kern);
add(stringOut);
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2009-04-21 15:20:36 UTC (rev 10732)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2009-04-21 17:28:06 UTC (rev 10733)
@@ -28,13 +28,8 @@
package org.foray.pdf.object;
-import org.foray.common.WKConstants;
-
-import org.axsl.font.Font;
import org.axsl.font.FontUse;
-import java.io.UnsupportedEncodingException;
-
/**
* A PDF String Object, as defined in PDF Reference, 2nd edition, Section 3.2.3.
* PDF string objects are used in content streams, and are specifically
@@ -44,10 +39,6 @@
*/
public class PDFString extends PDFObject {
- /** Constant indicating the number of chars needed to depict one 16-bit
- * Unicode character using the PDF ASCII Hex notation. */
- private static final int UNICODE_STRING_SIZE = 4;
-
/** The encapsulated String. */
private String theString;
@@ -77,170 +68,10 @@
* {@inheritDoc}
*/
public String toPDF() {
- return textToPdf(this.theString, this.font, this.kerningActive);
+ return this.font.textToPdf(this.theString, this.kerningActive);
}
/**
- * Converts a String to the content that should be written into a PDF to
- * show that String.
- * @param theString The input String, that is, the text that needs to be
- * shown in the PDF.
- * @param fontUse The font used to show the text.
- * @param kerningActive Indicates whether kerning should be applied when
- * writing this text.
- * @return The String that should actually be written into the PDF to show
- * the input text.
- */
- public static String textToPdf(final CharSequence theString,
- final FontUse fontUse, final boolean kerningActive) {
- final Font font = fontUse.getFont();
- final StringBuilder buffer = new StringBuilder();
- buffer.append("[");
- buffer.append(startTextDelimiter(font));
- for (int i = 0; i < theString.length(); i++) {
- final int codePoint = Character.codePointAt(theString, i);
- if (Character.isSupplementaryCodePoint(codePoint)) {
- i++;
- }
- if (codePoint == '\u200B') {
- /* Zero-width space. Until we learn better, we just omit it
- * from the output. */
- continue;
- }
- final int ch = fontUse.encodeCharacter(codePoint);
- addCharToBuffer(buffer, ch, font);
- if (i + 1 < theString.length()
- && kerningActive) {
- addKerning(font, theString.charAt(i), theString.charAt(i + 1),
- buffer);
- }
- }
- buffer.append(endTextDelimiter(font));
- buffer.append("]TJ" + EOL);
- return buffer.toString();
- }
-
- /**
- * Add a character to the buffer.
- * @param buffer The buffer to which the character should be added.
- * @param glyphIndex The glyph index to be added.
- * @param font The font being used.
- */
- private static void addCharToBuffer(final StringBuilder buffer,
- final int glyphIndex, final Font font) {
- if (font.getFontComplexity() == Font.Complexity.COMPOSITE) {
- buffer.append(PDFString.getUnicodeString(glyphIndex));
- return;
- }
- /* Font is a simple font. */
- if (glyphIndex > WKConstants.MAX_7_BIT_UNSIGNED_VALUES - 1) {
- buffer.append("\\");
- buffer.append(Integer.toOctalString(glyphIndex));
- return;
- }
- int glyphIndexToUse = glyphIndex;
- if (glyphIndexToUse < 0) {
- glyphIndexToUse = ' ';
- }
- final char c = (char) glyphIndexToUse;
- switch (c) {
- case '(':
- case ')':
- case '\\': {
- buffer.append("\\");
- break;
- }
- }
- buffer.append(c);
- }
-
- /**
- * Computes how much kerning is needed, and, if any, writes it into the
- * output.
- * @param font The Font containing the kerning information to be used.
- * @param char1 The Unicode code point of the first (left in a left-to-right
- * system) character.
- * @param char2 The Unicode code point of the second (right in left-to-right
- * system) character.
- * @param buf The StringBuffer to which any kerning information should be
- * written.
- */
- private static void addKerning(final Font font, final char char1,
- final char char2, final StringBuilder buf) {
- /* Note that kerning is written into a PDF file in units of 1/1000 of a text space unit,
- * which is exactly what the font system returns. Therefore no consideration needs to be
- * given here to the size of the font. */
- final int kernAmount = font.kern(char1, char2);
- if (kernAmount == 0) {
- return;
- }
- buf.append(endTextDelimiter(font));
- buf.append(- kernAmount);
- buf.append(startTextDelimiter(font));
- }
-
- /**
- * Returns the char that denotes the start of text.
- * @param font The font being used.
- * @return The char that denotes the start of text.
- */
- private static char startTextDelimiter(final Font font) {
- if (font.getFontComplexity() == Font.Complexity.COMPOSITE) {
- return '<';
- }
- return '(';
- }
-
- /**
- * Returns the char that denotes the end of text.
- * @param font The font being used.
- * @return The char that denotes the end of text.
- */
- private static char endTextDelimiter(final Font font) {
- if (font.getFontComplexity() == Font.Complexity.COMPOSITE) {
- return '>';
- }
- return ')';
- }
-
- /**
- * Convert a char to a multibyte hex representation.
- * @param c The character to be converted.
- * @return The string representation of the character.
- */
- public static String getUnicodeString(final int c) {
- StringBuilder buf = new StringBuilder(PDFString.UNICODE_STRING_SIZE);
- byte[] uniBytes = null;
- int codePoint = c;
- /* TODO: Handle Unicode characters > 0xFFFF better. */
- if (codePoint < Character.MIN_VALUE
- || codePoint > Character.MAX_VALUE) {
- codePoint = ' ';
- }
- final char[] a = {(char) codePoint};
- try {
- uniBytes = new String(a).getBytes("UnicodeBigUnmarked");
- } catch (final UnsupportedEncodingException e) {
- uniBytes = new String(a).getBytes();
- }
-
- for (int i = 0; i < uniBytes.length; i++) {
- int b = uniBytes[i];
- if (uniBytes[i] < 0) {
- b += WKConstants.MAX_8_BIT_UNSIGNED_VALUES;
- }
-
- final String hexString = Integer.toHexString(b);
- if (hexString.length() == 1) {
- buf = buf.append("0" + hexString);
- } else {
- buf = buf.append(hexString);
- }
- }
- return buf.toString();
- }
-
- /**
* Indicates whether this string has any content or not.
* @return True iff this string has no content.
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-21 18:08:27
|
Revision: 10734
http://foray.svn.sourceforge.net/foray/?rev=10734&view=rev
Author: victormote
Date: 2009-04-21 18:08:17 +0000 (Tue, 21 Apr 2009)
Log Message:
-----------
Fix annotation array problem that causes problems for some compilers.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayAll.java
trunk/foray/foray-common/src/javatest/org/foray/common/TestFOrayCommon.java
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayAll.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayAll.java 2009-04-21 17:28:06 UTC (rev 10733)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayAll.java 2009-04-21 18:08:17 UTC (rev 10734)
@@ -55,7 +55,7 @@
TestFOrayFOTree.class,
TestFOrayAreaTree.class,
TestFOrayRender.class,
- TestFOrayApp.class,
+ TestFOrayApp.class
})
public class TestFOrayAll extends TestSuite {
Modified: trunk/foray/foray-common/src/javatest/org/foray/common/TestFOrayCommon.java
===================================================================
--- trunk/foray/foray-common/src/javatest/org/foray/common/TestFOrayCommon.java 2009-04-21 17:28:06 UTC (rev 10733)
+++ trunk/foray/foray-common/src/javatest/org/foray/common/TestFOrayCommon.java 2009-04-21 18:08:17 UTC (rev 10734)
@@ -47,7 +47,7 @@
TestCharVector.class,
TestStringUtil.class,
TestTernaryTreeMap.class,
- TestUnicodeChar.class,
+ TestUnicodeChar.class
})
public class TestFOrayCommon extends TestCase {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-21 18:53:05
|
Revision: 10737
http://foray.svn.sourceforge.net/foray/?rev=10737&view=rev
Author: victormote
Date: 2009-04-21 18:52:56 +0000 (Tue, 21 Apr 2009)
Log Message:
-----------
Conform to aXSL changes moving the PDF processing from FontUse to FontPdf.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/FontUse4a.java
trunk/foray/foray-font/src/java/org/foray/font/output/FontPdf4a.java
trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/FontUse4a.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FontUse4a.java 2009-04-21 18:32:51 UTC (rev 10736)
+++ trunk/foray/foray-font/src/java/org/foray/font/FontUse4a.java 2009-04-21 18:52:56 UTC (rev 10737)
@@ -41,7 +41,6 @@
import org.apache.commons.logging.Log;
-import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
@@ -62,10 +61,6 @@
*/
public class FontUse4a implements org.axsl.font.FontUse {
- /** Constant indicating the number of chars needed to depict one 16-bit
- * Unicode character using the PDF ASCII Hex notation. */
- private static final int UNICODE_STRING_SIZE = 4;
-
/** The parent ConsumerFont. */
private ConsumerFont4a consumerFont;
@@ -499,162 +494,4 @@
return true;
}
- /**
- * Converts a String to the content that should be written into a PDF to
- * show that String.
- * @param theString The input String, that is, the text that needs to be
- * shown in the PDF.
- * @param kerningActive Indicates whether kerning should be applied when
- * writing this text.
- * @return The String that should actually be written into the PDF to show
- * the input text.
- */
- public String textToPdf(final CharSequence theString, final boolean kerningActive) {
- final Font font = this.getFont();
- final StringBuilder buffer = new StringBuilder();
- buffer.append("[");
- buffer.append(startTextDelimiter(font));
- for (int i = 0; i < theString.length(); i++) {
- final int codePoint = Character.codePointAt(theString, i);
- if (Character.isSupplementaryCodePoint(codePoint)) {
- i++;
- }
- if (codePoint == '\u200B') {
- /* Zero-width space. Until we learn better, we just omit it
- * from the output. */
- continue;
- }
- final int ch = encodeCharacter(codePoint);
- addCharToBuffer(buffer, ch, font);
- if (i + 1 < theString.length()
- && kerningActive) {
- addKerning(font, theString.charAt(i), theString.charAt(i + 1),
- buffer);
- }
- }
- buffer.append(endTextDelimiter(font));
- buffer.append("]TJ" + WKConstants.LINEFEED_STRING);
- return buffer.toString();
- }
-
- /**
- * Add a character to the buffer.
- * @param buffer The buffer to which the character should be added.
- * @param glyphIndex The glyph index to be added.
- * @param font The font being used.
- */
- private void addCharToBuffer(final StringBuilder buffer,
- final int glyphIndex, final Font font) {
- if (font.getFontComplexity() == Font.Complexity.COMPOSITE) {
- buffer.append(getUnicodeString(glyphIndex));
- return;
- }
- /* Font is a simple font. */
- if (glyphIndex > WKConstants.MAX_7_BIT_UNSIGNED_VALUES - 1) {
- buffer.append("\\");
- buffer.append(Integer.toOctalString(glyphIndex));
- return;
- }
- int glyphIndexToUse = glyphIndex;
- if (glyphIndexToUse < 0) {
- glyphIndexToUse = ' ';
- }
- final char c = (char) glyphIndexToUse;
- switch (c) {
- case '(':
- case ')':
- case '\\': {
- buffer.append("\\");
- break;
- }
- }
- buffer.append(c);
- }
-
- /**
- * Computes how much kerning is needed, and, if any, writes it into the
- * output.
- * @param font The Font containing the kerning information to be used.
- * @param char1 The Unicode code point of the first (left in a left-to-right
- * system) character.
- * @param char2 The Unicode code point of the second (right in left-to-right
- * system) character.
- * @param buf The StringBuffer to which any kerning information should be
- * written.
- */
- private void addKerning(final Font font, final char char1,
- final char char2, final StringBuilder buf) {
- /* Note that kerning is written into a PDF file in units of 1/1000 of a text space unit,
- * which is exactly what the font system returns. Therefore no consideration needs to be
- * given here to the size of the font. */
- final int kernAmount = font.kern(char1, char2);
- if (kernAmount == 0) {
- return;
- }
- buf.append(endTextDelimiter(font));
- buf.append(- kernAmount);
- buf.append(startTextDelimiter(font));
- }
-
- /**
- * Returns the char that denotes the start of text.
- * @param font The font being used.
- * @return The char that denotes the start of text.
- */
- private char startTextDelimiter(final Font font) {
- if (font.getFontComplexity() == Font.Complexity.COMPOSITE) {
- return '<';
- }
- return '(';
- }
-
- /**
- * Returns the char that denotes the end of text.
- * @param font The font being used.
- * @return The char that denotes the end of text.
- */
- private char endTextDelimiter(final Font font) {
- if (font.getFontComplexity() == Font.Complexity.COMPOSITE) {
- return '>';
- }
- return ')';
- }
-
- /**
- * Convert a char to a multibyte hex representation.
- * @param c The character to be converted.
- * @return The string representation of the character.
- */
- public String getUnicodeString(final int c) {
- StringBuilder buf = new StringBuilder(FontUse4a.UNICODE_STRING_SIZE);
- byte[] uniBytes = null;
- int codePoint = c;
- /* TODO: Handle Unicode characters > 0xFFFF better. */
- if (codePoint < Character.MIN_VALUE
- || codePoint > Character.MAX_VALUE) {
- codePoint = ' ';
- }
- final char[] a = {(char) codePoint};
- try {
- uniBytes = new String(a).getBytes("UnicodeBigUnmarked");
- } catch (final UnsupportedEncodingException e) {
- uniBytes = new String(a).getBytes();
- }
-
- for (int i = 0; i < uniBytes.length; i++) {
- int b = uniBytes[i];
- if (uniBytes[i] < 0) {
- b += WKConstants.MAX_8_BIT_UNSIGNED_VALUES;
- }
-
- final String hexString = Integer.toHexString(b);
- if (hexString.length() == 1) {
- buf = buf.append("0" + hexString);
- } else {
- buf = buf.append(hexString);
- }
- }
- return buf.toString();
- }
-
}
Modified: trunk/foray/foray-font/src/java/org/foray/font/output/FontPdf4a.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/output/FontPdf4a.java 2009-04-21 18:32:51 UTC (rev 10736)
+++ trunk/foray/foray-font/src/java/org/foray/font/output/FontPdf4a.java 2009-04-21 18:52:56 UTC (rev 10737)
@@ -35,8 +35,10 @@
import org.foray.font.FreeStandingFont;
import org.foray.font.format.Type1File;
+import org.axsl.font.Font;
import org.axsl.font.output.FontPdf;
+import java.io.UnsupportedEncodingException;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
@@ -84,6 +86,10 @@
* bits. */
private static final int HEX_STRING_CHAR_SIZE = 4;
+ /** Constant indicating the number of chars needed to depict one 16-bit
+ * Unicode character using the PDF ASCII Hex notation. */
+ private static final int UNICODE_STRING_SIZE = 4;
+
/** The String that should be used to end a line in the PDF document. */
private String eol = FontPdf4a.DEFAULT_EOL;
@@ -417,4 +423,162 @@
return returnString.toString();
}
+ /**
+ * Converts a String to the content that should be written into a PDF to
+ * show that String.
+ * @param theString The input String, that is, the text that needs to be
+ * shown in the PDF.
+ * @param kerningActive Indicates whether kerning should be applied when
+ * writing this text.
+ * @return The String that should actually be written into the PDF to show
+ * the input text.
+ */
+ public String textToPdf(final CharSequence theString, final boolean kerningActive) {
+ final Font font = this.getFOrayFont();
+ final StringBuilder buffer = new StringBuilder();
+ buffer.append("[");
+ buffer.append(startTextDelimiter(font));
+ for (int i = 0; i < theString.length(); i++) {
+ final int codePoint = Character.codePointAt(theString, i);
+ if (Character.isSupplementaryCodePoint(codePoint)) {
+ i++;
+ }
+ if (codePoint == '\u200B') {
+ /* Zero-width space. Until we learn better, we just omit it
+ * from the output. */
+ continue;
+ }
+ final int ch = this.getFontUse().encodeCharacter(codePoint);
+ addCharToBuffer(buffer, ch, font);
+ if (i + 1 < theString.length()
+ && kerningActive) {
+ addKerning(font, theString.charAt(i), theString.charAt(i + 1),
+ buffer);
+ }
+ }
+ buffer.append(endTextDelimiter(font));
+ buffer.append("]TJ" + WKConstants.LINEFEED_STRING);
+ return buffer.toString();
+ }
+
+ /**
+ * Add a character to the buffer.
+ * @param buffer The buffer to which the character should be added.
+ * @param glyphIndex The glyph index to be added.
+ * @param font The font being used.
+ */
+ private void addCharToBuffer(final StringBuilder buffer,
+ final int glyphIndex, final Font font) {
+ if (font.getFontComplexity() == Font.Complexity.COMPOSITE) {
+ buffer.append(getUnicodeString(glyphIndex));
+ return;
+ }
+ /* Font is a simple font. */
+ if (glyphIndex > WKConstants.MAX_7_BIT_UNSIGNED_VALUES - 1) {
+ buffer.append("\\");
+ buffer.append(Integer.toOctalString(glyphIndex));
+ return;
+ }
+ int glyphIndexToUse = glyphIndex;
+ if (glyphIndexToUse < 0) {
+ glyphIndexToUse = ' ';
+ }
+ final char c = (char) glyphIndexToUse;
+ switch (c) {
+ case '(':
+ case ')':
+ case '\\': {
+ buffer.append("\\");
+ break;
+ }
+ }
+ buffer.append(c);
+ }
+
+ /**
+ * Computes how much kerning is needed, and, if any, writes it into the
+ * output.
+ * @param font The Font containing the kerning information to be used.
+ * @param char1 The Unicode code point of the first (left in a left-to-right
+ * system) character.
+ * @param char2 The Unicode code point of the second (right in left-to-right
+ * system) character.
+ * @param buf The StringBuffer to which any kerning information should be
+ * written.
+ */
+ private void addKerning(final Font font, final char char1,
+ final char char2, final StringBuilder buf) {
+ /* Note that kerning is written into a PDF file in units of 1/1000 of a text space unit,
+ * which is exactly what the font system returns. Therefore no consideration needs to be
+ * given here to the size of the font. */
+ final int kernAmount = font.kern(char1, char2);
+ if (kernAmount == 0) {
+ return;
+ }
+ buf.append(endTextDelimiter(font));
+ buf.append(- kernAmount);
+ buf.append(startTextDelimiter(font));
+ }
+
+ /**
+ * Returns the char that denotes the start of text.
+ * @param font The font being used.
+ * @return The char that denotes the start of text.
+ */
+ private char startTextDelimiter(final Font font) {
+ if (font.getFontComplexity() == Font.Complexity.COMPOSITE) {
+ return '<';
+ }
+ return '(';
+ }
+
+ /**
+ * Returns the char that denotes the end of text.
+ * @param font The font being used.
+ * @return The char that denotes the end of text.
+ */
+ private char endTextDelimiter(final Font font) {
+ if (font.getFontComplexity() == Font.Complexity.COMPOSITE) {
+ return '>';
+ }
+ return ')';
+ }
+
+ /**
+ * Convert a char to a multibyte hex representation.
+ * @param c The character to be converted.
+ * @return The string representation of the character.
+ */
+ public String getUnicodeString(final int c) {
+ StringBuilder buf = new StringBuilder(FontPdf4a.UNICODE_STRING_SIZE);
+ byte[] uniBytes = null;
+ int codePoint = c;
+ /* TODO: Handle Unicode characters > 0xFFFF better. */
+ if (codePoint < Character.MIN_VALUE
+ || codePoint > Character.MAX_VALUE) {
+ codePoint = ' ';
+ }
+ final char[] a = {(char) codePoint};
+ try {
+ uniBytes = new String(a).getBytes("UnicodeBigUnmarked");
+ } catch (final UnsupportedEncodingException e) {
+ uniBytes = new String(a).getBytes();
+ }
+
+ for (int i = 0; i < uniBytes.length; i++) {
+ int b = uniBytes[i];
+ if (uniBytes[i] < 0) {
+ b += WKConstants.MAX_8_BIT_UNSIGNED_VALUES;
+ }
+
+ final String hexString = Integer.toHexString(b);
+ if (hexString.length() == 1) {
+ buf = buf.append("0" + hexString);
+ } else {
+ buf = buf.append(hexString);
+ }
+ }
+ return buf.toString();
+ }
+
}
Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java
===================================================================
--- trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java 2009-04-21 18:32:51 UTC (rev 10736)
+++ trunk/foray/foray-graphic/src/java/org/foray/graphic/batik/PDFGraphics2D.java 2009-04-21 18:52:56 UTC (rev 10737)
@@ -719,7 +719,7 @@
this.write(matrixString + "cm");
this.write("1 0 0 -1 0 0 Tm ");
- final String outputString = font.getFontUse().textToPdf(s, true);
+ final String outputString = font.textToPdf(s, true);
this.write(outputString);
this.write("ET");
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java 2009-04-21 18:32:51 UTC (rev 10736)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java 2009-04-21 18:52:56 UTC (rev 10737)
@@ -119,7 +119,7 @@
return;
}
openTextObject();
- final String stringOut = this.getGS().getFont().getFont().getFontUse().textToPdf(text, kern);
+ final String stringOut = this.getGS().getFont().getFont().textToPdf(text, kern);
add(stringOut);
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2009-04-21 18:32:51 UTC (rev 10736)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2009-04-21 18:52:56 UTC (rev 10737)
@@ -67,7 +67,7 @@
* {@inheritDoc}
*/
public String toPDF() {
- return this.font.getFont().getFontUse().textToPdf(this.theString, this.kerningActive);
+ return this.font.getFont().textToPdf(this.theString, this.kerningActive);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|