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

Index document type, metadata extensions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/doctypes/RecogniserManager.java

    r5800 r5944  
    88public class RecogniserManager implements FileCrawlObserver
    99{
    10     RecogniserInterface list[];
    11     int                 used;
    12     int                 size;
     10  RecogniserInterface list[];
     11  int                 used;
     12  int                 size;
    1313
    14     public RecogniserManager()
    15     {   this.list = new RecogniserInterface[10];
    16         this.used = 0;
    17         this.size = 10;
    18     }
     14  public RecogniserManager()
     15  { this.list = new RecogniserInterface[10];
     16    this.used = 0;
     17    this.size = 10;
     18  }
    1919
    20     public void addRecogniser(RecogniserInterface recogniser)
    21     {   this.ensureCapacity(this.used + 1);
     20  public void addRecogniser(RecogniserInterface recogniser)
     21  { this.ensureCapacity(this.used + 1);
    2222
    23         this.list[this.used] = recogniser;
    24         this.used ++;
    25     }
     23    this.list[this.used] = recogniser;
     24    this.used ++;
     25  }
    2626
    27     public void processFile(URL url)
    28     {   boolean result;
     27  public void processFile(URL url)
     28  { boolean result;
    2929
    30         for (int r = 0; r < this.used; r ++)
    31         {   if (list[r].parseDocument(url)) {
    32                 break;
    33             }
    34         }
    35     }
     30    for (int r = 0; r < this.used; r ++)
     31    { if (list[r].parseDocument(url)) {
     32        break;
     33      }
     34    }
     35  }
    3636 
    37     public void processFile(File file)
    38     {   try {
    39             URL url = new URL("file://"+file.toString());
     37  public void processFile(File file)
     38  { try {
     39      URL url = new URL("file://"+file.toString());
     40     
     41      this.processFile(url);
     42    }
     43    catch (java.net.MalformedURLException ex)
     44    {
     45      System.out.println(ex);
     46    }
     47  }
    4048
    41             this.processFile(url);
    42         }
    43         catch (java.net.MalformedURLException ex)
    44         {
    45             System.out.println(ex);
    46         }
    47     }
    48 
    49     private void ensureCapacity(int size)
    50     {   while (size >= this.size)
    51         {   RecogniserInterface newList [] = new RecogniserInterface[this.size*2];
    52             this.size *= 2;
    53             System.arraycopy(this.list, 0, newList, 0, this.size);
    54             this.list = newList;
    55         }
    56     }
     49  private void ensureCapacity(int size)
     50  { while (size >= this.size)
     51    { RecogniserInterface newList [] = new RecogniserInterface[this.size*2];
     52      this.size *= 2;
     53      System.arraycopy(this.list, 0, newList, 0, this.size);
     54      this.list = newList;
     55    }
     56  }
    5757}
Note: See TracChangeset for help on using the changeset viewer.