Changeset 5950


Ignore:
Timestamp:
2003-11-24T14:29:15+13:00 (20 years ago)
Author:
cs025
Message:

Improvement to classifier interface

Location:
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/ClassifierInterface.java

    r5798 r5950  
    1717     *  the "gsdl3" namespace...
    1818     */
    19     public void classifyDocument(DocumentID documentID, DocumentInterface document);
     19    public boolean classifyDocument(DocumentID documentID, DocumentInterface document);
    2020
    21     public void startPass(int pass);
     21    public void startClassifierPass(int pass);
    2222
    2323    public int getClassifierPasses();
    2424
    25     public void endPass(int pass);
     25    public void endClassifierPass(int pass);
    2626
    2727    /**
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/ClassifierManager.java

    r5798 r5950  
    11package org.greenstone.gsdl3.gs3build.classifier;
     2
     3import java.util.Iterator;
    24
    35import org.greenstone.gsdl3.gs3build.doctypes.DocumentID;
     
    3638    }
    3739
    38     /**
    39      *  Classify all the documents that the document list is able to provide...
    40      */
    41     public void classifyDocuments()
    42     {   for (int i = 0; i < this.used; i ++)
    43         {   for (int p = 0; p < this.list[i].getClassifierPasses(); p ++)
    44             {   this.list[i].startPass(p);
    45                 for (int d = 0; d < this.documents.size(); d ++)
    46                 {   this.list[i].classifyDocument(null, documents.getDocument(d));
    47                 }
    48                 this.list[i].endPass(p);
    49             }
    50             this.list[i].completeClassification();
    51         }
     40  /**
     41   *  Classify all the documents that the document list is able to provide...
     42   */
     43  public void classifyDocuments()
     44  { for (int i = 0; i < this.used; i ++)
     45    { for (int p = 0; p < this.list[i].getClassifierPasses(); p ++)
     46      { this.list[i].startClassifierPass(p);
     47
     48    Iterator iterator = this.documents.iterator();
     49
     50    while (iterator.hasNext()) {
     51      DocumentInterface document = (DocumentInterface) iterator.next();
     52
     53      if (document.isIndexed()) {
     54        if (!this.list[i].classifyDocument(document.getID(), document)) {
     55          System.out.println("Ending document");
     56        }
     57      }
    5258    }
     59    this.list[i].endClassifierPass(p);
     60      }
     61      this.list[i].completeClassification();
     62    }
     63  }
    5364
    54     public void ensureSize(int size)
    55     {   while (size >= this.size)
    56         {   ClassifierInterface newList [] = new ClassifierInterface[this.size*2];
    57             this.size *= 2;
    58             System.arraycopy(this.list, 0, newList, 0, this.size);
    59             this.list = newList;
    60         }
    61     }
     65  public void ensureSize(int size)
     66  { while (size >= this.size)
     67    { ClassifierInterface newList [] = new ClassifierInterface[this.size*2];
     68      this.size *= 2;
     69      System.arraycopy(this.list, 0, newList, 0, this.size);
     70      this.list = newList;
     71    }
     72  }
    6273}
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/HierarchyClassifier.java

    r5798 r5950  
    277277     *  @param <code>DocumentInterface</code> the document interface
    278278     */
    279     public void classifyDocument(DocumentID documentID, DocumentInterface document)
     279    public boolean classifyDocument(DocumentID documentID, DocumentInterface document)
    280280    { // the observer records the assignment of documents to classifications
    281281        HierarchyClassifierObserver classifyObserver = new HierarchyClassifierObserver(document);
     
    298298            this.hierarchy.getClassifications(documentID, values, classifyObserver);
    299299        }
     300        return true;
    300301    }
    301302
     
    304305    }
    305306
    306     public void startPass(int pass)
     307    public void startClassifierPass(int pass)
    307308    {
    308309    }
    309310
    310     public void endPass(int pass)
     311    public void endClassifierPass(int pass)
    311312    {
    312313    }
Note: See TracChangeset for help on using the changeset viewer.