home *** CD-ROM | disk | FTP | other *** search
- package javax.help;
-
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.util.Enumeration;
- import java.util.Locale;
- import java.util.Vector;
- import javax.help.search.SearchItem;
-
- public class SearchTOCItem extends TOCItem {
- private URL url;
- private Vector sivec;
- private boolean inTOC;
- private double confidence;
-
- public SearchTOCItem(Map.ID var1, Map.ID var2, HelpSet var3, Locale var4) {
- super(var1, var2, var3, var4);
- this.inTOC = true;
- this.url = null;
- this.sivec = new Vector();
- this.confidence = (double)0.0F;
- }
-
- public SearchTOCItem(SearchItem var1) {
- super((Map.ID)null, (Map.ID)null, (HelpSet)null, HelpUtilities.localeFromLang(var1.getLang()));
- this.inTOC = false;
- this.setName(var1.getTitle());
-
- try {
- this.url = new URL(var1.getBase(), var1.getFilename());
- } catch (MalformedURLException var3) {
- this.url = null;
- }
-
- this.sivec = new Vector();
- SearchHit var2 = new SearchHit(var1.getConfidence(), var1.getBegin(), var1.getEnd());
- this.confidence = var1.getConfidence();
- this.sivec.addElement(var2);
- }
-
- public void addSearchHit(SearchHit var1) {
- if (this.sivec.isEmpty()) {
- this.sivec.addElement(var1);
- this.confidence = var1.getConfidence();
- } else {
- for(int var2 = this.sivec.size() - 1; var2 >= 0; --var2) {
- SearchHit var3 = (SearchHit)this.sivec.elementAt(var2);
- if (var3.getConfidence() <= var1.getConfidence()) {
- this.sivec.insertElementAt(var1, var2 + 1);
- break;
- }
-
- if (var2 == 0) {
- this.sivec.insertElementAt(var1, 0);
- this.confidence = var1.getConfidence();
- }
- }
- }
-
- }
-
- public URL getURL() {
- return this.url;
- }
-
- public double getConfidence() {
- return this.confidence;
- }
-
- public Enumeration getConfidences() {
- return new 1(this);
- }
-
- public boolean inTOC() {
- return this.inTOC;
- }
-
- public Enumeration getSearchHits() {
- return this.sivec.elements();
- }
-
- public int hitCount() {
- return this.sivec.size();
- }
-
- // $FF: synthetic method
- static Vector access$000(SearchTOCItem var0) {
- return var0.sivec;
- }
- }
-