]> gitweb.fperrin.net Git - DictionaryPC.git/commitdiff
Switch to FileChannel and using Util from Dictionary subproject.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 20 Aug 2017 12:37:49 +0000 (14:37 +0200)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 20 Aug 2017 12:37:49 +0000 (14:37 +0200)
compile.sh
src/com/hughes/android/dictionary/engine/CheckDictionariesMain.java
src/com/hughes/android/dictionary/engine/DictionaryBuilderTest.java
src/com/hughes/android/dictionary/engine/DictionaryTest.java

index 9fe8e8d894ff7674cc180050afa43a153d19ed27..7a67e88bddb0088f1635e166c2b9c608cf46af73 100755 (executable)
@@ -6,8 +6,8 @@ XERCES=/usr/share/java/xercesImpl.jar
 test -r "$XERCES" || XERCES=/usr/share/xerces-2/lib/xercesImpl.jar
 COMMONS=/usr/share/java/commons-lang3.jar
 test -r "$COMMONS" || COMMONS=/usr/share/commons-lang-3.3/lib/commons-lang.jar
-if [ ! -x ../Util -o ! -x ../Dictionary ] ; then
-    echo "You need to clone Util and Dictionary repositories into .."
+if [ ! -x ../Dictionary ] ; then
+    echo "You need to clone the Dictionary repository (including subprojects) into .."
     exit 1
 fi
 if [ ! -r "$ICU4J" ] ; then
@@ -26,4 +26,4 @@ if [ ! -r "$COMMONS" ] ; then
     echo "commons-lang needs to be installed"
     exit 1;
 fi
-javac -g ../Util/src/com/hughes/util/*.java ../Util/src/com/hughes/util/raf/*.java ../Dictionary/src/com/hughes/android/dictionary/DictionaryInfo.java ../Dictionary/src/com/hughes/android/dictionary/engine/*.java ../Dictionary/src/com/hughes/android/dictionary/C.java src/com/hughes/android/dictionary/*.java src/com/hughes/android/dictionary/*/*.java src/com/hughes/android/dictionary/*/*/*.java -classpath "$ICU4J:$JUNIT:$XERCES:$COMMONS"
+javac -g ../Dictionary/Util/src/com/hughes/util/*.java ../Dictionary/Util/src/com/hughes/util/raf/*.java ../Dictionary/src/com/hughes/android/dictionary/DictionaryInfo.java ../Dictionary/src/com/hughes/android/dictionary/engine/*.java ../Dictionary/src/com/hughes/android/dictionary/C.java src/com/hughes/android/dictionary/*.java src/com/hughes/android/dictionary/*/*.java src/com/hughes/android/dictionary/*/*/*.java -classpath "$ICU4J:$JUNIT:$XERCES:$COMMONS"
index 8be96fc4dd7de1d5eb89523bb9e79a8cad5d04c2..d82f190215555c0372271019de3845bf0925e5c4 100644 (file)
@@ -36,7 +36,7 @@ public class CheckDictionariesMain {
 
 
             final RandomAccessFile raf = new RandomAccessFile(dictFile, "r");
-            final Dictionary dict = new Dictionary(raf);
+            final Dictionary dict = new Dictionary(raf.getChannel());
 
             final DictionaryInfo dictionaryInfo = dict.getDictionaryInfo();
 
index 7669414a4e37235d68aed3ffc8004ff8395e97e6..72ad9eba138e81f957c4633ba661eacefeb00b5a 100644 (file)
@@ -352,7 +352,7 @@ public class DictionaryBuilderTest extends TestCase {
         assertFilesEqual(GOLDENS + dictName + ".text", dictFile.getPath() + ".text");
 
         // Check it again.
-        final Dictionary dict = new Dictionary(new RandomAccessFile(dictFile.getAbsolutePath(), "r"));
+        final Dictionary dict = new Dictionary(new RandomAccessFile(dictFile.getAbsolutePath(), "r").getChannel());
         final PrintStream out = new PrintStream(new File(dictFile.getPath() + ".text"));
         dict.print(out);
         out.close();
index 69d0f7266018efa9ae2345fba4eaac79a84e6f39..d1dcc2b36ebe05e4536aa23d2d7fe3d0c7ce910a 100644 (file)
@@ -48,7 +48,7 @@ public class DictionaryTest extends TestCase {
 
     public void testEnItWiktionary() throws IOException {
         final RandomAccessFile raf = new RandomAccessFile(OUTPUTS + "EN-IT.quickdic", "r");
-        final Dictionary dict = new Dictionary(raf);
+        final Dictionary dict = new Dictionary(raf.getChannel());
         final Index enIndex = dict.indices.get(0);
 
         final RowBase row = enIndex.rows.get(4);
@@ -99,7 +99,7 @@ public class DictionaryTest extends TestCase {
 
     public void testDeEnWiktionary() throws IOException {
         final RandomAccessFile raf = new RandomAccessFile(OUTPUTS + "DE-EN.quickdic", "r");
-        final Dictionary dict = new Dictionary(raf);
+        final Dictionary dict = new Dictionary(raf.getChannel());
 
         final Index deIndex = dict.indices.get(0);
 
@@ -115,7 +115,7 @@ public class DictionaryTest extends TestCase {
 
     public void testGermanMetadata() throws IOException {
         final RandomAccessFile raf = new RandomAccessFile(TEST_OUTPUTS + "de-en.quickdic", "r");
-        final Dictionary dict = new Dictionary(raf);
+        final Dictionary dict = new Dictionary(raf.getChannel());
         final Index deIndex = dict.indices.get(0);
 
         assertEquals("DE", deIndex.shortName);
@@ -133,7 +133,7 @@ public class DictionaryTest extends TestCase {
 
     public void testGermanIndex() throws IOException {
         final RandomAccessFile raf = new RandomAccessFile(TEST_OUTPUTS + "de-en.quickdic", "r");
-        final Dictionary dict = new Dictionary(raf);
+        final Dictionary dict = new Dictionary(raf.getChannel());
         final Index deIndex = dict.indices.get(0);
 
         for (final Index.IndexEntry indexEntry : deIndex.sortedIndexEntries) {
@@ -183,7 +183,7 @@ public class DictionaryTest extends TestCase {
 
     public void testGermanTokenRows() throws IOException {
         final RandomAccessFile raf = new RandomAccessFile(TEST_OUTPUTS + "de-en.quickdic", "r");
-        final Dictionary dict = new Dictionary(raf);
+        final Dictionary dict = new Dictionary(raf.getChannel());
         final Index deIndex = dict.indices.get(0);
 
         // Pre-cache a few of these, just to make sure that's working.
@@ -214,7 +214,7 @@ public class DictionaryTest extends TestCase {
 
     public void testChemnitz() throws IOException {
         final RandomAccessFile raf = new RandomAccessFile(TEST_OUTPUTS + "de-en.quickdic", "r");
-        final Dictionary dict = new Dictionary(raf);
+        final Dictionary dict = new Dictionary(raf.getChannel());
         final Index deIndex = dict.indices.get(0);
 
         assertSearchResult("Höschen", "Hos", deIndex.findInsertionPoint("Hos", new AtomicBoolean(false)));
@@ -225,7 +225,7 @@ public class DictionaryTest extends TestCase {
 
     public void testMultiSearch() throws IOException {
         final RandomAccessFile raf = new RandomAccessFile(TEST_OUTPUTS + "de-en.quickdic", "r");
-        final Dictionary dict = new Dictionary(raf);
+        final Dictionary dict = new Dictionary(raf.getChannel());
         final Index deIndex = dict.indices.get(0);
 
         {
@@ -239,7 +239,7 @@ public class DictionaryTest extends TestCase {
 
     public void testMultiSearchIt() throws IOException {
         final RandomAccessFile raf = new RandomAccessFile(OUTPUTS + "IT.quickdic", "r");
-        final Dictionary dict = new Dictionary(raf);
+        final Dictionary dict = new Dictionary(raf.getChannel());
         final Index index = dict.indices.get(0);
 
         {
@@ -253,7 +253,7 @@ public class DictionaryTest extends TestCase {
 
     public void testMultiSearchDeBig() throws IOException {
         final RandomAccessFile raf = new RandomAccessFile(OUTPUTS + "DE-EN.quickdic", "r");
-        final Dictionary dict = new Dictionary(raf);
+        final Dictionary dict = new Dictionary(raf.getChannel());
         final Index enIndex = dict.indices.get(1);
 
         {
@@ -314,7 +314,7 @@ public class DictionaryTest extends TestCase {
 
     public void testMultiSearchBigAF() throws IOException {
         final RandomAccessFile raf = new RandomAccessFile(OUTPUTS + "AF-EN.quickdic", "r");
-        final Dictionary dict = new Dictionary(raf);
+        final Dictionary dict = new Dictionary(raf.getChannel());
         final Index enIndex = dict.indices.get(1);
 
         {
@@ -352,7 +352,7 @@ public class DictionaryTest extends TestCase {
 
     public void testExactSearch() throws IOException {
         final RandomAccessFile raf = new RandomAccessFile(OUTPUTS + "EN-cmn.quickdic", "r");
-        final Dictionary dict = new Dictionary(raf);
+        final Dictionary dict = new Dictionary(raf.getChannel());
         final Index cmnIndex = dict.indices.get(1);
 
         final Random random = new Random(10);
@@ -371,7 +371,7 @@ public class DictionaryTest extends TestCase {
 
     public void testThai() throws IOException {
         final RandomAccessFile raf = new RandomAccessFile(OUTPUTS + "EN-TH.quickdic", "r");
-        final Dictionary dict = new Dictionary(raf);
+        final Dictionary dict = new Dictionary(raf.getChannel());
         final Index thIndex = dict.indices.get(1);
 
         final IndexEntry entry = thIndex.findInsertionPoint("ดี", new AtomicBoolean(false));
@@ -382,7 +382,7 @@ public class DictionaryTest extends TestCase {
 
     public void testNorwegian() throws IOException {
         final RandomAccessFile raf = new RandomAccessFile(OUTPUTS + "EN-NL.quickdic", "r");
-        final Dictionary dict = new Dictionary(raf);
+        final Dictionary dict = new Dictionary(raf.getChannel());
         final Index nlIndex = dict.indices.get(1);
 
         IndexEntry entry = nlIndex.findInsertionPoint("Xhosa", new AtomicBoolean(false));