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/04/29 15:45:05 UTC
svn commit: r1477069 -
/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/
Author: pkluegl
Date: Mon Apr 29 13:45:04 2013
New Revision: 1477069
URL: http://svn.apache.org/r1477069
Log:
UIMA-2850
- renaming
Modified:
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AbstractRule.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AbstractRuleElement.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AbstractRuleMatch.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AnnotationComparator.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/ComposedRuleElement.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/ComposedRuleElementMatch.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/EvaluatedCondition.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RegExpRule.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RegExpRuleMatch.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleApply.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElement.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementCaretaker.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementComparator.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementContainer.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementIsolator.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementMatch.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleMatch.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/WildCardRuleElement.java
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AbstractRule.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AbstractRule.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AbstractRule.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AbstractRule.java Mon Apr 29 13:45:04 2013
@@ -18,16 +18,16 @@
*/
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
-import org.apache.uima.textmarker.TextMarkerBlock;
-import org.apache.uima.textmarker.TextMarkerStatement;
+import org.apache.uima.ruta.RutaBlock;
+import org.apache.uima.ruta.RutaStatement;
-public abstract class AbstractRule extends TextMarkerStatement {
+public abstract class AbstractRule extends RutaStatement {
private final int id;
- public AbstractRule(TextMarkerBlock parent, int id) {
+ public AbstractRule(RutaBlock parent, int id) {
super(parent);
this.id = id;
}
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AbstractRuleElement.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AbstractRuleElement.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AbstractRuleElement.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AbstractRuleElement.java Mon Apr 29 13:45:04 2013
@@ -17,36 +17,36 @@
* under the License.
*/
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import org.apache.uima.textmarker.TextMarkerBlock;
-import org.apache.uima.textmarker.TextMarkerElement;
-import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.action.AbstractTextMarkerAction;
-import org.apache.uima.textmarker.condition.AbstractTextMarkerCondition;
-import org.apache.uima.textmarker.rule.quantifier.NormalQuantifier;
-import org.apache.uima.textmarker.rule.quantifier.RuleElementQuantifier;
-import org.apache.uima.textmarker.visitor.InferenceCrowd;
+import org.apache.uima.ruta.RutaBlock;
+import org.apache.uima.ruta.RutaElement;
+import org.apache.uima.ruta.RutaStream;
+import org.apache.uima.ruta.action.AbstractRutaAction;
+import org.apache.uima.ruta.condition.AbstractRutaCondition;
+import org.apache.uima.ruta.rule.quantifier.NormalQuantifier;
+import org.apache.uima.ruta.rule.quantifier.RuleElementQuantifier;
+import org.apache.uima.ruta.visitor.InferenceCrowd;
-public abstract class AbstractRuleElement extends TextMarkerElement implements RuleElement {
+public abstract class AbstractRuleElement extends RutaElement implements RuleElement {
protected RuleElementQuantifier quantifier;
- protected List<AbstractTextMarkerCondition> conditions;
+ protected List<AbstractRutaCondition> conditions;
- protected List<AbstractTextMarkerAction> actions;
+ protected List<AbstractRutaAction> actions;
private RuleElementContainer container;
- protected TextMarkerBlock parent;
+ protected RutaBlock parent;
public AbstractRuleElement(RuleElementQuantifier quantifier,
- List<AbstractTextMarkerCondition> conditions, List<AbstractTextMarkerAction> actions,
- RuleElementContainer container, TextMarkerBlock parent) {
+ List<AbstractRutaCondition> conditions, List<AbstractRutaAction> actions,
+ RuleElementContainer container, RutaBlock parent) {
super();
this.quantifier = quantifier;
this.conditions = conditions;
@@ -54,10 +54,10 @@ public abstract class AbstractRuleElemen
this.container = container;
this.parent = parent;
if (this.conditions == null) {
- this.conditions = new ArrayList<AbstractTextMarkerCondition>();
+ this.conditions = new ArrayList<AbstractRutaCondition>();
}
if (this.actions == null) {
- this.actions = new ArrayList<AbstractTextMarkerAction>();
+ this.actions = new ArrayList<AbstractRutaAction>();
}
if (this.quantifier == null) {
this.quantifier = new NormalQuantifier();
@@ -67,7 +67,7 @@ public abstract class AbstractRuleElemen
@SuppressWarnings("unchecked")
protected final InferenceCrowd emptyCrowd = new InferenceCrowd(Collections.EMPTY_LIST);
- protected void doneMatching(RuleMatch ruleMatch, RuleApply ruleApply, TextMarkerStream stream,
+ protected void doneMatching(RuleMatch ruleMatch, RuleApply ruleApply, RutaStream stream,
InferenceCrowd crowd) {
if (!ruleMatch.isApplied()) {
ruleApply.add(ruleMatch);
@@ -78,8 +78,8 @@ public abstract class AbstractRuleElemen
}
}
- public void apply(RuleMatch ruleMatch, TextMarkerStream stream, InferenceCrowd crowd) {
- for (AbstractTextMarkerAction action : actions) {
+ public void apply(RuleMatch ruleMatch, RutaStream stream, InferenceCrowd crowd) {
+ for (AbstractRutaAction action : actions) {
crowd.beginVisit(action, null);
action.execute(ruleMatch, this, stream, crowd);
crowd.endVisit(action, null);
@@ -98,7 +98,7 @@ public abstract class AbstractRuleElemen
}
public List<RuleElementMatch> evaluateMatches(List<RuleElementMatch> matches,
- TextMarkerBlock parent) {
+ RutaBlock parent) {
return quantifier.evaluateMatches(matches, parent, emptyCrowd);
}
@@ -131,23 +131,23 @@ public abstract class AbstractRuleElemen
return quantifier;
}
- public TextMarkerBlock getParent() {
+ public RutaBlock getParent() {
return parent;
}
- public List<AbstractTextMarkerCondition> getConditions() {
+ public List<AbstractRutaCondition> getConditions() {
return conditions;
}
- public void setConditions(List<AbstractTextMarkerCondition> conditions) {
+ public void setConditions(List<AbstractRutaCondition> conditions) {
this.conditions = conditions;
}
- public List<AbstractTextMarkerAction> getActions() {
+ public List<AbstractRutaAction> getActions() {
return actions;
}
- public void setActions(List<AbstractTextMarkerAction> actions) {
+ public void setActions(List<AbstractRutaAction> actions) {
this.actions = actions;
}
@@ -155,7 +155,7 @@ public abstract class AbstractRuleElemen
this.quantifier = quantifier;
}
- public TextMarkerRule getRule() {
+ public RutaRule getRule() {
return container.getRule();
}
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AbstractRuleMatch.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AbstractRuleMatch.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AbstractRuleMatch.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AbstractRuleMatch.java Mon Apr 29 13:45:04 2013
@@ -17,12 +17,12 @@
* under the License.
*/
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
import java.util.List;
import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.textmarker.TextMarkerStream;
+import org.apache.uima.ruta.RutaStream;
public abstract class AbstractRuleMatch<T extends AbstractRule> {
@@ -47,10 +47,10 @@ public abstract class AbstractRuleMatch<
return true;
}
-// public abstract List<AnnotationFS> getMatchedAnnotations(TextMarkerStream stream,
+// public abstract List<AnnotationFS> getMatchedAnnotations(RutaStream stream,
// List<Integer> indexes, RuleElementContainer container);
- public abstract List<AnnotationFS> getMatchedAnnotationsOfRoot(TextMarkerStream stream);
+ public abstract List<AnnotationFS> getMatchedAnnotationsOfRoot(RutaStream stream);
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AnnotationComparator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AnnotationComparator.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AnnotationComparator.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/AnnotationComparator.java Mon Apr 29 13:45:04 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
import java.util.Comparator;
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/ComposedRuleElement.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/ComposedRuleElement.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/ComposedRuleElement.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/ComposedRuleElement.java Mon Apr 29 13:45:04 2013
@@ -17,19 +17,19 @@
* under the License.
*/
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.textmarker.TextMarkerBlock;
-import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.action.AbstractTextMarkerAction;
-import org.apache.uima.textmarker.condition.AbstractTextMarkerCondition;
-import org.apache.uima.textmarker.rule.quantifier.RuleElementQuantifier;
-import org.apache.uima.textmarker.visitor.InferenceCrowd;
+import org.apache.uima.ruta.RutaBlock;
+import org.apache.uima.ruta.RutaStream;
+import org.apache.uima.ruta.action.AbstractRutaAction;
+import org.apache.uima.ruta.condition.AbstractRutaCondition;
+import org.apache.uima.ruta.rule.quantifier.RuleElementQuantifier;
+import org.apache.uima.ruta.visitor.InferenceCrowd;
public class ComposedRuleElement extends AbstractRuleElement implements RuleElementContainer {
@@ -38,20 +38,20 @@ public class ComposedRuleElement extends
protected RuleElementContainer caretaker;
public ComposedRuleElement(List<RuleElement> elements, RuleElementQuantifier quantifier,
- List<AbstractTextMarkerCondition> conditions, List<AbstractTextMarkerAction> actions,
- RuleElementContainer container, TextMarkerBlock parent) {
+ List<AbstractRutaCondition> conditions, List<AbstractRutaAction> actions,
+ RuleElementContainer container, RutaBlock parent) {
super(quantifier, conditions, actions, container, parent);
this.elements = elements;
this.caretaker = new RuleElementCaretaker(this);
}
- public void apply(RuleMatch match, TextMarkerStream symbolStream, InferenceCrowd crowd) {
+ public void apply(RuleMatch match, RutaStream symbolStream, InferenceCrowd crowd) {
applyRuleElements(match, symbolStream, crowd);
super.apply(match, symbolStream, crowd);
}
public void startMatch(RuleMatch ruleMatch, RuleApply ruleApply,
- ComposedRuleElementMatch containerMatch, RuleElement entryPoint, TextMarkerStream stream,
+ ComposedRuleElementMatch containerMatch, RuleElement entryPoint, RutaStream stream,
InferenceCrowd crowd) {
RuleElement anchorElement = getAnchoringRuleElement(stream);
ComposedRuleElementMatch composedMatch = createComposedMatch(ruleMatch, containerMatch);
@@ -67,7 +67,7 @@ public class ComposedRuleElement extends
public void continueMatch(boolean after, AnnotationFS annotation, RuleMatch ruleMatch,
RuleApply ruleApply, ComposedRuleElementMatch containerMatch,
- TextMarkerRuleElement sideStepOrigin, RuleElement entryPoint, TextMarkerStream stream,
+ RutaRuleElement sideStepOrigin, RuleElement entryPoint, RutaStream stream,
InferenceCrowd crowd) {
RuleElement nextElement = getNextElement(after, this);
if (nextElement != null) {
@@ -82,7 +82,7 @@ public class ComposedRuleElement extends
public void continueOwnMatch(boolean after, AnnotationFS annotation, RuleMatch ruleMatch,
RuleApply ruleApply, ComposedRuleElementMatch containerMatch,
- TextMarkerRuleElement sideStepOrigin, RuleElement entryPoint, TextMarkerStream stream,
+ RutaRuleElement sideStepOrigin, RuleElement entryPoint, RutaStream stream,
InferenceCrowd crowd) {
if (!stream.isSimpleGreedyForComposed()) {
continueMatch(after, annotation, ruleMatch, ruleApply, containerMatch, sideStepOrigin,
@@ -125,7 +125,7 @@ public class ComposedRuleElement extends
public void fallbackContinue(boolean after, boolean failed, AnnotationFS annotation,
RuleMatch ruleMatch, RuleApply ruleApply, ComposedRuleElementMatch containerMatch,
- TextMarkerRuleElement sideStepOrigin, RuleElement entryPoint, TextMarkerStream stream,
+ RutaRuleElement sideStepOrigin, RuleElement entryPoint, RutaStream stream,
InferenceCrowd crowd) {
RuleElementContainer container = getContainer();
doMatch(containerMatch, stream, crowd);
@@ -187,7 +187,7 @@ public class ComposedRuleElement extends
private void fallback(boolean after, boolean failed, AnnotationFS annotation,
RuleMatch ruleMatch, RuleApply ruleApply, ComposedRuleElementMatch containerMatch,
- TextMarkerRuleElement sideStepOrigin, RuleElement entryPoint, TextMarkerStream stream,
+ RutaRuleElement sideStepOrigin, RuleElement entryPoint, RutaStream stream,
InferenceCrowd crowd) {
RuleElementContainer parentContainer = getContainer();
if (parentContainer instanceof ComposedRuleElement) {
@@ -211,7 +211,7 @@ public class ComposedRuleElement extends
}
}
- private void doMatch(ComposedRuleElementMatch match, TextMarkerStream stream, InferenceCrowd crowd) {
+ private void doMatch(ComposedRuleElementMatch match, RutaStream stream, InferenceCrowd crowd) {
List<AnnotationFS> textsMatched = match.getTextsMatched();
if (textsMatched == null || textsMatched.isEmpty()) {
return;
@@ -223,7 +223,7 @@ public class ComposedRuleElement extends
List<EvaluatedCondition> evaluatedConditions = new ArrayList<EvaluatedCondition>(
conditions.size());
- for (AbstractTextMarkerCondition condition : conditions) {
+ for (AbstractRutaCondition condition : conditions) {
crowd.beginVisit(condition, null);
EvaluatedCondition eval = condition.eval(annotation, this, stream, crowd);
crowd.endVisit(condition, null);
@@ -233,13 +233,13 @@ public class ComposedRuleElement extends
match.evaluateInnerMatches(true);
}
- public Collection<AnnotationFS> getAnchors(TextMarkerStream stream) {
+ public Collection<AnnotationFS> getAnchors(RutaStream stream) {
RuleElement anchorElement = getAnchoringRuleElement(stream);
Collection<AnnotationFS> anchors = anchorElement.getAnchors(stream);
return anchors;
}
- public int estimateAnchors(TextMarkerStream stream) {
+ public int estimateAnchors(RutaStream stream) {
int result = 1;
for (RuleElement each : elements) {
result += each.estimateAnchors(stream);
@@ -247,7 +247,7 @@ public class ComposedRuleElement extends
return result;
}
- public RuleElement getAnchoringRuleElement(TextMarkerStream stream) {
+ public RuleElement getAnchoringRuleElement(RutaStream stream) {
return caretaker.getAnchoringRuleElement(stream);
}
@@ -267,7 +267,7 @@ public class ComposedRuleElement extends
return caretaker.getLastElement();
}
- public void applyRuleElements(RuleMatch ruleMatch, TextMarkerStream stream, InferenceCrowd crowd) {
+ public void applyRuleElements(RuleMatch ruleMatch, RutaStream stream, InferenceCrowd crowd) {
caretaker.applyRuleElements(ruleMatch, stream, crowd);
}
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/ComposedRuleElementMatch.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/ComposedRuleElementMatch.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/ComposedRuleElementMatch.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/ComposedRuleElementMatch.java Mon Apr 29 13:45:04 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
import java.util.ArrayList;
import java.util.Arrays;
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/EvaluatedCondition.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/EvaluatedCondition.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/EvaluatedCondition.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/EvaluatedCondition.java Mon Apr 29 13:45:04 2013
@@ -17,17 +17,17 @@
* under the License.
*/
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
import java.util.ArrayList;
import java.util.List;
-import org.apache.uima.textmarker.condition.AbstractTextMarkerCondition;
-import org.apache.uima.textmarker.condition.NotCondition;
+import org.apache.uima.ruta.condition.AbstractRutaCondition;
+import org.apache.uima.ruta.condition.NotCondition;
public class EvaluatedCondition {
- private final AbstractTextMarkerCondition condition;
+ private final AbstractRutaCondition condition;
private final boolean value;
@@ -35,7 +35,7 @@ public class EvaluatedCondition {
private final List<EvaluatedCondition> noConditions = new ArrayList<EvaluatedCondition>(0);
- public EvaluatedCondition(AbstractTextMarkerCondition condition, boolean value,
+ public EvaluatedCondition(AbstractRutaCondition condition, boolean value,
List<EvaluatedCondition> conditions) {
super();
this.condition = condition;
@@ -43,7 +43,7 @@ public class EvaluatedCondition {
this.conditions = conditions;
}
- public EvaluatedCondition(AbstractTextMarkerCondition condition, boolean value) {
+ public EvaluatedCondition(AbstractRutaCondition condition, boolean value) {
super();
this.condition = condition;
this.value = value;
@@ -58,7 +58,7 @@ public class EvaluatedCondition {
conditions.add(eval);
}
- public AbstractTextMarkerCondition getCondition() {
+ public AbstractRutaCondition getCondition() {
return condition;
}
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RegExpRule.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RegExpRule.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RegExpRule.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RegExpRule.java Mon Apr 29 13:45:04 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
import java.util.ArrayList;
import java.util.List;
@@ -32,14 +32,14 @@ import java.util.regex.Pattern;
import org.apache.uima.cas.CAS;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.textmarker.ScriptApply;
-import org.apache.uima.textmarker.TextMarkerBlock;
-import org.apache.uima.textmarker.TextMarkerEnvironment;
-import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.expression.number.NumberExpression;
-import org.apache.uima.textmarker.expression.string.StringExpression;
-import org.apache.uima.textmarker.expression.type.TypeExpression;
-import org.apache.uima.textmarker.visitor.InferenceCrowd;
+import org.apache.uima.ruta.ScriptApply;
+import org.apache.uima.ruta.RutaBlock;
+import org.apache.uima.ruta.RutaEnvironment;
+import org.apache.uima.ruta.RutaStream;
+import org.apache.uima.ruta.expression.number.NumberExpression;
+import org.apache.uima.ruta.expression.string.StringExpression;
+import org.apache.uima.ruta.expression.type.TypeExpression;
+import org.apache.uima.ruta.visitor.InferenceCrowd;
public class RegExpRule extends AbstractRule {
@@ -48,14 +48,14 @@ public class RegExpRule extends Abstract
private StringExpression regexpExpr;
public RegExpRule(StringExpression regexp, Map<TypeExpression, NumberExpression> typeMap, int id,
- TextMarkerBlock parent) {
+ RutaBlock parent) {
super(parent, id);
this.regexpExpr = regexp;
this.typeMap = typeMap;
}
@Override
- public ScriptApply apply(TextMarkerStream stream, InferenceCrowd crowd) {
+ public ScriptApply apply(RutaStream stream, InferenceCrowd crowd) {
RuleApply ruleApply = new RuleApply(this, false);
crowd.beginVisit(this, ruleApply);
@@ -111,7 +111,7 @@ public class RegExpRule extends Abstract
return groupTypes;
}
- private void createAnnotations(int group, int delta, int begin, int end, List<Type> globalTypes, RegExpRuleMatch match, TextMarkerStream stream) {
+ private void createAnnotations(int group, int delta, int begin, int end, List<Type> globalTypes, RegExpRuleMatch match, RutaStream stream) {
CAS cas = stream.getCas();
if (begin < end) {
for (Type type : globalTypes) {
@@ -123,7 +123,7 @@ public class RegExpRule extends Abstract
}
@Override
- public TextMarkerEnvironment getEnvironment() {
+ public RutaEnvironment getEnvironment() {
return getParent().getEnvironment();
}
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RegExpRuleMatch.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RegExpRuleMatch.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RegExpRuleMatch.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RegExpRuleMatch.java Mon Apr 29 13:45:04 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
import java.util.LinkedList;
import java.util.List;
@@ -25,7 +25,7 @@ import java.util.Map;
import java.util.TreeMap;
import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.textmarker.TextMarkerStream;
+import org.apache.uima.ruta.RutaStream;
public class RegExpRuleMatch extends AbstractRuleMatch<RegExpRule> {
@@ -36,7 +36,7 @@ public class RegExpRuleMatch extends Abs
}
@Override
- public List<AnnotationFS> getMatchedAnnotationsOfRoot(TextMarkerStream stream) {
+ public List<AnnotationFS> getMatchedAnnotationsOfRoot(RutaStream stream) {
return map.get(0);
}
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleApply.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleApply.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleApply.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleApply.java Mon Apr 29 13:45:04 2013
@@ -1,10 +1,10 @@
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
import java.util.ArrayList;
import java.util.List;
-import org.apache.uima.textmarker.ScriptApply;
-import org.apache.uima.textmarker.TextMarkerStatement;
+import org.apache.uima.ruta.ScriptApply;
+import org.apache.uima.ruta.RutaStatement;
public class RuleApply extends ScriptApply {
@@ -16,7 +16,7 @@ public class RuleApply extends ScriptApp
private boolean acceptMatches;
- public RuleApply(TextMarkerStatement tme, boolean remember) {
+ public RuleApply(RutaStatement tme, boolean remember) {
super(tme);
list = new ArrayList<AbstractRuleMatch<? extends AbstractRule>>();
this.acceptMatches = remember;
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElement.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElement.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElement.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElement.java Mon Apr 29 13:45:04 2013
@@ -17,57 +17,57 @@
* under the License.
*/
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
import java.util.Collection;
import java.util.List;
import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.textmarker.TextMarkerBlock;
-import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.action.AbstractTextMarkerAction;
-import org.apache.uima.textmarker.condition.AbstractTextMarkerCondition;
-import org.apache.uima.textmarker.rule.quantifier.RuleElementQuantifier;
-import org.apache.uima.textmarker.visitor.InferenceCrowd;
+import org.apache.uima.ruta.RutaBlock;
+import org.apache.uima.ruta.RutaStream;
+import org.apache.uima.ruta.action.AbstractRutaAction;
+import org.apache.uima.ruta.condition.AbstractRutaCondition;
+import org.apache.uima.ruta.rule.quantifier.RuleElementQuantifier;
+import org.apache.uima.ruta.visitor.InferenceCrowd;
public interface RuleElement {
- void apply(RuleMatch match, TextMarkerStream stream, InferenceCrowd crowd);
+ void apply(RuleMatch match, RutaStream stream, InferenceCrowd crowd);
void startMatch(RuleMatch ruleMatch, RuleApply ruleApply,
- ComposedRuleElementMatch containerMatch, RuleElement entryPoint, TextMarkerStream stream,
+ ComposedRuleElementMatch containerMatch, RuleElement entryPoint, RutaStream stream,
InferenceCrowd crowd);
void continueMatch(boolean after, AnnotationFS annotation, RuleMatch ruleMatch,
RuleApply ruleApply, ComposedRuleElementMatch containerMatch,
- TextMarkerRuleElement sideStepOrigin, RuleElement entryPoint, TextMarkerStream stream,
+ RutaRuleElement sideStepOrigin, RuleElement entryPoint, RutaStream stream,
InferenceCrowd crowd);
void continueOwnMatch(boolean after, AnnotationFS annotation, RuleMatch ruleMatch,
RuleApply ruleApply, ComposedRuleElementMatch containerMatch,
- TextMarkerRuleElement sideStepOrigin, RuleElement entryPoint, TextMarkerStream stream,
+ RutaRuleElement sideStepOrigin, RuleElement entryPoint, RutaStream stream,
InferenceCrowd crowd);
- List<RuleElementMatch> evaluateMatches(List<RuleElementMatch> matches, TextMarkerBlock parent);
+ List<RuleElementMatch> evaluateMatches(List<RuleElementMatch> matches, RutaBlock parent);
- Collection<AnnotationFS> getAnchors(TextMarkerStream symbolStream);
+ Collection<AnnotationFS> getAnchors(RutaStream symbolStream);
- TextMarkerBlock getParent();
+ RutaBlock getParent();
- TextMarkerRule getRule();
+ RutaRule getRule();
RuleElementContainer getContainer();
RuleElementQuantifier getQuantifier();
- int estimateAnchors(TextMarkerStream stream);
+ int estimateAnchors(RutaStream stream);
List<Integer> getSelfIndexList();
- List<AbstractTextMarkerCondition> getConditions();
+ List<AbstractRutaCondition> getConditions();
- List<AbstractTextMarkerAction> getActions();
+ List<AbstractRutaAction> getActions();
boolean hasAncestor(boolean after);
}
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementCaretaker.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementCaretaker.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementCaretaker.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementCaretaker.java Mon Apr 29 13:45:04 2013
@@ -17,12 +17,12 @@
* under the License.
*/
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
import java.util.List;
-import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.visitor.InferenceCrowd;
+import org.apache.uima.ruta.RutaStream;
+import org.apache.uima.ruta.visitor.InferenceCrowd;
public class RuleElementCaretaker implements RuleElementContainer {
@@ -55,7 +55,7 @@ public class RuleElementCaretaker implem
return container.getRuleElements();
}
- public RuleElement getAnchoringRuleElement(TextMarkerStream stream) {
+ public RuleElement getAnchoringRuleElement(RutaStream stream) {
List<RuleElement> ruleElements = container.getRuleElements();
if (ruleElements.size() == 1 || containsLiteralMatcher(ruleElements)) {
return ruleElements.get(0);
@@ -85,9 +85,9 @@ public class RuleElementCaretaker implem
private boolean containsLiteralMatcher(List<RuleElement> ruleElements) {
for (RuleElement each : ruleElements) {
- if(each instanceof TextMarkerRuleElement) {
- TextMarkerRuleElement re = (TextMarkerRuleElement) each;
- if(re.getMatcher() instanceof TextMarkerLiteralMatcher) {
+ if(each instanceof RutaRuleElement) {
+ RutaRuleElement re = (RutaRuleElement) each;
+ if(re.getMatcher() instanceof RutaLiteralMatcher) {
return true;
}
}
@@ -105,13 +105,13 @@ public class RuleElementCaretaker implem
return ruleElements.get(ruleElements.size() - 1);
}
- public void applyRuleElements(RuleMatch ruleMatch, TextMarkerStream stream, InferenceCrowd crowd) {
+ public void applyRuleElements(RuleMatch ruleMatch, RutaStream stream, InferenceCrowd crowd) {
for (RuleElement eachElement : getRuleElements()) {
eachElement.apply(ruleMatch, stream, crowd);
}
}
- public TextMarkerRule getRule() {
+ public RutaRule getRule() {
return container.getRule();
}
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementComparator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementComparator.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementComparator.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementComparator.java Mon Apr 29 13:45:04 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
import java.util.Comparator;
import java.util.List;
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementContainer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementContainer.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementContainer.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementContainer.java Mon Apr 29 13:45:04 2013
@@ -17,12 +17,12 @@
* under the License.
*/
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
import java.util.List;
-import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.visitor.InferenceCrowd;
+import org.apache.uima.ruta.RutaStream;
+import org.apache.uima.ruta.visitor.InferenceCrowd;
public interface RuleElementContainer {
@@ -36,11 +36,11 @@ public interface RuleElementContainer {
RuleElement getLastElement();
- RuleElement getAnchoringRuleElement(TextMarkerStream stream);
+ RuleElement getAnchoringRuleElement(RutaStream stream);
- void applyRuleElements(RuleMatch ruleMatch, TextMarkerStream stream, InferenceCrowd crowd);
+ void applyRuleElements(RuleMatch ruleMatch, RutaStream stream, InferenceCrowd crowd);
- TextMarkerRule getRule();
+ RutaRule getRule();
RuleElement getNextElement(boolean after, RuleElement ruleElement);
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementIsolator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementIsolator.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementIsolator.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementIsolator.java Mon Apr 29 13:45:04 2013
@@ -17,12 +17,12 @@
* under the License.
*/
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
import java.util.List;
-import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.visitor.InferenceCrowd;
+import org.apache.uima.ruta.RutaStream;
+import org.apache.uima.ruta.visitor.InferenceCrowd;
public class RuleElementIsolator implements RuleElementContainer {
@@ -41,7 +41,7 @@ public class RuleElementIsolator impleme
return container.getRuleElements();
}
- public RuleElement getAnchoringRuleElement(TextMarkerStream stream) {
+ public RuleElement getAnchoringRuleElement(RutaStream stream) {
return getRuleElement();
}
@@ -53,7 +53,7 @@ public class RuleElementIsolator impleme
return getRuleElement();
}
- public void applyRuleElements(RuleMatch ruleMatch, TextMarkerStream stream, InferenceCrowd crowd) {
+ public void applyRuleElements(RuleMatch ruleMatch, RutaStream stream, InferenceCrowd crowd) {
getRuleElement().apply(ruleMatch, stream, crowd);
}
@@ -61,7 +61,7 @@ public class RuleElementIsolator impleme
return container;
}
- public void setContainer(TextMarkerRule container) {
+ public void setContainer(RutaRule container) {
this.container = container.getRoot();
}
@@ -69,7 +69,7 @@ public class RuleElementIsolator impleme
return container.getRuleElements().get(0);
}
- public TextMarkerRule getRule() {
+ public RutaRule getRule() {
return container.getRule();
}
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementMatch.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementMatch.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementMatch.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleElementMatch.java Mon Apr 29 13:45:04 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
import java.util.ArrayList;
import java.util.List;
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleMatch.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleMatch.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleMatch.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleMatch.java Mon Apr 29 13:45:04 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
import java.util.ArrayList;
import java.util.Comparator;
@@ -29,11 +29,11 @@ import java.util.Set;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.jcas.tcas.Annotation;
-import org.apache.uima.textmarker.ScriptApply;
-import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.action.AbstractTextMarkerAction;
+import org.apache.uima.ruta.ScriptApply;
+import org.apache.uima.ruta.RutaStream;
+import org.apache.uima.ruta.action.AbstractRutaAction;
-public class RuleMatch extends AbstractRuleMatch<TextMarkerRule> {
+public class RuleMatch extends AbstractRuleMatch<RutaRule> {
private static class RuleMatchComparator implements Comparator<RuleElementMatch> {
@@ -49,21 +49,21 @@ public class RuleMatch extends AbstractR
private boolean applied = false;
- private Map<AbstractTextMarkerAction, ScriptApply> delegateApply;
+ private Map<AbstractRutaAction, ScriptApply> delegateApply;
// private Map<RuleElement, List<RuleElementMatch>> map;
private ComposedRuleElementMatch rootMatch;
- public RuleMatch(TextMarkerRule rule) {
+ public RuleMatch(RutaRule rule) {
super(rule);
// map = new TreeMap<RuleElement, List<RuleElementMatch>>(
// new RuleElementComparator(rule.getRoot()));
- delegateApply = new HashMap<AbstractTextMarkerAction, ScriptApply>(0);
+ delegateApply = new HashMap<AbstractRutaAction, ScriptApply>(0);
}
public boolean processMatchInfo(RuleElement ruleElement,
- List<RuleElementMatch> ruleElementMatches, TextMarkerStream stream) {
+ List<RuleElementMatch> ruleElementMatches, RutaStream stream) {
// return true, if you changed the matches -> current basic needs to be set correctly
// TODO remove this here?!
boolean result = false;
@@ -85,22 +85,22 @@ public class RuleMatch extends AbstractR
return matched && rootMatch.matched();
}
- public List<AnnotationFS> getMatchedAnnotationsOf(RuleElement element, TextMarkerStream stream) {
+ public List<AnnotationFS> getMatchedAnnotationsOf(RuleElement element, RutaStream stream) {
return getMatchedAnnotations(stream, element.getSelfIndexList(), element.getContainer());
}
@Override
- public List<AnnotationFS> getMatchedAnnotationsOfRoot(TextMarkerStream stream) {
- return getMatchedAnnotationsOf(((TextMarkerRule)getRule()).getRoot(), stream);
+ public List<AnnotationFS> getMatchedAnnotationsOfRoot(RutaStream stream) {
+ return getMatchedAnnotationsOf(((RutaRule)getRule()).getRoot(), stream);
}
- public List<AnnotationFS> getMatchedAnnotations(TextMarkerStream stream, List<Integer> indexes,
+ public List<AnnotationFS> getMatchedAnnotations(RutaStream stream, List<Integer> indexes,
RuleElementContainer container) {
List<AnnotationFS> result = new ArrayList<AnnotationFS>();
indexes = extendIndexes(indexes);
if (container == null) {
- container = ((TextMarkerRule)rule).getRoot();
+ container = ((RutaRule)rule).getRoot();
}
// TODO refactor this!
@@ -196,11 +196,11 @@ public class RuleMatch extends AbstractR
return result.toString();
}
- public Map<AbstractTextMarkerAction, ScriptApply> getDelegateApply() {
+ public Map<AbstractRutaAction, ScriptApply> getDelegateApply() {
return delegateApply;
}
- public void addDelegateApply(AbstractTextMarkerAction action, ScriptApply scriptApply) {
+ public void addDelegateApply(AbstractRutaAction action, ScriptApply scriptApply) {
delegateApply.put(action, scriptApply);
}
@@ -217,7 +217,7 @@ public class RuleMatch extends AbstractR
copy.setRootMatch(rootMatch.copy(extendedContainerMatch));
}
- Map<AbstractTextMarkerAction, ScriptApply> newDelegateApply = new HashMap<AbstractTextMarkerAction, ScriptApply>(
+ Map<AbstractRutaAction, ScriptApply> newDelegateApply = new HashMap<AbstractRutaAction, ScriptApply>(
delegateApply);
copy.setDelegateApply(newDelegateApply);
return copy;
@@ -231,7 +231,7 @@ public class RuleMatch extends AbstractR
}
}
- public void setDelegateApply(Map<AbstractTextMarkerAction, ScriptApply> delegateApply) {
+ public void setDelegateApply(Map<AbstractRutaAction, ScriptApply> delegateApply) {
this.delegateApply = delegateApply;
}
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/WildCardRuleElement.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/WildCardRuleElement.java?rev=1477069&r1=1477068&r2=1477069&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/WildCardRuleElement.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/WildCardRuleElement.java Mon Apr 29 13:45:04 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.rule;
+package org.apache.uima.ruta.rule;
import java.util.ArrayList;
import java.util.Collection;
@@ -32,32 +32,32 @@ import org.apache.uima.cas.FSTypeConstra
import org.apache.uima.cas.Type;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.jcas.JCas;
-import org.apache.uima.textmarker.TextMarkerBlock;
-import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.action.AbstractTextMarkerAction;
-import org.apache.uima.textmarker.condition.AbstractTextMarkerCondition;
-import org.apache.uima.textmarker.expression.string.StringExpression;
-import org.apache.uima.textmarker.type.TextMarkerBasic;
-import org.apache.uima.textmarker.type.TextMarkerFrame;
-import org.apache.uima.textmarker.visitor.InferenceCrowd;
+import org.apache.uima.ruta.RutaBlock;
+import org.apache.uima.ruta.RutaStream;
+import org.apache.uima.ruta.action.AbstractRutaAction;
+import org.apache.uima.ruta.condition.AbstractRutaCondition;
+import org.apache.uima.ruta.expression.string.StringExpression;
+import org.apache.uima.ruta.type.RutaBasic;
+import org.apache.uima.ruta.type.RutaFrame;
+import org.apache.uima.ruta.visitor.InferenceCrowd;
public class WildCardRuleElement extends AbstractRuleElement {
- public WildCardRuleElement(List<AbstractTextMarkerCondition> conditions,
- List<AbstractTextMarkerAction> actions, RuleElementContainer container,
- TextMarkerBlock parent) {
+ public WildCardRuleElement(List<AbstractRutaCondition> conditions,
+ List<AbstractRutaAction> actions, RuleElementContainer container,
+ RutaBlock parent) {
super(null, conditions, actions, container, parent);
}
public void startMatch(RuleMatch ruleMatch, RuleApply ruleApply,
- ComposedRuleElementMatch containerMatch, RuleElement entryPoint, TextMarkerStream stream,
+ ComposedRuleElementMatch containerMatch, RuleElement entryPoint, RutaStream stream,
InferenceCrowd crowd) {
continueMatch(true, null, ruleMatch, ruleApply, containerMatch, null, entryPoint, stream, crowd);
}
public void continueMatch(boolean after, AnnotationFS annotation, RuleMatch ruleMatch,
RuleApply ruleApply, ComposedRuleElementMatch containerMatch,
- TextMarkerRuleElement sideStepOrigin, RuleElement entryPoint, TextMarkerStream stream,
+ RutaRuleElement sideStepOrigin, RuleElement entryPoint, RutaStream stream,
InferenceCrowd crowd) {
RuleElement nextElement = getContainer().getNextElement(after, this);
@@ -68,8 +68,8 @@ public class WildCardRuleElement extends
private void tryWithNextRuleElement(RuleElement nextElement, boolean after,
AnnotationFS annotation, RuleMatch ruleMatch, RuleApply ruleApply,
- ComposedRuleElementMatch containerMatch, TextMarkerRuleElement sideStepOrigin,
- RuleElement entryPoint, TextMarkerStream stream, InferenceCrowd crowd) {
+ ComposedRuleElementMatch containerMatch, RutaRuleElement sideStepOrigin,
+ RuleElement entryPoint, RutaStream stream, InferenceCrowd crowd) {
// what is the next stuff that should match?
if (nextElement == null) {
AnnotationFS afs = getCoveredByWildCard(after, annotation, null, stream);
@@ -77,16 +77,16 @@ public class WildCardRuleElement extends
ComposedRuleElement composed = (ComposedRuleElement) getContainer();
composed.fallbackContinue(after, ruleMatch.matched(), afs, ruleMatch, ruleApply,
containerMatch, sideStepOrigin, entryPoint, stream, crowd);
- } else if (nextElement instanceof TextMarkerRuleElement) {
- TextMarkerRuleElement re = (TextMarkerRuleElement) nextElement;
- TextMarkerMatcher matcher = re.getMatcher();
- if (matcher instanceof TextMarkerTypeMatcher) {
+ } else if (nextElement instanceof RutaRuleElement) {
+ RutaRuleElement re = (RutaRuleElement) nextElement;
+ RutaMatcher matcher = re.getMatcher();
+ if (matcher instanceof RutaTypeMatcher) {
tryWithNextType(after, annotation, nextElement, null, ruleMatch, ruleApply, containerMatch,
sideStepOrigin, stream, crowd);
- } else if (matcher instanceof TextMarkerLiteralMatcher) {
+ } else if (matcher instanceof RutaLiteralMatcher) {
tryWithNextLiteral(after, annotation, re, ruleMatch, ruleApply, containerMatch,
sideStepOrigin, stream, crowd);
- } else if (matcher instanceof TextMarkerDisjunctiveMatcher) {
+ } else if (matcher instanceof RutaDisjunctiveMatcher) {
tryWithNextType(after, annotation, re, null, ruleMatch, ruleApply, containerMatch,
sideStepOrigin, stream, crowd);
}
@@ -121,12 +121,12 @@ public class WildCardRuleElement extends
private void tryWithNextComposed(boolean after, AnnotationFS annotation, ComposedRuleElement cre,
RuleMatch ruleMatch, RuleApply ruleApply, ComposedRuleElementMatch containerMatch,
- TextMarkerRuleElement sideStepOrigin, TextMarkerStream stream, InferenceCrowd crowd) {
+ RutaRuleElement sideStepOrigin, RutaStream stream, InferenceCrowd crowd) {
AnnotationFS nextOne = annotation;
boolean doneHere = false;
while (!doneHere
&& (nextOne = getNextPositionForComposed(cre, after, nextOne, stream)) != null) {
- TextMarkerBasic endAnchor = stream.getEndAnchor(nextOne.getBegin());
+ RutaBasic endAnchor = stream.getEndAnchor(nextOne.getBegin());
ComposedRuleElementMatch extendedContainerMatch = containerMatch.copy();
RuleMatch extendedMatch = ruleMatch.copy(extendedContainerMatch);
AnnotationFS coveredByWildCard = getCoveredByWildCard(after, annotation, nextOne, stream);
@@ -167,7 +167,7 @@ public class WildCardRuleElement extends
}
private AnnotationFS getNextPositionForComposed(ComposedRuleElement cre, boolean after,
- AnnotationFS annotation, TextMarkerStream stream) {
+ AnnotationFS annotation, RutaStream stream) {
RuleElement element = getNextAtomicRuleElement(cre, after);
AnnotationFS result = null;
if (element instanceof WildCardRuleElement) {
@@ -177,16 +177,16 @@ public class WildCardRuleElement extends
return stream.getAnchor(after, annotation.getBegin());
}
} else {
- TextMarkerRuleElement re = (TextMarkerRuleElement) element;
- TextMarkerMatcher matcher = re.getMatcher();
- if (matcher instanceof TextMarkerTypeMatcher) {
+ RutaRuleElement re = (RutaRuleElement) element;
+ RutaMatcher matcher = re.getMatcher();
+ if (matcher instanceof RutaTypeMatcher) {
FSIterator<AnnotationFS> iterator = getIterator(after, annotation, re, null, stream);
// moveOn(after, iterator);
if (iterator.isValid()) {
result = iterator.get();
}
- } else if (matcher instanceof TextMarkerLiteralMatcher) {
- TextMarkerLiteralMatcher lm = (TextMarkerLiteralMatcher) matcher;
+ } else if (matcher instanceof RutaLiteralMatcher) {
+ RutaLiteralMatcher lm = (RutaLiteralMatcher) matcher;
StringExpression expression = lm.getExpression();
String stringValue = expression.getStringValue(parent);
AnnotationFS documentAnnotation = stream.getDocumentAnnotation();
@@ -225,14 +225,14 @@ public class WildCardRuleElement extends
private void tryWithNextType(boolean after, AnnotationFS annotation, RuleElement nextElement,
Type defaultType, RuleMatch ruleMatch, RuleApply ruleApply,
- ComposedRuleElementMatch containerMatch, TextMarkerRuleElement sideStepOrigin,
- TextMarkerStream stream, InferenceCrowd crowd) {
+ ComposedRuleElementMatch containerMatch, RutaRuleElement sideStepOrigin,
+ RutaStream stream, InferenceCrowd crowd) {
FSIterator<AnnotationFS> iterator = getIterator(after, annotation, nextElement, defaultType,
stream);
boolean doneHere = false;
while (!doneHere && iterator.isValid() && stream.isVisible(iterator.get())) {
AnnotationFS nextOne = iterator.get();
- TextMarkerBasic endAnchor = stream.getEndAnchor(nextOne.getBegin());
+ RutaBasic endAnchor = stream.getEndAnchor(nextOne.getBegin());
ComposedRuleElementMatch extendedContainerMatch = containerMatch.copy();
RuleMatch extendedMatch = ruleMatch.copy(extendedContainerMatch);
@@ -258,18 +258,18 @@ public class WildCardRuleElement extends
}
private FSIterator<AnnotationFS> getIterator(boolean after, AnnotationFS annotation,
- RuleElement nextElement, Type defaultType, TextMarkerStream stream) {
+ RuleElement nextElement, Type defaultType, RutaStream stream) {
CAS cas = stream.getCas();
FSIterator<AnnotationFS> iterator = null;
if (defaultType == null) {
- TextMarkerRuleElement re = (TextMarkerRuleElement) nextElement;
- TextMarkerMatcher matcher = re.getMatcher();
- if (matcher instanceof TextMarkerTypeMatcher) {
- TextMarkerTypeMatcher typeMatcher = (TextMarkerTypeMatcher) re.getMatcher();
+ RutaRuleElement re = (RutaRuleElement) nextElement;
+ RutaMatcher matcher = re.getMatcher();
+ if (matcher instanceof RutaTypeMatcher) {
+ RutaTypeMatcher typeMatcher = (RutaTypeMatcher) re.getMatcher();
List<Type> types = typeMatcher.getTypes(parent, stream);
Type type = types.get(0);
iterator = getIteratorOfType(type, annotation, stream);
- } else if (matcher instanceof TextMarkerDisjunctiveMatcher) {
+ } else if (matcher instanceof RutaDisjunctiveMatcher) {
List<Type> types = matcher.getTypes(parent, stream);
iterator = getIteratorForDisjunctive(cas, types, after, annotation, stream);
} else {
@@ -282,7 +282,7 @@ public class WildCardRuleElement extends
}
private FSIterator<AnnotationFS> getIteratorOfType(Type type, AnnotationFS annotation,
- TextMarkerStream stream) {
+ RutaStream stream) {
CAS cas = stream.getCas();
FSIterator<AnnotationFS> result = null;
if(stream.getDocumentAnnotation().equals(cas.getDocumentAnnotation())) {
@@ -299,7 +299,7 @@ public class WildCardRuleElement extends
} catch (CASException e) {
e.printStackTrace();
}
- TextMarkerFrame window = new TextMarkerFrame(jcas, stream.getDocumentAnnotation().getBegin(), stream.getDocumentAnnotation().getEnd());
+ RutaFrame window = new RutaFrame(jcas, stream.getDocumentAnnotation().getBegin(), stream.getDocumentAnnotation().getEnd());
if(annotation == null) {
result = cas.getAnnotationIndex(type).subiterator(window);
} else {
@@ -312,10 +312,10 @@ public class WildCardRuleElement extends
}
private void tryWithNextLiteral(boolean after, AnnotationFS annotation,
- TextMarkerRuleElement nextElement, RuleMatch ruleMatch, RuleApply ruleApply,
- ComposedRuleElementMatch containerMatch, TextMarkerRuleElement sideStepOrigin,
- TextMarkerStream stream, InferenceCrowd crowd) {
- TextMarkerLiteralMatcher matcher = (TextMarkerLiteralMatcher) nextElement.getMatcher();
+ RutaRuleElement nextElement, RuleMatch ruleMatch, RuleApply ruleApply,
+ ComposedRuleElementMatch containerMatch, RutaRuleElement sideStepOrigin,
+ RutaStream stream, InferenceCrowd crowd) {
+ RutaLiteralMatcher matcher = (RutaLiteralMatcher) nextElement.getMatcher();
StringExpression expression = matcher.getExpression();
String stringValue = expression.getStringValue(parent);
AnnotationFS documentAnnotation = stream.getDocumentAnnotation();
@@ -336,8 +336,8 @@ public class WildCardRuleElement extends
doneHere = true;
break;
}
- TextMarkerBasic anchor = stream.getAnchor(after, indexOf+delta);
- TextMarkerBasic endAnchor = stream.getAnchor(!after, indexOf+delta);
+ RutaBasic anchor = stream.getAnchor(after, indexOf+delta);
+ RutaBasic endAnchor = stream.getAnchor(!after, indexOf+delta);
ComposedRuleElementMatch extendedContainerMatch = containerMatch.copy();
RuleMatch extendedMatch = ruleMatch.copy(extendedContainerMatch);
AnnotationFS coveredByWildCard = getCoveredByWildCard(after, annotation, anchor, stream);
@@ -367,7 +367,7 @@ public class WildCardRuleElement extends
}
private FSIterator<AnnotationFS> getIteratorForDisjunctive(CAS cas, List<Type> types,
- boolean after, AnnotationFS annotation, TextMarkerStream stream) {
+ boolean after, AnnotationFS annotation, RutaStream stream) {
ConstraintFactory cf = cas.getConstraintFactory();
FSTypeConstraint typeConstraint = cf.createTypeConstraint();
for (Type each : types) {
@@ -401,7 +401,7 @@ public class WildCardRuleElement extends
}
private AnnotationFS getCoveredByWildCard(boolean after, AnnotationFS last,
- AnnotationFS next, TextMarkerStream stream) {
+ AnnotationFS next, RutaStream stream) {
CAS cas = stream.getCas();
Type type = cas.getAnnotationType();
AnnotationFS documentAnnotation = stream.getDocumentAnnotation();
@@ -432,7 +432,7 @@ public class WildCardRuleElement extends
}
private void doMatch(AnnotationFS annotation, RuleMatch ruleMatch,
- ComposedRuleElementMatch containerMatch, boolean ruleAnchor, TextMarkerStream stream,
+ ComposedRuleElementMatch containerMatch, boolean ruleAnchor, RutaStream stream,
InferenceCrowd crowd) {
RuleElementMatch result = new RuleElementMatch(this, containerMatch);
result.setRuleAnchor(ruleAnchor);
@@ -441,7 +441,7 @@ public class WildCardRuleElement extends
boolean base = true;
List<AnnotationFS> textsMatched = new ArrayList<AnnotationFS>(1);
if (base) {
- for (AbstractTextMarkerCondition condition : conditions) {
+ for (AbstractRutaCondition condition : conditions) {
crowd.beginVisit(condition, null);
EvaluatedCondition eval = condition.eval(annotation, this, stream, crowd);
crowd.endVisit(condition, null);
@@ -460,18 +460,18 @@ public class WildCardRuleElement extends
public void continueOwnMatch(boolean after, AnnotationFS annotation, RuleMatch ruleMatch,
RuleApply ruleApply, ComposedRuleElementMatch containerMatch,
- TextMarkerRuleElement sideStepOrigin, RuleElement entryPoint, TextMarkerStream stream,
+ RutaRuleElement sideStepOrigin, RuleElement entryPoint, RutaStream stream,
InferenceCrowd crowd) {
// won't happen
}
- public Collection<AnnotationFS> getAnchors(TextMarkerStream symbolStream) {
+ public Collection<AnnotationFS> getAnchors(RutaStream symbolStream) {
// shouldn't happen
// really? what about anchoring at start?
return Collections.emptyList();
}
- public int estimateAnchors(TextMarkerStream stream) {
+ public int estimateAnchors(RutaStream stream) {
return Integer.MAX_VALUE;
}