/[storm]/storm/org/nongnu/storm/pointers/TitleIndex.java
ViewVC logotype

Diff of /storm/org/nongnu/storm/pointers/TitleIndex.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by benja, Thu May 22 22:03:52 2003 UTC revision 1.4 by benja, Thu May 22 22:41:05 2003 UTC
# Line 35  import java.security.*; Line 35  import java.security.*;
35    
36  public class TitleIndex {  public class TitleIndex {
37      public static boolean dbg = false;      public static boolean dbg = false;
38      private static void p(String s) { System.out.println("PointerIndex:: "+s); }      private static void p(String s) { System.out.println("TitleIndex:: "+s); }
39    
40      public static final String uri =      public static final String uri =
41          "http://fenfire.org/2003/05/pointer-title-index-0.1";          "http://fenfire.org/2003/05/pointer-title-index-0.1";
# Line 44  public class TitleIndex { Line 44  public class TitleIndex {
44    
45      protected IndexedPool pool;      protected IndexedPool pool;
46      protected IndexedPool.DB db;      protected IndexedPool.DB db;
     protected PointerIndex pointerIndex;  
47    
48      /** Returns a set of *current* pointer blocks.      /** Returns a set of *current* pointer blocks.
49         *  XXX not async at all
50       */       */
51      public Set getPointers(String query) throws IOException {      public Set getPointers(String query) throws IOException {
52          Iterator i=splitWords(query).iterator();          Iterator i=splitWords(query).iterator();
# Line 60  public class TitleIndex { Line 60  public class TitleIndex {
60              IndexedPool.Mapping m = (IndexedPool.Mapping)i.next();              IndexedPool.Mapping m = (IndexedPool.Mapping)i.next();
61              try {              try {
62                  PointerId id = new PointerId(m.value);                  PointerId id = new PointerId(m.value);
63                  PointerBlock cur = pointerIndex.getPointerBlock(id);                  PointerBlock cur = pointerIndex().getPointerBlock(id);
64                  if(cur.getBlockId().equals(m.block))                  if(cur.getBlockId().equals(m.block))
65                      result.add(cur);                      result.add(cur);
66              } catch(Throwable _) {              } catch(Throwable _) {
# Line 81  public class TitleIndex { Line 81  public class TitleIndex {
81    
82          String s = "";          String s = "";
83          for(int i=0; i<title.length(); i++) {          for(int i=0; i<title.length(); i++) {
84              char c = s.charAt(i);              char c = title.charAt(i);
85              if(Character.isLetterOrDigit(c))              if(Character.isLetterOrDigit(c))
86                  s += c;                  s += c;
87              else {              else {
# Line 137  public class TitleIndex { Line 137  public class TitleIndex {
137          }          }
138      }      }
139    
140        protected final PointerIndex pointerIndex() {
141            return (PointerIndex)pool.getIndex(PointerIndex.uri);
142        }
143    
144      public TitleIndex(IndexedPool pool, IndexedPool.DB db) {      public TitleIndex(IndexedPool pool, IndexedPool.DB db) {
145          this.pool = pool;          this.pool = pool;
146          this.db = db;          this.db = db;
         this.pointerIndex =  
             (PointerIndex)pool.getIndex(PointerIndex.uri);  
147      }      }
148  }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26