Пример #1
0
 @Override
 public void datastoreClosed(CreoleEvent e) {
   if (!e.getDatastore().equals(this.getDataStore())) return;
   if (this.getDataStore() != null) this.getDataStore().removeDatastoreListener(this);
   // close this corpus, since it cannot stay open when the DS it comes
   // from
   // is closed
   Factory.deleteResource(this);
 }
Пример #2
0
 @Override
 public void resourceUnloaded(CreoleEvent e) {
   Resource res = e.getResource();
   if (res instanceof Document) {
     Document doc = (Document) res;
     if (DEBUG) Out.prln("resource Unloaded called ");
     // remove from the corpus too, if a transient one
     if (doc.getDataStore() != this.getDataStore()) {
       this.remove(doc);
     } else {
       // unload all occurences
       int index = indexOf(res);
       if (index < 0) return;
       documents.set(index, null);
       if (DEBUG) Out.prln("corpus: document " + index + " unloaded and set to null");
     } // if
   }
 }