--- a/.hgtags Mon Jul 21 00:05:50 2008 +0200
+++ b/.hgtags Mon Aug 04 17:10:25 2008 +0200
@@ -5,3 +5,5 @@
c9323448360c78d0dc2551d35f7401e6a688e309 v0.2.3
45c0a27c902f2b66f58a0f142d7f3bae19512a5e v0.3
f153fa3d7e267323fbdd3520490b3f8c7edee980 v0.3
+988a367ae8d2abe08dc0d72f533e17d76b7181d3 v0.3.1
+6d4785558864bb158facf2de57f0dbed9ed1fc69 v0.3.2
--- a/dicts-src/makepackage Mon Jul 21 00:05:50 2008 +0200
+++ b/dicts-src/makepackage Mon Aug 04 17:10:25 2008 +0200
@@ -1,7 +1,7 @@
#!/bin/bash
BLOCKSIZE=50000
-VER=0.3
+VER=0.3.2
function split_to_dir
{
--- a/src/jdict/AskWord.java Mon Jul 21 00:05:50 2008 +0200
+++ b/src/jdict/AskWord.java Mon Aug 04 17:10:25 2008 +0200
@@ -160,7 +160,7 @@
{
ShowText text = new ShowText(
/* Versio */
- "JDict v0.3 - Vortara programo laŭ stilo dictd " +
+ "JDict v0.3.2 - Vortara programo laŭ stilo dictd " +
"(http://www.dict.org)\n" +
"Kopirajto (C) 2007 Lluís Batlle i Rossell\n" +
"Tiun ĉi programon mi distribuas laŭ permesilo " +
@@ -174,22 +174,32 @@
{
Vector results;
String text = "";
+ DictDefs defs = new DictDefs(vortaro);
/* Already at start */
- results = index.SearchDefinition("00databaseinfo", 5);
+ results = index.BinarySearchDefinition("00databaseinfo");
if (results.size() > 0)
- text += "Database Info:\n" + (String) results.elementAt(0)
- + "\n";
+ {
+ Vorto w = (Vorto) results.elementAt(0);
+ String def = defs.getDefinition(w.getPos(), w.getLength());
+ text += "Database Info:\n" + def + "\n";
+ }
- results = index.SearchDefinition("00databaseshort", 5);
+ results = index.BinarySearchDefinition("00databaseshort");
if (results.size() > 0)
- text += "Database Short:\n" + (String) results.elementAt(0)
- + "\n";
+ {
+ Vorto w = (Vorto) results.elementAt(0);
+ String def = defs.getDefinition(w.getPos(), w.getLength());
+ text += "Database Short:\n" + def + "\n";
+ }
- results = index.SearchDefinition("00databaseurl", 5);
+ results = index.BinarySearchDefinition("00databaseurl");
if (results.size() > 0)
- text += "Database URL:\n" + (String) results.elementAt(0)
- + "\n";
+ {
+ Vorto w = (Vorto) results.elementAt(0);
+ String def = defs.getDefinition(w.getPos(), w.getLength());
+ text += "Database URL:\n" + def + "\n";
+ }
ShowText textwin = new ShowText(text, myform);
}
--- a/src/jdict/DictIndex.java Mon Jul 21 00:05:50 2008 +0200
+++ b/src/jdict/DictIndex.java Mon Aug 04 17:10:25 2008 +0200
@@ -444,7 +444,11 @@
if (test == null)
break;
- if (test.startsWith(word))
+ boolean does_start_with;
+ does_start_with = test.startsWith(word);
+ System.out.println("Prefix linear comparing to " + test +
+ ": " + does_start_with);
+ if (does_start_with)
{
int offset = getOffset();
int length = getLength();
@@ -548,6 +552,7 @@
int pivot = top_index / 2;
int step = top_index / 2;
boolean found = false;
+ boolean found_laste = false;
String test;
/*
@@ -596,10 +601,8 @@
continue;
}
int comparision = word.compareTo(test);
- /*
- System.out.println("Comparing to " + bytesToString(test) +
+ System.out.println("Binary comparing to " + test +
": " + new Integer(comparision).toString());
- */
if (comparision <= 0)
{
/* If == 0, then we don't know that it is the
@@ -618,8 +621,10 @@
/* If we found the exact word in a non-last comparision,
* it's possible that the final binary search points us
* to the word PREVIOUS to the good match. */
- if (!word.startsWith(test))
+ if (!test.startsWith(word))
{
+ System.out.println("The word " + test +
+ " doesn't start with " + word);
readUntilNewLine();
}
else