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 2015/11/06 18:56:47 UTC
svn commit: r1712996 [2/5] - in /uima/ruta/branches/UIMA-4408/ruta-core/src:
main/java/org/apache/uima/ruta/ main/java/org/apache/uima/ruta/action/
main/java/org/apache/uima/ruta/condition/
main/java/org/apache/uima/ruta/constraint/ main/java/org/apach...
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RemoveAction.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RemoveAction.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RemoveAction.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RemoveAction.java Fri Nov 6 17:56:45 2015
@@ -32,7 +32,6 @@ import org.apache.uima.ruta.expression.s
import org.apache.uima.ruta.expression.type.TypeExpression;
import org.apache.uima.ruta.rule.MatchContext;
import org.apache.uima.ruta.rule.RuleElement;
-import org.apache.uima.ruta.rule.RuleMatch;
import org.apache.uima.ruta.visitor.InferenceCrowd;
public class RemoveAction extends AbstractRutaAction {
@@ -58,7 +57,7 @@ public class RemoveAction extends Abstra
@SuppressWarnings({ "rawtypes" })
@Override
public void execute(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- RuleElement element = context.getElement();
+ RuleElement element = context.getElement();
RutaBlock parent = element.getParent();
List list = parent.getEnvironment().getVariableValue(var, List.class);
List<Object> toRemove = new ArrayList<Object>();
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RemoveDuplicateAction.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RemoveDuplicateAction.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RemoveDuplicateAction.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RemoveDuplicateAction.java Fri Nov 6 17:56:45 2015
@@ -24,7 +24,6 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.List;
-import org.apache.uima.ruta.RutaBlock;
import org.apache.uima.ruta.RutaStream;
import org.apache.uima.ruta.expression.bool.IBooleanExpression;
import org.apache.uima.ruta.expression.number.INumberExpression;
@@ -32,7 +31,6 @@ import org.apache.uima.ruta.expression.s
import org.apache.uima.ruta.expression.type.TypeExpression;
import org.apache.uima.ruta.rule.MatchContext;
import org.apache.uima.ruta.rule.RuleElement;
-import org.apache.uima.ruta.rule.RuleMatch;
import org.apache.uima.ruta.visitor.InferenceCrowd;
public class RemoveDuplicateAction extends AbstractRutaAction {
@@ -51,7 +49,7 @@ public class RemoveDuplicateAction exten
@SuppressWarnings({ "rawtypes" })
@Override
public void execute(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- RuleElement element = context.getElement();
+ RuleElement element = context.getElement();
List list = element.getParent().getEnvironment().getVariableValue(var, List.class);
Collection<Object> values = new HashSet<Object>();
List<Object> result = new ArrayList<Object>();
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RemoveFilterTypeAction.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RemoveFilterTypeAction.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RemoveFilterTypeAction.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RemoveFilterTypeAction.java Fri Nov 6 17:56:45 2015
@@ -26,8 +26,6 @@ import org.apache.uima.cas.Type;
import org.apache.uima.ruta.RutaStream;
import org.apache.uima.ruta.expression.type.TypeExpression;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
-import org.apache.uima.ruta.rule.RuleMatch;
import org.apache.uima.ruta.visitor.InferenceCrowd;
public class RemoveFilterTypeAction extends AbstractRutaAction {
@@ -45,7 +43,7 @@ public class RemoveFilterTypeAction exte
@Override
public void execute(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- RuleElement element = context.getElement();
+ context.getElement();
List<Type> types = new ArrayList<Type>();
for (TypeExpression each : list) {
types.add(each.getType(context, stream));
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RemoveRetainTypeAction.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RemoveRetainTypeAction.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RemoveRetainTypeAction.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RemoveRetainTypeAction.java Fri Nov 6 17:56:45 2015
@@ -26,8 +26,6 @@ import org.apache.uima.cas.Type;
import org.apache.uima.ruta.RutaStream;
import org.apache.uima.ruta.expression.type.TypeExpression;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
-import org.apache.uima.ruta.rule.RuleMatch;
import org.apache.uima.ruta.visitor.InferenceCrowd;
public class RemoveRetainTypeAction extends AbstractRutaAction {
@@ -45,7 +43,7 @@ public class RemoveRetainTypeAction exte
@Override
public void execute(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- RuleElement element = context.getElement();
+ context.getElement();
List<Type> types = new ArrayList<Type>();
for (TypeExpression each : list) {
types.add(each.getType(context, stream));
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/ReplaceAction.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/ReplaceAction.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/ReplaceAction.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/ReplaceAction.java Fri Nov 6 17:56:45 2015
@@ -22,7 +22,6 @@ package org.apache.uima.ruta.action;
import java.util.List;
import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.ruta.RutaBlock;
import org.apache.uima.ruta.RutaStream;
import org.apache.uima.ruta.expression.string.IStringExpression;
import org.apache.uima.ruta.rule.MatchContext;
@@ -46,17 +45,16 @@ public class ReplaceAction extends Abstr
@Override
public void execute(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- RuleMatch match = context.getRuleMatch();
- RuleElement element = context.getElement();
+ RuleMatch match = context.getRuleMatch();
+ RuleElement element = context.getElement();
List<AnnotationFS> matchedAnnotations = match.getMatchedAnnotations(null,
element.getContainer());
for (AnnotationFS matchedAnnotation : matchedAnnotations) {
List<RutaBasic> annotationsInWindow = stream.getBasicsInWindow(matchedAnnotation);
boolean replaced = false;
for (RutaBasic basic : annotationsInWindow) {
- RutaBlock parent = element.getParent();
- basic.setReplacement(replaced ? "" : replacement.getStringValue(context,
- stream));
+ element.getParent();
+ basic.setReplacement(replaced ? "" : replacement.getStringValue(context, stream));
replaced = true;
}
}
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RetainTypeAction.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RetainTypeAction.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RetainTypeAction.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/RetainTypeAction.java Fri Nov 6 17:56:45 2015
@@ -26,8 +26,6 @@ import org.apache.uima.cas.Type;
import org.apache.uima.ruta.RutaStream;
import org.apache.uima.ruta.expression.type.TypeExpression;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
-import org.apache.uima.ruta.rule.RuleMatch;
import org.apache.uima.ruta.visitor.InferenceCrowd;
public class RetainTypeAction extends AbstractRutaAction {
@@ -45,7 +43,7 @@ public class RetainTypeAction extends Ab
@Override
public void execute(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- RuleElement element = context.getElement();
+ context.getElement();
List<Type> types = new ArrayList<Type>();
for (TypeExpression each : list) {
types.add(each.getType(context, stream));
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/SetFeatureAction.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/SetFeatureAction.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/SetFeatureAction.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/SetFeatureAction.java Fri Nov 6 17:56:45 2015
@@ -24,7 +24,6 @@ import java.util.List;
import org.apache.uima.cas.Feature;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.ruta.RutaBlock;
import org.apache.uima.ruta.RutaStream;
import org.apache.uima.ruta.UIMAConstants;
import org.apache.uima.ruta.expression.IRutaExpression;
@@ -58,9 +57,9 @@ public class SetFeatureAction extends Ab
@Override
public void execute(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- RuleMatch match = context.getRuleMatch();
- RuleElement element = context.getElement();
- RutaBlock parent = element.getParent();
+ RuleMatch match = context.getRuleMatch();
+ RuleElement element = context.getElement();
+ element.getParent();
String featureString = featureStringExpression.getStringValue(context, stream);
List<AnnotationFS> matchedAnnotations = match.getMatchedAnnotationsOfElement(element);
for (AnnotationFS annotationFS : matchedAnnotations) {
@@ -85,7 +84,7 @@ public class SetFeatureAction extends Ab
annotationFS.setDoubleValue(feature, v);
} else if (rangeName.equals(UIMAConstants.TYPE_FLOAT) && expr instanceof INumberExpression) {
INumberExpression numberExpr = (INumberExpression) expr;
- float v = (float) numberExpr.getFloatValue(context, stream);
+ float v = numberExpr.getFloatValue(context, stream);
annotationFS.setFloatValue(feature, v);
} else if (rangeName.equals(UIMAConstants.TYPE_BYTE) && expr instanceof INumberExpression) {
INumberExpression numberExpr = (INumberExpression) expr;
@@ -118,7 +117,7 @@ public class SetFeatureAction extends Ab
annotationFS.setFeatureValue(feature, null);
}
}
- } else if(expr instanceof GenericFeatureExpression) {
+ } else if (expr instanceof GenericFeatureExpression) {
TypeExpression typeExpr = ((GenericFeatureExpression) expr).getFeatureExpression()
.getTypeExpr(context, stream);
Type t = typeExpr.getType(context, stream);
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/ShiftAction.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/ShiftAction.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/ShiftAction.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/ShiftAction.java Fri Nov 6 17:56:45 2015
@@ -45,8 +45,8 @@ public class ShiftAction extends MarkAct
@Override
public void execute(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- RuleMatch match = context.getRuleMatch();
- RuleElement element = context.getElement();
+ RuleMatch match = context.getRuleMatch();
+ RuleElement element = context.getElement();
Type targetType = type.getType(context, stream);
List<Integer> indexList = getIndexList(context, list, stream);
List<AnnotationFS> destinationAnnotationSpans = match.getMatchedAnnotations(indexList,
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/SplitAction.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/SplitAction.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/SplitAction.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/SplitAction.java Fri Nov 6 17:56:45 2015
@@ -28,7 +28,6 @@ import org.apache.uima.cas.CAS;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.jcas.tcas.Annotation;
-import org.apache.uima.ruta.RutaBlock;
import org.apache.uima.ruta.RutaStream;
import org.apache.uima.ruta.expression.bool.IBooleanExpression;
import org.apache.uima.ruta.expression.bool.SimpleBooleanExpression;
@@ -61,10 +60,10 @@ public class SplitAction extends Abstrac
@Override
public void execute(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- RuleMatch match = context.getRuleMatch();
- RuleElement element = context.getElement();
+ RuleMatch match = context.getRuleMatch();
+ RuleElement element = context.getElement();
List<AnnotationFS> matchedAnnotationsOf = match.getMatchedAnnotationsOfElement(element);
- RutaBlock parent = element.getParent();
+ element.getParent();
Type typeToSplit = splitOnType.getType(context, stream);
boolean splitOnCompleteAnnotation = complete.getBooleanValue(context, stream);
boolean addToBegin = appendToBegin.getBooleanValue(context, stream);
@@ -168,11 +167,11 @@ public class SplitAction extends Abstrac
private boolean trimInvisible(Annotation annotation, RutaStream stream) {
List<RutaBasic> basics = new ArrayList<>(stream.getAllBasicsInWindow(annotation));
-
+
int min = annotation.getEnd();
int max = annotation.getBegin();
- if(min <= max) {
+ if (min <= max) {
return false;
}
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/TransferAction.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/TransferAction.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/TransferAction.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/TransferAction.java Fri Nov 6 17:56:45 2015
@@ -42,8 +42,8 @@ public class TransferAction extends Type
@Override
public void execute(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- RuleMatch match = context.getRuleMatch();
- RuleElement element = context.getElement();
+ RuleMatch match = context.getRuleMatch();
+ RuleElement element = context.getElement();
List<List<RuleElementMatch>> list = match.getMatchInfo(element);
CAS cas = stream.getCas();
Type t = type.getType(context, stream);
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/TrieAction.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/TrieAction.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/TrieAction.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/TrieAction.java Fri Nov 6 17:56:45 2015
@@ -26,7 +26,6 @@ import java.util.Map;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.ruta.RutaBlock;
import org.apache.uima.ruta.RutaStream;
import org.apache.uima.ruta.expression.IRutaExpression;
import org.apache.uima.ruta.expression.bool.IBooleanExpression;
@@ -72,10 +71,10 @@ public class TrieAction extends Abstract
@Override
public void execute(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- RuleMatch match = context.getRuleMatch();
- RuleElement element = context.getElement();
+ RuleMatch match = context.getRuleMatch();
+ RuleElement element = context.getElement();
Map<String, Object> typeMap = new HashMap<String, Object>();
- RutaBlock parent = element.getParent();
+ element.getParent();
for (IStringExpression eachKey : map.keySet()) {
String stringValue = eachKey.getStringValue(context, stream);
IRutaExpression expression = map.get(eachKey);
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/TrimAction.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/TrimAction.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/TrimAction.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/TrimAction.java Fri Nov 6 17:56:45 2015
@@ -25,7 +25,6 @@ import java.util.List;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.jcas.tcas.Annotation;
-import org.apache.uima.ruta.RutaBlock;
import org.apache.uima.ruta.RutaStream;
import org.apache.uima.ruta.expression.list.TypeListExpression;
import org.apache.uima.ruta.expression.type.TypeExpression;
@@ -49,8 +48,8 @@ public class TrimAction extends Abstract
@Override
public void execute(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- RuleMatch match = context.getRuleMatch();
- RuleElement element = context.getElement();
+ RuleMatch match = context.getRuleMatch();
+ RuleElement element = context.getElement();
List<AnnotationFS> matchedAnnotationsOf = match.getMatchedAnnotationsOfElement(element);
List<Type> typesToTrim = getTypes(context, stream);
for (AnnotationFS annotationFS : matchedAnnotationsOf) {
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/UnmarkAction.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/UnmarkAction.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/UnmarkAction.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/UnmarkAction.java Fri Nov 6 17:56:45 2015
@@ -49,8 +49,8 @@ public class UnmarkAction extends TypeSe
@Override
public void execute(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- RuleMatch match = context.getRuleMatch();
- RuleElement element = context.getElement();
+ RuleMatch match = context.getRuleMatch();
+ RuleElement element = context.getElement();
Type t = type.getType(context, stream);
boolean allAtAnchor = false;
if (allAnchor != null) {
@@ -62,7 +62,7 @@ public class UnmarkAction extends TypeSe
for (AnnotationFS annotationFS : matchedAnnotations) {
Type matchedType = annotationFS.getType();
boolean subsumes = stream.getCas().getTypeSystem().subsumes(t, matchedType);
- if(subsumes && !allAtAnchor) {
+ if (subsumes && !allAtAnchor) {
stream.removeAnnotation(annotationFS, matchedType);
} else {
RutaBasic beginAnchor = stream.getBeginAnchor(annotationFS.getBegin());
@@ -75,7 +75,7 @@ public class UnmarkAction extends TypeSe
}
}
}
-
+
}
}
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/UnmarkAllAction.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/UnmarkAllAction.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/UnmarkAllAction.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/action/UnmarkAllAction.java Fri Nov 6 17:56:45 2015
@@ -48,8 +48,8 @@ public class UnmarkAllAction extends Typ
@Override
public void execute(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- RuleMatch match = context.getRuleMatch();
- RuleElement element = context.getElement();
+ RuleMatch match = context.getRuleMatch();
+ RuleElement element = context.getElement();
List<Type> retainList = new ArrayList<Type>();
if (list != null) {
retainList = list.getList(context, stream);
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/AfterCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/AfterCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/AfterCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/AfterCondition.java Fri Nov 6 17:56:45 2015
@@ -29,7 +29,6 @@ import org.apache.uima.ruta.expression.l
import org.apache.uima.ruta.expression.type.TypeExpression;
import org.apache.uima.ruta.rule.EvaluatedCondition;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
import org.apache.uima.ruta.visitor.InferenceCrowd;
public class AfterCondition extends TypeSentiveCondition {
@@ -44,8 +43,7 @@ public class AfterCondition extends Type
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
+ AnnotationFS annotation = context.getAnnotation();
if (!isWorkingOnList()) {
Type t = type.getType(context, stream);
boolean result = check(annotation, stream, t);
@@ -70,7 +68,7 @@ public class AfterCondition extends Type
it.moveToLast();
}
while (it.isValid()) {
- AnnotationFS a = (AnnotationFS) it.get();
+ AnnotationFS a = it.get();
if (a.getBegin() <= annotation.getBegin()) {
result = true;
break;
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/AndCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/AndCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/AndCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/AndCondition.java Fri Nov 6 17:56:45 2015
@@ -34,8 +34,7 @@ public class AndCondition extends Compos
}
@Override
- public EvaluatedCondition eval(MatchContext context, RutaStream symbolStream,
- InferenceCrowd crowd) {
+ public EvaluatedCondition eval(MatchContext context, RutaStream symbolStream, InferenceCrowd crowd) {
boolean result = true;
List<EvaluatedCondition> evals = new ArrayList<EvaluatedCondition>();
for (AbstractRutaCondition each : conditions) {
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/BeforeCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/BeforeCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/BeforeCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/BeforeCondition.java Fri Nov 6 17:56:45 2015
@@ -29,7 +29,6 @@ import org.apache.uima.ruta.expression.l
import org.apache.uima.ruta.expression.type.TypeExpression;
import org.apache.uima.ruta.rule.EvaluatedCondition;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
import org.apache.uima.ruta.visitor.InferenceCrowd;
public class BeforeCondition extends TypeSentiveCondition {
@@ -44,8 +43,7 @@ public class BeforeCondition extends Typ
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
+ AnnotationFS annotation = context.getAnnotation();
if (!isWorkingOnList()) {
Type t = type.getType(context, stream);
boolean result = check(annotation, stream, t);
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ConditionFactory.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ConditionFactory.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ConditionFactory.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ConditionFactory.java Fri Nov 6 17:56:45 2015
@@ -168,7 +168,8 @@ public class ConditionFactory {
return null;
}
- public static AbstractRutaCondition createConditionParse(Token id, IStringExpression localeExpr, RutaBlock env) {
+ public static AbstractRutaCondition createConditionParse(Token id, IStringExpression localeExpr,
+ RutaBlock env) {
String var = id == null ? "" : id.getText();
return new ParseCondition(var, localeExpr);
}
@@ -248,8 +249,8 @@ public class ConditionFactory {
@SuppressWarnings("rawtypes")
public static AbstractRutaCondition createConditionContains(ListExpression list,
- IRutaExpression a, INumberExpression min, INumberExpression max, IBooleanExpression percent,
- RutaBlock env) {
+ IRutaExpression a, INumberExpression min, INumberExpression max,
+ IBooleanExpression percent, RutaBlock env) {
return new ContainsCondition(list, a, min, max, percent);
}
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ContainsCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ContainsCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ContainsCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ContainsCondition.java Fri Nov 6 17:56:45 2015
@@ -39,7 +39,6 @@ import org.apache.uima.ruta.expression.s
import org.apache.uima.ruta.expression.type.TypeExpression;
import org.apache.uima.ruta.rule.EvaluatedCondition;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
import org.apache.uima.ruta.type.RutaBasic;
import org.apache.uima.ruta.visitor.InferenceCrowd;
@@ -53,6 +52,7 @@ public class ContainsCondition extends T
private IRutaExpression arg;
+ @SuppressWarnings("rawtypes")
private ListExpression argList;
public ContainsCondition(TypeExpression type, INumberExpression min, INumberExpression max,
@@ -63,6 +63,7 @@ public class ContainsCondition extends T
this.percent = percent == null ? new SimpleBooleanExpression(false) : percent;
}
+ @SuppressWarnings("rawtypes")
public ContainsCondition(ListExpression list, IRutaExpression a, INumberExpression min,
INumberExpression max, IBooleanExpression percent) {
super((TypeExpression) null);
@@ -75,9 +76,8 @@ public class ContainsCondition extends T
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
-
+ AnnotationFS annotation = context.getAnnotation();
+
int basicCount = 0;
int anchorCount = 0;
int totalCount = 0;
@@ -164,6 +164,7 @@ public class ContainsCondition extends T
return arg;
}
+ @SuppressWarnings("rawtypes")
public ListExpression getArgList() {
return argList;
}
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ContextCountCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ContextCountCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ContextCountCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ContextCountCondition.java Fri Nov 6 17:56:45 2015
@@ -53,9 +53,9 @@ public class ContextCountCondition exten
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
-
+ AnnotationFS annotation = context.getAnnotation();
+ RuleElement element = context.getElement();
+
Type contextType = type.getType(context, stream);
stream.moveToFirst();
List<AnnotationFS> visibleContexts = new ArrayList<AnnotationFS>();
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/CountCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/CountCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/CountCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/CountCondition.java Fri Nov 6 17:56:45 2015
@@ -49,18 +49,20 @@ public class CountCondition extends Type
private final String var;
+ @SuppressWarnings("rawtypes")
private ListExpression list;
private IRutaExpression arg;
- public CountCondition(TypeExpression type, INumberExpression min, INumberExpression max, String var) {
+ public CountCondition(TypeExpression type, INumberExpression min, INumberExpression max,
+ String var) {
super(type);
this.min = min == null ? new SimpleNumberExpression(Integer.MIN_VALUE) : min;
this.max = max == null ? new SimpleNumberExpression(Integer.MAX_VALUE) : max;
this.var = var;
}
- public CountCondition(ListExpression list, IRutaExpression a, INumberExpression min,
+ public CountCondition(@SuppressWarnings("rawtypes") ListExpression list, IRutaExpression a, INumberExpression min,
INumberExpression max, String var) {
super((TypeExpression) null);
this.list = list;
@@ -72,9 +74,9 @@ public class CountCondition extends Type
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
-
+ AnnotationFS annotation = context.getAnnotation();
+ RuleElement element = context.getElement();
+
if (arg == null) {
List<AnnotationFS> annotationsInWindow = stream.getAnnotationsInWindow(annotation,
type.getType(context, stream));
@@ -141,6 +143,7 @@ public class CountCondition extends Type
return var;
}
+ @SuppressWarnings("rawtypes")
public ListExpression getArgList() {
return list;
}
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/CurrentCountCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/CurrentCountCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/CurrentCountCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/CurrentCountCondition.java Fri Nov 6 17:56:45 2015
@@ -48,12 +48,12 @@ public class CurrentCountCondition exten
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
-
+ AnnotationFS annotation = context.getAnnotation();
+ RuleElement element = context.getElement();
+
int count = 0;
- Iterator<AnnotationFS> it = stream.getCas()
- .getAnnotationIndex(type.getType(context, stream)).iterator();
+ Iterator<AnnotationFS> it = stream.getCas().getAnnotationIndex(type.getType(context, stream))
+ .iterator();
while (it.hasNext()) {
AnnotationFS next = it.next();
if (next.getBegin() < annotation.getBegin()) {
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/EndsWithCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/EndsWithCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/EndsWithCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/EndsWithCondition.java Fri Nov 6 17:56:45 2015
@@ -28,7 +28,6 @@ import org.apache.uima.ruta.expression.l
import org.apache.uima.ruta.expression.type.TypeExpression;
import org.apache.uima.ruta.rule.EvaluatedCondition;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
import org.apache.uima.ruta.type.RutaBasic;
import org.apache.uima.ruta.visitor.InferenceCrowd;
@@ -44,9 +43,8 @@ public class EndsWithCondition extends T
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
-
+ AnnotationFS annotation = context.getAnnotation();
+
if (!isWorkingOnList()) {
Type givenType = type.getType(context, stream);
boolean result = check(stream, annotation, givenType);
@@ -66,7 +64,7 @@ public class EndsWithCondition extends T
private boolean check(RutaStream stream, AnnotationFS matched, Type givenType) {
RutaBasic endAnchor = stream.getEndAnchor(matched.getEnd());
- if(endAnchor != null) {
+ if (endAnchor != null) {
return endAnchor.endsWith(givenType);
} else {
return false;
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/FeatureCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/FeatureCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/FeatureCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/FeatureCondition.java Fri Nov 6 17:56:45 2015
@@ -20,7 +20,6 @@
package org.apache.uima.ruta.condition;
import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.ruta.RutaBlock;
import org.apache.uima.ruta.RutaStream;
import org.apache.uima.ruta.expression.IRutaExpression;
import org.apache.uima.ruta.expression.MatchReference;
@@ -29,7 +28,6 @@ import org.apache.uima.ruta.expression.f
import org.apache.uima.ruta.expression.string.IStringExpression;
import org.apache.uima.ruta.rule.EvaluatedCondition;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
import org.apache.uima.ruta.visitor.InferenceCrowd;
public class FeatureCondition extends AbstractRutaCondition {
@@ -44,17 +42,15 @@ public class FeatureCondition extends Ab
this.argExpr = argExpr;
}
-
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
-
- RutaBlock parent = element.getParent();
- String typeWithFeature = annotation.getType().getName()+"."+featureStringExpression.getStringValue(context, stream);
+ AnnotationFS annotation = context.getAnnotation();
+
+ String typeWithFeature = annotation.getType().getName() + "."
+ + featureStringExpression.getStringValue(context, stream);
MatchReference mf = new MatchReference(typeWithFeature, "==", argExpr);
FeatureExpression featureExpression = mf.getFeatureExpression(context, stream);
- if(featureExpression instanceof FeatureMatchExpression) {
+ if (featureExpression instanceof FeatureMatchExpression) {
FeatureMatchExpression fme = (FeatureMatchExpression) featureExpression;
boolean checkFeatureValue = fme.checkFeatureValue(annotation, context, stream);
return new EvaluatedCondition(this, checkFeatureValue);
@@ -70,5 +66,4 @@ public class FeatureCondition extends Ab
return argExpr;
}
-
}
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/IfCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/IfCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/IfCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/IfCondition.java Fri Nov 6 17:56:45 2015
@@ -19,12 +19,10 @@
package org.apache.uima.ruta.condition;
-import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.ruta.RutaStream;
import org.apache.uima.ruta.expression.bool.IBooleanExpression;
import org.apache.uima.ruta.rule.EvaluatedCondition;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
import org.apache.uima.ruta.visitor.InferenceCrowd;
public class IfCondition extends AbstractRutaCondition {
@@ -38,8 +36,6 @@ public class IfCondition extends Abstrac
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
return new EvaluatedCondition(this, expression.getBooleanValue(context, stream));
}
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ImplicitCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ImplicitCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ImplicitCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ImplicitCondition.java Fri Nov 6 17:56:45 2015
@@ -34,7 +34,6 @@ import org.apache.uima.ruta.expression.f
import org.apache.uima.ruta.expression.type.TypeExpression;
import org.apache.uima.ruta.rule.EvaluatedCondition;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
import org.apache.uima.ruta.visitor.InferenceCrowd;
public class ImplicitCondition extends AbstractRutaCondition {
@@ -48,7 +47,7 @@ public class ImplicitCondition extends A
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
+ AnnotationFS annotation = context.getAnnotation();
if (expr instanceof IBooleanExpression) {
IBooleanExpression be = (IBooleanExpression) expr;
return new EvaluatedCondition(this, be.getBooleanValue(context, stream));
@@ -57,7 +56,8 @@ public class ImplicitCondition extends A
TypeExpression typeExpr = fme.getTypeExpr(context, stream);
Type type = typeExpr.getType(context, stream);
List<AnnotationFS> annotations = getAnnotationsToCheck(annotation, type, fme, stream);
- Collection<AnnotationFS> featureAnnotations = fme.getFeatureAnnotations(annotations, stream,context, true);
+ Collection<AnnotationFS> featureAnnotations = fme.getFeatureAnnotations(annotations, stream,
+ context, true);
return new EvaluatedCondition(this, !featureAnnotations.isEmpty());
}
return new EvaluatedCondition(this, false);
@@ -72,7 +72,8 @@ public class ImplicitCondition extends A
} else {
Collection<AnnotationFS> beginAnchors = stream.getBeginAnchor(annotation.getBegin())
.getBeginAnchors(type);
- Collection<AnnotationFS> endAnchors = stream.getEndAnchor(annotation.getEnd()).getEndAnchors(type);
+ Collection<AnnotationFS> endAnchors = stream.getEndAnchor(annotation.getEnd()).getEndAnchors(
+ type);
@SuppressWarnings("unchecked")
Collection<AnnotationFS> intersection = CollectionUtils
.intersection(beginAnchors, endAnchors);
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/InListCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/InListCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/InListCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/InListCondition.java Fri Nov 6 17:56:45 2015
@@ -29,7 +29,6 @@ import org.apache.uima.ruta.expression.s
import org.apache.uima.ruta.resource.RutaWordList;
import org.apache.uima.ruta.rule.EvaluatedCondition;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
import org.apache.uima.ruta.visitor.InferenceCrowd;
public class InListCondition extends TerminalRutaCondition {
@@ -54,13 +53,12 @@ public class InListCondition extends Ter
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
+ AnnotationFS annotation = context.getAnnotation();
String text = annotation.getCoveredText();
- if(arg != null) {
+ if (arg != null) {
text = arg.getStringValue(context, stream);
}
- if(text == null) {
+ if (text == null) {
return new EvaluatedCondition(this, false);
}
if (stringList == null) {
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/IsCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/IsCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/IsCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/IsCondition.java Fri Nov 6 17:56:45 2015
@@ -29,7 +29,6 @@ import org.apache.uima.ruta.expression.l
import org.apache.uima.ruta.expression.type.TypeExpression;
import org.apache.uima.ruta.rule.EvaluatedCondition;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
import org.apache.uima.ruta.type.RutaBasic;
import org.apache.uima.ruta.visitor.InferenceCrowd;
@@ -45,12 +44,11 @@ public class IsCondition extends TypeSen
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
+ AnnotationFS annotation = context.getAnnotation();
RutaBasic beginAnchor = stream.getBeginAnchor(annotation.getBegin());
if (!isWorkingOnList()) {
- Collection<AnnotationFS> beginAnchors = beginAnchor
- .getBeginAnchors(type.getType(context, stream));
+ Collection<AnnotationFS> beginAnchors = beginAnchor.getBeginAnchors(type.getType(context,
+ stream));
boolean result = false;
if (beginAnchors != null) {
for (AnnotationFS annotationFS : beginAnchors) {
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/LastCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/LastCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/LastCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/LastCondition.java Fri Nov 6 17:56:45 2015
@@ -25,7 +25,6 @@ import org.apache.uima.ruta.RutaStream;
import org.apache.uima.ruta.expression.type.TypeExpression;
import org.apache.uima.ruta.rule.EvaluatedCondition;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
import org.apache.uima.ruta.type.RutaBasic;
import org.apache.uima.ruta.visitor.InferenceCrowd;
@@ -37,8 +36,7 @@ public class LastCondition extends TypeS
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
+ AnnotationFS annotation = context.getAnnotation();
RutaBasic endAnchor = stream.getEndAnchor(annotation.getEnd());
Type t = type.getType(context, stream);
boolean result = endAnchor.beginsWith(t) && endAnchor.endsWith(t);
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/MOfNCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/MOfNCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/MOfNCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/MOfNCondition.java Fri Nov 6 17:56:45 2015
@@ -22,12 +22,10 @@ package org.apache.uima.ruta.condition;
import java.util.ArrayList;
import java.util.List;
-import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.ruta.RutaStream;
import org.apache.uima.ruta.expression.number.INumberExpression;
import org.apache.uima.ruta.rule.EvaluatedCondition;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
import org.apache.uima.ruta.visitor.InferenceCrowd;
public class MOfNCondition extends ComposedRutaCondition {
@@ -45,8 +43,6 @@ public class MOfNCondition extends Compo
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
int result = 0;
List<EvaluatedCondition> evals = new ArrayList<EvaluatedCondition>();
for (AbstractRutaCondition each : conditions) {
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/NearCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/NearCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/NearCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/NearCondition.java Fri Nov 6 17:56:45 2015
@@ -30,7 +30,6 @@ import org.apache.uima.ruta.expression.n
import org.apache.uima.ruta.expression.type.TypeExpression;
import org.apache.uima.ruta.rule.EvaluatedCondition;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
import org.apache.uima.ruta.type.RutaBasic;
import org.apache.uima.ruta.visitor.InferenceCrowd;
@@ -55,14 +54,13 @@ public class NearCondition extends TypeS
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
+ AnnotationFS annotation = context.getAnnotation();
int maxValue = max.getIntegerValue(context, stream);
int minValue = min.getIntegerValue(context, stream);
boolean forwardValue = forward.getBooleanValue(context, stream);
- FSIterator<AnnotationFS> it = filtered.getBooleanValue(context, stream) ? stream
- : stream.getUnfilteredBasicIterator();
+ FSIterator<AnnotationFS> it = filtered.getBooleanValue(context, stream) ? stream : stream
+ .getUnfilteredBasicIterator();
AnnotationFS pointer = null;
if (forwardValue) {
pointer = stream.getEndAnchor(annotation.getEnd());
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/OrCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/OrCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/OrCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/OrCondition.java Fri Nov 6 17:56:45 2015
@@ -33,8 +33,7 @@ public class OrCondition extends Compose
}
@Override
- public EvaluatedCondition eval(MatchContext context, RutaStream symbolStream,
- InferenceCrowd crowd) {
+ public EvaluatedCondition eval(MatchContext context, RutaStream symbolStream, InferenceCrowd crowd) {
boolean result = false;
List<EvaluatedCondition> evals = new ArrayList<EvaluatedCondition>();
for (AbstractRutaCondition each : conditions) {
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ParseCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ParseCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ParseCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ParseCondition.java Fri Nov 6 17:56:45 2015
@@ -37,12 +37,12 @@ public class ParseCondition extends Abst
private final String var;
private IStringExpression localeExpr;
-
+
public ParseCondition(String var) {
super();
this.var = var;
}
-
+
public ParseCondition(String var, IStringExpression localeExpr) {
super();
this.var = var;
@@ -51,20 +51,20 @@ public class ParseCondition extends Abst
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
+ AnnotationFS annotation = context.getAnnotation();
+ RuleElement element = context.getElement();
String text = annotation.getCoveredText();
RutaEnvironment env = element.getParent().getEnvironment();
Class<?> type = env.getVariableType(var);
NumberFormat nf = null;
String locale = annotation.getCAS().getDocumentLanguage();
- if(localeExpr != null) {
+ if (localeExpr != null) {
locale = localeExpr.getStringValue(context, stream);
}
- if(locale == null) {
+ if (locale == null) {
locale = "x-unspecified";
}
- nf = NumberFormat.getInstance(Locale.forLanguageTag(locale));
+ nf = NumberFormat.getInstance(Locale.forLanguageTag(locale));
try {
if (Integer.class.equals(type)) {
Number parse = nf.parse(text);
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/PartOfCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/PartOfCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/PartOfCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/PartOfCondition.java Fri Nov 6 17:56:45 2015
@@ -45,8 +45,8 @@ public class PartOfCondition extends Typ
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
+ AnnotationFS annotation = context.getAnnotation();
+ RuleElement element = context.getElement();
if (!isWorkingOnList()) {
Type t = type.getType(context, stream);
boolean result = check(t, annotation, element, stream);
@@ -66,20 +66,20 @@ public class PartOfCondition extends Typ
private boolean check(Type t, AnnotationFS annotation, RuleElement element, RutaStream stream) {
RutaBasic beginAnchor = stream.getBeginAnchor(annotation.getBegin());
- if(beginAnchor!= null && beginAnchor.isPartOf(t)) {
+ if (beginAnchor != null && beginAnchor.isPartOf(t)) {
return true;
}
RutaBasic endAnchor = stream.getEndAnchor(annotation.getEnd());
- if(endAnchor!= null && endAnchor.isPartOf(t)) {
+ if (endAnchor != null && endAnchor.isPartOf(t)) {
return true;
}
// TODO: do we really need to check again on the anchors?
Collection<AnnotationFS> beginAnchors = beginAnchor.getBeginAnchors(t);
- if(beginAnchors != null && !beginAnchors.isEmpty()) {
+ if (beginAnchors != null && !beginAnchors.isEmpty()) {
return true;
}
Collection<AnnotationFS> endAnchors = beginAnchor.getEndAnchors(t);
- if(endAnchors != null && !endAnchors.isEmpty()) {
+ if (endAnchors != null && !endAnchors.isEmpty()) {
return true;
}
return false;
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/PartOfNeqCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/PartOfNeqCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/PartOfNeqCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/PartOfNeqCondition.java Fri Nov 6 17:56:45 2015
@@ -29,7 +29,6 @@ import org.apache.uima.ruta.expression.l
import org.apache.uima.ruta.expression.type.TypeExpression;
import org.apache.uima.ruta.rule.EvaluatedCondition;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
import org.apache.uima.ruta.type.RutaBasic;
import org.apache.uima.ruta.visitor.InferenceCrowd;
@@ -45,8 +44,7 @@ public class PartOfNeqCondition extends
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
+ AnnotationFS annotation = context.getAnnotation();
if (!isWorkingOnList()) {
Type t = type.getType(context, stream);
boolean result = check(annotation, stream, t);
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/PositionCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/PositionCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/PositionCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/PositionCondition.java Fri Nov 6 17:56:45 2015
@@ -51,8 +51,8 @@ public class PositionCondition extends T
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
+ AnnotationFS annotation = context.getAnnotation();
+ RuleElement element = context.getElement();
Type t = type.getType(context, stream);
RutaBasic beginAnchor = stream.getBeginAnchor(annotation.getBegin());
@@ -62,8 +62,7 @@ public class PositionCondition extends T
return new EvaluatedCondition(this, false);
}
- boolean relatively = relative == null ? true : relative.getBooleanValue(context,
- stream);
+ boolean relatively = relative == null ? true : relative.getBooleanValue(context, stream);
FSIterator<AnnotationFS> iterator = stream.getCas().getAnnotationIndex(t).iterator(beginAnchor);
if (!iterator.isValid()) {
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/RegExpCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/RegExpCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/RegExpCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/RegExpCondition.java Fri Nov 6 17:56:45 2015
@@ -29,7 +29,6 @@ import org.apache.uima.ruta.expression.b
import org.apache.uima.ruta.expression.string.IStringExpression;
import org.apache.uima.ruta.rule.EvaluatedCondition;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
import org.apache.uima.ruta.visitor.InferenceCrowd;
public class RegExpCondition extends TerminalRutaCondition {
@@ -45,36 +44,37 @@ public class RegExpCondition extends Ter
this.ignoreCase = ignoreCase == null ? new SimpleBooleanExpression(false) : ignoreCase;
}
- public RegExpCondition(IStringExpression v, IStringExpression pattern, IBooleanExpression ignoreCase) {
+ public RegExpCondition(IStringExpression v, IStringExpression pattern,
+ IBooleanExpression ignoreCase) {
this(pattern, ignoreCase);
this.variable = v;
}
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
+ AnnotationFS annotation = context.getAnnotation();
Matcher matcher = null;
- boolean ignore = ignoreCase == null ? false : ignoreCase.getBooleanValue(context,
- stream);
+ boolean ignore = ignoreCase == null ? false : ignoreCase.getBooleanValue(context, stream);
String stringValue = pattern.getStringValue(context, stream);
if (variable == null) {
String coveredText = annotation.getCoveredText();
Pattern regularExpPattern = null;
if (ignore) {
- regularExpPattern = Pattern.compile(stringValue, Pattern.MULTILINE + Pattern.DOTALL + Pattern.CASE_INSENSITIVE + Pattern.UNICODE_CASE);
+ regularExpPattern = Pattern.compile(stringValue, Pattern.MULTILINE + Pattern.DOTALL
+ + Pattern.CASE_INSENSITIVE + Pattern.UNICODE_CASE);
} else {
regularExpPattern = Pattern.compile(stringValue, Pattern.MULTILINE + Pattern.DOTALL);
}
matcher = regularExpPattern.matcher(coveredText);
} else {
String variableValue = variable.getStringValue(context, stream);
- if(variableValue == null) {
+ if (variableValue == null) {
return new EvaluatedCondition(this, false);
}
Pattern regularExpPattern = null;
if (ignore) {
- regularExpPattern = Pattern.compile(stringValue, Pattern.MULTILINE + Pattern.DOTALL + Pattern.CASE_INSENSITIVE + Pattern.UNICODE_CASE);
+ regularExpPattern = Pattern.compile(stringValue, Pattern.MULTILINE + Pattern.DOTALL
+ + Pattern.CASE_INSENSITIVE + Pattern.UNICODE_CASE);
} else {
regularExpPattern = Pattern.compile(stringValue, Pattern.MULTILINE + Pattern.DOTALL);
}
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ScoreCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ScoreCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ScoreCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/ScoreCondition.java Fri Nov 6 17:56:45 2015
@@ -49,8 +49,8 @@ public class ScoreCondition extends Term
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
+ AnnotationFS annotation = context.getAnnotation();
+ RuleElement element = context.getElement();
Type heuristicType = stream.getJCas().getCasType(RutaAnnotation.type);
List<AnnotationFS> annotationsInWindow = stream.getAnnotationsInWindow(annotation,
heuristicType);
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/SizeCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/SizeCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/SizeCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/SizeCondition.java Fri Nov 6 17:56:45 2015
@@ -19,7 +19,6 @@
package org.apache.uima.ruta.condition;
-import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.ruta.RutaStream;
import org.apache.uima.ruta.expression.list.ListExpression;
import org.apache.uima.ruta.expression.number.INumberExpression;
@@ -50,8 +49,7 @@ public class SizeCondition extends Abstr
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
+ RuleElement element = context.getElement();
int count = listExpr.getList(context, stream).size();
boolean value = count >= minExpr.getIntegerValue(context, stream)
&& count <= maxExpr.getIntegerValue(context, stream);
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/StartsWithCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/StartsWithCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/StartsWithCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/StartsWithCondition.java Fri Nov 6 17:56:45 2015
@@ -28,7 +28,6 @@ import org.apache.uima.ruta.expression.l
import org.apache.uima.ruta.expression.type.TypeExpression;
import org.apache.uima.ruta.rule.EvaluatedCondition;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
import org.apache.uima.ruta.type.RutaBasic;
import org.apache.uima.ruta.visitor.InferenceCrowd;
@@ -44,8 +43,7 @@ public class StartsWithCondition extends
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
+ AnnotationFS annotation = context.getAnnotation();
// TODO rewrite
if (!isWorkingOnList()) {
@@ -71,7 +69,7 @@ public class StartsWithCondition extends
return false;
}
RutaBasic beginAnchor = stream.getBeginAnchor(annotation.getBegin());
- if(beginAnchor != null) {
+ if (beginAnchor != null) {
return beginAnchor.beginsWith(t);
} else {
return false;
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/TotalCountCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/TotalCountCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/TotalCountCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/TotalCountCondition.java Fri Nov 6 17:56:45 2015
@@ -20,7 +20,6 @@
package org.apache.uima.ruta.condition;
import org.apache.uima.cas.Type;
-import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.cas.text.AnnotationIndex;
import org.apache.uima.jcas.tcas.Annotation;
import org.apache.uima.ruta.RutaStream;
@@ -49,12 +48,11 @@ public class TotalCountCondition extends
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
+ RuleElement element = context.getElement();
int count = 0;
Type t = type.getType(context, stream);
- AnnotationIndex<Annotation> annotationIndex = stream.getJCas().getAnnotationIndex(t);
- count= annotationIndex.size();
+ AnnotationIndex<Annotation> annotationIndex = stream.getJCas().getAnnotationIndex(t);
+ count = annotationIndex.size();
if (var != null) {
element.getParent().getEnvironment().setVariableValue(var, count);
}
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/VoteCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/VoteCondition.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/VoteCondition.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/condition/VoteCondition.java Fri Nov 6 17:56:45 2015
@@ -27,7 +27,6 @@ import org.apache.uima.ruta.RutaStream;
import org.apache.uima.ruta.expression.type.TypeExpression;
import org.apache.uima.ruta.rule.EvaluatedCondition;
import org.apache.uima.ruta.rule.MatchContext;
-import org.apache.uima.ruta.rule.RuleElement;
import org.apache.uima.ruta.type.RutaBasic;
import org.apache.uima.ruta.visitor.InferenceCrowd;
@@ -45,8 +44,7 @@ public class VoteCondition extends Termi
@Override
public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) {
- AnnotationFS annotation = context.getAnnotation();
- RuleElement element = context.getElement();
+ AnnotationFS annotation = context.getAnnotation();
int count1 = 0;
int count2 = 0;
if (annotation != null) {
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/constraint/BasicTypeConstraint.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/constraint/BasicTypeConstraint.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/constraint/BasicTypeConstraint.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/constraint/BasicTypeConstraint.java Fri Nov 6 17:56:45 2015
@@ -31,7 +31,6 @@ import org.apache.uima.ruta.type.RutaBas
public class BasicTypeConstraint implements FSTypeConstraint {
private static final long serialVersionUID = 1115953538613617791L;
-
private final Collection<Type> types;
public BasicTypeConstraint(Collection<Type> types) {
@@ -56,13 +55,12 @@ public class BasicTypeConstraint impleme
public void add(String typeString) {
throw new NotImplementedException();
}
-
public boolean match(FeatureStructure fs) {
boolean result = false;
if (fs instanceof RutaBasic) {
RutaBasic tmb = (RutaBasic) fs;
- if(tmb.isEmpty()) {
+ if (tmb.isEmpty()) {
return true;
}
if (types != null) {
@@ -73,15 +71,13 @@ public class BasicTypeConstraint impleme
}
}
}
- }
+ }
return result;
}
@Override
public String toString() {
- return "(BASIC " + " with " + types + ")";
+ return "(BASIC " + " with " + types + ")";
}
-
-
}
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/descriptor/RutaDescriptorBuilder.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/descriptor/RutaDescriptorBuilder.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/descriptor/RutaDescriptorBuilder.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/descriptor/RutaDescriptorBuilder.java Fri Nov 6 17:56:45 2015
@@ -320,11 +320,11 @@ public class RutaDescriptorBuilder {
URISyntaxException {
build(desc, typeSystemOutput, engineOutput, options, scriptPaths, enginePaths, null);
}
-
+
public void build(RutaDescriptorInformation desc, String typeSystemOutput, String engineOutput,
- RutaBuildOptions options, String[] scriptPaths, String[] enginePaths, String[] resourcePaths)
- throws SAXException, InvalidXMLException, IOException, ResourceInitializationException,
- URISyntaxException {
+ RutaBuildOptions options, String[] scriptPaths, String[] enginePaths,
+ String[] resourcePaths) throws SAXException, InvalidXMLException, IOException,
+ ResourceInitializationException, URISyntaxException {
TypeSystemDescription typeSystemDescription = createTypeSystemDescription(desc,
typeSystemOutput, options, enginePaths);
@@ -424,7 +424,7 @@ public class RutaDescriptorBuilder {
AnalysisEngineDescription analysisEngineDescription = UIMAFramework.getXMLParser()
.parseAnalysisEngineDescription(new XMLInputSource(defaultAnalysisEngine));
- if(import_impl != null) {
+ if (import_impl != null) {
aets.setImports(new Import[] { import_impl });
}
analysisEngineDescription.getAnalysisEngineMetaData().setTypeSystem(aets);
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/descriptor/RutaDescriptorFactory.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/descriptor/RutaDescriptorFactory.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/descriptor/RutaDescriptorFactory.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/descriptor/RutaDescriptorFactory.java Fri Nov 6 17:56:45 2015
@@ -48,7 +48,7 @@ import org.apache.uima.util.InvalidXMLEx
public class RutaDescriptorFactory {
-// public static final String ANONYMOUS = "Anonymous";
+ // public static final String ANONYMOUS = "Anonymous";
private URL defaultTypeSystem;
@@ -176,7 +176,7 @@ public class RutaDescriptorFactory {
private ResourceManager getResourceManager(RutaBuildOptions options) {
ResourceManager rm = null;
- if(options.getClassLoader() != null) {
+ if (options.getClassLoader() != null) {
rm = new ResourceManager_impl(options.getClassLoader());
} else {
rm = UIMAFramework.newDefaultResourceManager();
@@ -191,7 +191,7 @@ public class RutaDescriptorFactory {
try {
Class<?> forName = null;
if (options.getClassLoader() != null) {
- forName = options.getClassLoader().loadClass(each);
+ forName = options.getClassLoader().loadClass(each);
} else {
forName = Class.forName(each);
}
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlAnnotator.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlAnnotator.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlAnnotator.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlAnnotator.java Fri Nov 6 17:56:45 2015
@@ -37,8 +37,8 @@ import org.htmlparser.util.ParserExcepti
* This Analysis Engine provides support for HTML files by adding annotations for the HTML elements.
* Using the default values, the HTML Annotator creates annotations for each HTML element spanning
* the content of the element, whereas the most common elements are represented by own types. The
- * document <code>This text is <b>bold</b>.</code>, for example, would be annotated
- * with an annotation of the type <code>org.apache.uima.ruta.type.html.B</code> for the word
+ * document <code>This text is <b>bold</b>.</code>, for example, would be annotated with an
+ * annotation of the type <code>org.apache.uima.ruta.type.html.B</code> for the word
* <code>bold</code>. The HTML annotator can be configured in order to include the start and end
* elements in the created annotations. A descriptor file for this Analysis Engine is located in the
* folder <code>descriptor/utils</code> of a UIMA Ruta project.
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlConverter.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlConverter.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlConverter.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlConverter.java Fri Nov 6 17:56:45 2015
@@ -59,8 +59,8 @@ import org.htmlparser.util.ParserExcepti
* it would be mapped to an annotation of length 0, it is not moved to the new view.
*
* The HTML Converter also supports heuristic and explicit conversion patterns which default to
- * html4 decoding, e.g., "{@literal }", "{@literal <}", etc. Concepts like tables or
- * lists are not supported.
+ * html4 decoding, e.g., "{@literal }", "{@literal <}", etc. Concepts like tables or lists
+ * are not supported.
*
* Note that in general it is suggested to run an html cleaner before any further processing to
* avoid problems with malformed html.
@@ -180,7 +180,7 @@ public class HtmlConverter extends JCasA
@ConfigurationParameter(name = PARAM_GAP_TEXT, mandatory = false, defaultValue = "")
private String gapText;
-
+
/**
* This boolean parameter sets the value of the parameter <code>gapText</code> to a single space.
*/
@@ -281,24 +281,25 @@ public class HtmlConverter extends JCasA
conversionReplacements[i] = rep;
}
}
-
+
gapText = (String) aContext.getConfigParameterValue(PARAM_GAP_TEXT);
gapText = gapText == null ? "" : gapText;
-
+
useSpaceGap = (Boolean) aContext.getConfigParameterValue(PARAM_USE_SPACE_GAP);
useSpaceGap = useSpaceGap == null ? false : useSpaceGap;
-
- if(useSpaceGap) {
+
+ if (useSpaceGap) {
gapText = " ";
}
-
+
gapInducingTags = (String[]) aContext.getConfigParameterValue(PARAM_GAP_INDUCING_TAGS);
gapInducingTags = gapInducingTags == null ? new String[0] : gapInducingTags;
-
+
expandOffsets = (Boolean) aContext.getConfigParameterValue(PARAM_EXPAND_OFFSETS);
expandOffsets = expandOffsets == null ? false : expandOffsets;
-
- newlineInducingTagRegExp = (String) aContext.getConfigParameterValue(PARAM_NEWLINE_INDUCING_TAG_REGEXP);
+
+ newlineInducingTagRegExp = (String) aContext
+ .getConfigParameterValue(PARAM_NEWLINE_INDUCING_TAG_REGEXP);
}
@Override
@@ -344,8 +345,8 @@ public class HtmlConverter extends JCasA
try {
Parser parser = new Parser(documentText);
NodeList list = parser.parse(null);
- HtmlConverterVisitor visitor = new HtmlConverterVisitor(newlineInducingTags, newlineInducingTagRegExp, gapInducingTags,
- gapText, skipWhitespaces, processAll);
+ HtmlConverterVisitor visitor = new HtmlConverterVisitor(newlineInducingTags,
+ newlineInducingTagRegExp, gapInducingTags, gapText, skipWhitespaces, processAll);
list.visitAllNodesWith(visitor);
visibleSpansSoFar = visitor.getTextSpans();
linebreaksFromHtmlTags = visitor.getLinebreaksFromHtmlTags();
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/engine/PlainTextAnnotator.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/engine/PlainTextAnnotator.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/engine/PlainTextAnnotator.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/engine/PlainTextAnnotator.java Fri Nov 6 17:56:45 2015
@@ -36,7 +36,7 @@ public class PlainTextAnnotator extends
public static final String TYPE_LINE = "org.apache.uima.ruta.type.Line";
public static final String TYPE_WSLINE = "org.apache.uima.ruta.type.WSLine";
-
+
public static final String TYPE_EMPTYLINE = "org.apache.uima.ruta.type.EmptyLine";
public static final String TYPE_PARAGRAPH = "org.apache.uima.ruta.type.Paragraph";
@@ -60,7 +60,9 @@ public class PlainTextAnnotator extends
try {
while ((eachLine = br.readLine()) != null) {
boolean wsLine = StringUtils.isBlank(eachLine);
- if(!wsLine && StringUtils.isBlank(eachLine.trim().replaceAll("\u00A0|\u202F|\uFEFF|\u2007|\u180E", ""))) {
+ if (!wsLine
+ && StringUtils.isBlank(eachLine.trim().replaceAll(
+ "\u00A0|\u202F|\uFEFF|\u2007|\u180E", ""))) {
// HOTFIX for NBSPs
wsLine = true;
}
@@ -80,8 +82,8 @@ public class PlainTextAnnotator extends
if (wsLine && emptyLine) {
// do not create annotation with length 0
// instead append the line break to the annotation
- AnnotationFS newEmptyLineFS = cas.createAnnotation(emptyLineType, offsetTillNow, offsetTillNow
- + nlLength);
+ AnnotationFS newEmptyLineFS = cas.createAnnotation(emptyLineType, offsetTillNow,
+ offsetTillNow + nlLength);
cas.addFsToIndexes(newEmptyLineFS);
} else if (wsLine && !emptyLine) {
AnnotationFS newWSLineFS = cas.createAnnotation(wsLineType, offsetTillNow, offsetTillNow
Modified: uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/engine/Ruta.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/engine/Ruta.java?rev=1712996&r1=1712995&r2=1712996&view=diff
==============================================================================
--- uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/engine/Ruta.java (original)
+++ uima/ruta/branches/UIMA-4408/ruta-core/src/main/java/org/apache/uima/ruta/engine/Ruta.java Fri Nov 6 17:56:45 2015
@@ -59,8 +59,8 @@ public class Ruta {
File scriptFile = File.createTempFile("Ruta", RutaEngine.SCRIPT_FILE_EXTENSION);
scriptFile.deleteOnExit();
FileUtils.saveString2File(script, scriptFile);
- ae.setConfigParameterValue(RutaEngine.PARAM_SCRIPT_PATHS, new String[] { scriptFile.getParentFile()
- .getAbsolutePath() });
+ ae.setConfigParameterValue(RutaEngine.PARAM_SCRIPT_PATHS, new String[] { scriptFile
+ .getParentFile().getAbsolutePath() });
String name = scriptFile.getName().substring(0, scriptFile.getName().length() - 5);
ae.setConfigParameterValue(RutaEngine.PARAM_MAIN_SCRIPT, name);
if (parameters != null) {
@@ -135,8 +135,8 @@ public class Ruta {
.parseResourceSpecifier(in);
AnalysisEngineMetaData metaData = aed.getAnalysisEngineMetaData();
ConfigurationParameterSettings settings = metaData.getConfigurationParameterSettings();
- settings.setParameterValue(RutaEngine.PARAM_SCRIPT_PATHS, new String[] { scriptFile.getParentFile()
- .getAbsolutePath() });
+ settings.setParameterValue(RutaEngine.PARAM_SCRIPT_PATHS, new String[] { scriptFile
+ .getParentFile().getAbsolutePath() });
String name = scriptFile.getName().substring(0, scriptFile.getName().length() - 5);
settings.setParameterValue(RutaEngine.PARAM_MAIN_SCRIPT, name);
if (tsds != null) {