You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by pk...@apache.org on 2013/03/07 16:14:49 UTC
svn commit: r1453912 -
/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/condition/NearCondition.java
Author: pkluegl
Date: Thu Mar 7 15:14:48 2013
New Revision: 1453912
URL: http://svn.apache.org/r1453912
Log:
UIMA-2720
- do not start to search within the matched condition
Modified:
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/condition/NearCondition.java
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/condition/NearCondition.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/condition/NearCondition.java?rev=1453912&r1=1453911&r2=1453912&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/condition/NearCondition.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/condition/NearCondition.java Thu Mar 7 15:14:48 2013
@@ -55,12 +55,22 @@ public class NearCondition extends TypeS
@Override
public EvaluatedCondition eval(AnnotationFS annotation, RuleElement element,
TextMarkerStream stream, InferenceCrowd crowd) {
+ int maxValue = max.getIntegerValue(element.getParent());
+ int minValue = min.getIntegerValue(element.getParent());
+ boolean forwardValue = forward.getBooleanValue(element.getParent());
+
FSIterator<AnnotationFS> it = filtered.getBooleanValue(element.getParent()) ? stream : stream
.getUnfilteredBasicIterator();
- it.moveTo(annotation);
+ AnnotationFS pointer = null;
+ if(forwardValue) {
+ pointer = stream.getEndAnchor(annotation.getEnd());
+ } else {
+ pointer = stream.getBeginAnchor(annotation.getBegin());
+ }
+ it.moveTo(pointer);
int count = 0;
- while (count <= max.getIntegerValue(element.getParent())) {
- if (count >= min.getIntegerValue(element.getParent()) && it.isValid()) {
+ while (count <= maxValue) {
+ if (count >= minValue && it.isValid()) {
FeatureStructure featureStructure = it.get();
if (featureStructure instanceof TextMarkerBasic) {
TextMarkerBasic each = (TextMarkerBasic) featureStructure;
@@ -69,7 +79,7 @@ public class NearCondition extends TypeS
}
}
}
- if (forward.getBooleanValue(element.getParent())) {
+ if (forwardValue) {
it.moveToNext();
} else {
it.moveToPrevious();