(Document o)
| 658 | } |
| 659 | |
| 660 | @Override |
| 661 | public boolean add(Document o) { |
| 662 | if(o == null) return false; |
| 663 | Document doc = o; |
| 664 | |
| 665 | // make it accept only docs from its own datastore |
| 666 | if(doc.getDataStore() != null && !this.dataStore.equals(doc.getDataStore())) { |
| 667 | Err.prln("Error: Persistent corpus can only accept documents " |
| 668 | + "from its own datastore!"); |
| 669 | return false; |
| 670 | }// if |
| 671 | |
| 672 | // add the document with its index in the docDataList |
| 673 | // in this case, since it's going to be added to the end |
| 674 | // the index will be the size of the docDataList before |
| 675 | // the addition |
| 676 | DocumentData docData = new DocumentData(doc.getName(), doc |
| 677 | .getLRPersistenceId(), doc.getClass().getName()); |
| 678 | boolean result = docDataList.add(docData); |
| 679 | documents.add(doc); |
| 680 | documentAdded(doc); |
| 681 | fireDocumentAdded(new CorpusEvent(SerialCorpusImpl.this, doc, docDataList |
| 682 | .size() - 1, doc.getLRPersistenceId(), CorpusEvent.DOCUMENT_ADDED)); |
| 683 | |
| 684 | return result; |
| 685 | } |
| 686 | |
| 687 | @Override |
| 688 | public boolean remove(Object o) { |
no test coverage detected