Revision: 18042
http://sourceforge.net/p/gate/code/18042
Author: johann_p
Date: 2014-06-01 15:43:56 +0000 (Sun, 01 Jun 2014)
Log Message:
-----------
Add some JavaDoc for the edit methods
Modified Paths:
--------------
gate/trunk/src/main/gate/Document.java
gate/trunk/src/main/gate/annotation/AnnotationSetImpl.java
Modified: gate/trunk/src/main/gate/Document.java
===================================================================
--- gate/trunk/src/main/gate/Document.java 2014-06-01 01:22:13 UTC (rev
18041)
+++ gate/trunk/src/main/gate/Document.java 2014-06-01 15:43:56 UTC (rev
18042)
@@ -164,7 +164,17 @@
*/
public String toXml(Set<Annotation> aSourceAnnotationSet);
- /** Make changes to the content.
+ /**
+ * Make changes to the document content and adapt affected annotations.
+ *
+ * This method replaces the document content ranging from the start to the
+ * end offset with the new DocumentContent provided as a replacement. If
+ * the original content should be removed, null can be used as a a
replacement.
+ * In addition, annotations in all annotation sets are removed or adapted to
+ * the changed documents see
+ * {@link gate.annotation.AnnotationSetImpl#edit(java.lang.Long,
java.lang.Long, gate.DocumentContent)
AnnotationSetImpl.edit(long,long,DocumentContent) }
+ * for information on how annotations get adapted.
+ *
*/
public void edit(Long start, Long end, DocumentContent replacement)
throws InvalidOffsetException;
Modified: gate/trunk/src/main/gate/annotation/AnnotationSetImpl.java
===================================================================
--- gate/trunk/src/main/gate/annotation/AnnotationSetImpl.java 2014-06-01
01:22:13 UTC (rev 18041)
+++ gate/trunk/src/main/gate/annotation/AnnotationSetImpl.java 2014-06-01
15:43:56 UTC (rev 18042)
@@ -998,7 +998,30 @@
} // addToStartOffsetIndex(a)
/**
- * Propagate changes to the document content. Has, unfortunately, to be
+ * Propagate document content changes to this AnnotationSet.
+ *
+ * This method is called for all annotation sets of a document from
+ * DocumentImpl.edit to adapt the annotations to the text changes made
through
+ * the edit. The behaviour of this method is influenced by the configuration
+ * setting {@link gate.GateConstants#DOCEDIT_INSERT_PREPEND
GateConstants.DOCEDIT_INSERT_PREPEND }:
+ * annotations immediately
+ * ending before or starting after the point of insertion will either become
+ * part of the inserted text or not. Currently it works like this:
+ * <ul>
+ * <li>PREPEND=true: annotation before will become part, annotation after not
+ * <li>PREPEND=false: annotation before will not become part, annotation
after
+ * will become part
+ * </UL>
+ * NOTE 1 (JP): There is another setting
+ * {@link gate.GateConstants#DOCEDIT_INSERT_APPEND
GateConstants.DOCEDIT_INSERT_APPEND }
+ * but
+ * this setting does currently not influence the behaviour of this method.
+ * The behaviour of this method may change in the future so that
+ * DOCEDIT_INSERT_APPEND is considered separately and in addition to
+ * DOCEDIT_INSERT_PREPEND so that it can be controlled independently if
+ * the annotation before and/or after an insertion point gets expanded or
not.
+ * <p>
+ * NOTE 2: This method has, unfortunately, to be
* public, to allow DocumentImpls to get at it. Oh for a "friend"
declaration.
* Doesn't throw InvalidOffsetException as DocumentImpl is the only client,
* and that checks the offsets before calling this method.
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs