Updated the dictionary structure to allow grouping of dictionaries, this is the first step to try to clean up a bit the massive repetitions in dictionaries.

This commit is contained in:
amontano 2004-08-13 04:47:35 +00:00
parent 6bb0646f1c
commit afd3a95a21
22 changed files with 1533 additions and 297 deletions

View file

@ -28,20 +28,9 @@ package org.thdl.tib.scanner;
public class Definitions
{
public String[] def;
public int[] source;
public static String[] defTags;
static
{
defTags=null;
}
public static void setTags(String tags[])
{
defTags = tags;
}
public Definitions(String[] def, int[] source)
private DictionarySource source;
public Definitions(String[] def, DictionarySource source)
{
this.def = def;
this.source = source;
@ -53,25 +42,54 @@ public class Definitions
this.def = new String[1];
this.def[0] = def;
}
public String getTag(int i)
{
if (source==null) return null;
if (defTags==null) return Integer.toString(source[i]+1);
return defTags[source[i]];
}
public String getPreview()
{
String s;
int i;
if (def==null) return "";
s = def[0];
for (i=1; i<def.length; i++)
s = s + ". " + def[i];
return s;
}
public String toString()
{
int i;
int i,j;
String s;
if (def==null) return null;
if (source==null) return def[0];
s = "(" + getTag(0) + ") " + def[0];
for (i=1; i<def.length; i++)
s += "\n" + "(" + getTag(i) + ") " + def[i];
if (FileSyllableListTree.versionNumber==2)
{
s = "(" + source.getTag(0) + ") " + def[0];
for (i=1; i<def.length; i++)
s += "\n" + "(" + source.getTag(i) + ") " + def[i];
}
else
{
ByteDictionarySource sourceb = (ByteDictionarySource) source;
j=0;
while (sourceb.isEmpty(j)) j++;
s = "(" + sourceb.getTag(j) + ") " + def[0];
for (i=1; i<def.length; i++)
{
j++;
while (sourceb.isEmpty(j)) j++;
s += "\n" + "(" + sourceb.getTag(j) + ") " + def[i];
}
}
return s;
}
public DictionarySource getDictionarySource()
{
return source;
}
}