[FOray-commit] SF.net SVN: foray:[10646] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
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.
|