MCPcopy Create free account
hub / github.com/GateNLP/gate-core / add

Method add

src/main/java/gate/corpora/SerialCorpusImpl.java:660–685  ·  view source on GitHub ↗
(Document o)

Source from the content-addressed store, hash-verified

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) {

Callers 1

addAllMethod · 0.95

Calls 9

prlnMethod · 0.95
documentAddedMethod · 0.95
fireDocumentAddedMethod · 0.95
getDataStoreMethod · 0.65
equalsMethod · 0.65
getNameMethod · 0.65
getLRPersistenceIdMethod · 0.65
addMethod · 0.65
sizeMethod · 0.65

Tested by

no test coverage detected