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:48:18 UTC
svn commit: r1477075 - in
/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor:
CreatedByVisitor.java DebugInfoCollectorVisitor.java DebugInfoFactory.java
InferenceCrowd.java StatisticsVisitor.java TimeProfilerVisitor.java
Author: pkluegl
Date: Mon Apr 29 13:48:17 2013
New Revision: 1477075
URL: http://svn.apache.org/r1477075
Log:
UIMA-2850
- renaming
Modified:
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/CreatedByVisitor.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/DebugInfoCollectorVisitor.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/DebugInfoFactory.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/InferenceCrowd.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/StatisticsVisitor.java
uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/TimeProfilerVisitor.java
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/CreatedByVisitor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/CreatedByVisitor.java?rev=1477075&r1=1477074&r2=1477075&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/CreatedByVisitor.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/CreatedByVisitor.java Mon Apr 29 13:48:17 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.visitor;
+package org.apache.uima.ruta.visitor;
import java.util.ArrayList;
import java.util.List;
@@ -27,16 +27,16 @@ import org.apache.uima.cas.Feature;
import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.textmarker.ScriptApply;
-import org.apache.uima.textmarker.TextMarkerElement;
-import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.rule.AbstractRule;
-import org.apache.uima.textmarker.rule.AbstractRuleMatch;
-import org.apache.uima.textmarker.verbalize.TextMarkerVerbalizer;
+import org.apache.uima.ruta.ScriptApply;
+import org.apache.uima.ruta.RutaElement;
+import org.apache.uima.ruta.RutaStream;
+import org.apache.uima.ruta.rule.AbstractRule;
+import org.apache.uima.ruta.rule.AbstractRuleMatch;
+import org.apache.uima.ruta.verbalize.RutaVerbalizer;
-public class CreatedByVisitor implements TextMarkerInferenceVisitor {
+public class CreatedByVisitor implements RutaInferenceVisitor {
- public static final String TYPE = "org.apache.uima.textmarker.type.DebugCreatedBy";
+ public static final String TYPE = "org.apache.uima.ruta.type.DebugCreatedBy";
public static final String FEATURE_RULE = "rule";
@@ -48,20 +48,20 @@ public class CreatedByVisitor implements
private List<FeatureStructure> fsList = new ArrayList<FeatureStructure>();
- private TextMarkerVerbalizer verbalizer;
+ private RutaVerbalizer verbalizer;
- public CreatedByVisitor(TextMarkerVerbalizer verbalizer) {
+ public CreatedByVisitor(RutaVerbalizer verbalizer) {
super();
this.verbalizer = verbalizer;
}
- public void beginVisit(TextMarkerElement element, ScriptApply result) {
+ public void beginVisit(RutaElement element, ScriptApply result) {
}
- public void endVisit(TextMarkerElement element, ScriptApply result) {
+ public void endVisit(RutaElement element, ScriptApply result) {
}
- public void finished(TextMarkerStream stream, List<TextMarkerInferenceVisitor> visitors) {
+ public void finished(RutaStream stream, List<RutaInferenceVisitor> visitors) {
for (FeatureStructure each : fsList) {
each.getCAS().addFsToIndexes(each);
}
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/DebugInfoCollectorVisitor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/DebugInfoCollectorVisitor.java?rev=1477075&r1=1477074&r2=1477075&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/DebugInfoCollectorVisitor.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/DebugInfoCollectorVisitor.java Mon Apr 29 13:48:17 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.visitor;
+package org.apache.uima.ruta.visitor;
import java.util.ArrayList;
import java.util.HashMap;
@@ -26,22 +26,22 @@ import java.util.Map;
import java.util.Stack;
import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.textmarker.BlockApply;
-import org.apache.uima.textmarker.ScriptApply;
-import org.apache.uima.textmarker.TextMarkerBlock;
-import org.apache.uima.textmarker.TextMarkerElement;
-import org.apache.uima.textmarker.TextMarkerModule;
-import org.apache.uima.textmarker.TextMarkerStatement;
-import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.rule.AbstractRule;
-import org.apache.uima.textmarker.rule.AbstractRuleMatch;
-import org.apache.uima.textmarker.rule.RuleApply;
-import org.apache.uima.textmarker.rule.TextMarkerRule;
-import org.apache.uima.textmarker.type.DebugScriptApply;
-import org.apache.uima.textmarker.verbalize.TextMarkerVerbalizer;
+import org.apache.uima.ruta.BlockApply;
+import org.apache.uima.ruta.ScriptApply;
+import org.apache.uima.ruta.RutaBlock;
+import org.apache.uima.ruta.RutaElement;
+import org.apache.uima.ruta.RutaModule;
+import org.apache.uima.ruta.RutaStatement;
+import org.apache.uima.ruta.RutaStream;
+import org.apache.uima.ruta.rule.AbstractRule;
+import org.apache.uima.ruta.rule.AbstractRuleMatch;
+import org.apache.uima.ruta.rule.RuleApply;
+import org.apache.uima.ruta.rule.RutaRule;
+import org.apache.uima.ruta.type.DebugScriptApply;
+import org.apache.uima.ruta.verbalize.RutaVerbalizer;
-public class DebugInfoCollectorVisitor implements TextMarkerInferenceVisitor {
+public class DebugInfoCollectorVisitor implements RutaInferenceVisitor {
private boolean createDebugInfo;
@@ -53,20 +53,20 @@ public class DebugInfoCollectorVisitor i
private ScriptApply rootApply;
- private Map<TextMarkerStatement, Stack<ScriptApply>> applies;
+ private Map<RutaStatement, Stack<ScriptApply>> applies;
- private Stack<TextMarkerElement> callStack;
+ private Stack<RutaElement> callStack;
public DebugInfoCollectorVisitor(boolean createDebugInfo, boolean withMatches, List<String> ids,
- TextMarkerVerbalizer verbalizer) {
+ RutaVerbalizer verbalizer) {
super();
this.createDebugInfo = createDebugInfo;
this.withMatches = withMatches;
this.ids = ids;
debugFactory = new DebugInfoFactory(verbalizer);
- applies = new HashMap<TextMarkerStatement, Stack<ScriptApply>>();
- callStack = new Stack<TextMarkerElement>();
+ applies = new HashMap<RutaStatement, Stack<ScriptApply>>();
+ callStack = new Stack<RutaElement>();
}
public DebugInfoCollectorVisitor(boolean createDebugInfo) {
@@ -79,14 +79,14 @@ public class DebugInfoCollectorVisitor i
return createDebugInfo;
}
- public boolean createDebugInfo(TextMarkerRule rule) {
+ public boolean createDebugInfo(RutaRule rule) {
return createDebugInfo || ids.contains("" + rule.getId());
}
- public void beginVisit(TextMarkerElement element, ScriptApply result) {
- if (element instanceof TextMarkerStatement) {
+ public void beginVisit(RutaElement element, ScriptApply result) {
+ if (element instanceof RutaStatement) {
callStack.push(element);
- TextMarkerStatement stmt = (TextMarkerStatement) element;
+ RutaStatement stmt = (RutaStatement) element;
Stack<ScriptApply> stack = applies.get(stmt);
if (stack == null) {
stack = new Stack<ScriptApply>();
@@ -101,11 +101,11 @@ public class DebugInfoCollectorVisitor i
}
}
- public void endVisit(TextMarkerElement element, ScriptApply result) {
+ public void endVisit(RutaElement element, ScriptApply result) {
// TODO create UIMA stuff here not later -> save memory!
- if (element instanceof TextMarkerStatement) {
- TextMarkerStatement stmt = (TextMarkerStatement) element;
- TextMarkerBlock parent = stmt.getParent();
+ if (element instanceof RutaStatement) {
+ RutaStatement stmt = (RutaStatement) element;
+ RutaBlock parent = stmt.getParent();
Stack<ScriptApply> stack = applies.get(stmt);
if (stack == null) {
stack = new Stack<ScriptApply>();
@@ -123,7 +123,7 @@ public class DebugInfoCollectorVisitor i
ScriptApply parentApply = parentStack.peek();
if (parentApply instanceof BlockApply) {
BlockApply blockApply = (BlockApply) parentApply;
- if (element instanceof TextMarkerRule && parent.getRule().equals(element)
+ if (element instanceof RutaRule && parent.getRule().equals(element)
&& result instanceof RuleApply) {
blockApply.setRuleApply((RuleApply) result);
@@ -134,7 +134,7 @@ public class DebugInfoCollectorVisitor i
} else if (stack.size() == 1) {
if (callStack.size() > 1) {
// TODO hotfixed
- TextMarkerElement tme = callStack.get(callStack.size() - 2);
+ RutaElement tme = callStack.get(callStack.size() - 2);
if (tme.equals(parent)
// || tme.equals(element)
) {
@@ -148,7 +148,7 @@ public class DebugInfoCollectorVisitor i
}
} else {
// TODO refactor !!! ... really!!!!
- TextMarkerElement tme = callStack.get(callStack.size() - 2);
+ RutaElement tme = callStack.get(callStack.size() - 2);
if (tme.equals(parent)
// || tme.equals(element)
) {
@@ -163,14 +163,14 @@ public class DebugInfoCollectorVisitor i
stack.pop();
callStack.pop();
}
- if (element instanceof TextMarkerModule) {
+ if (element instanceof RutaModule) {
rootApply = result;
}
}
- public void finished(TextMarkerStream stream, List<TextMarkerInferenceVisitor> visitors) {
+ public void finished(RutaStream stream, List<RutaInferenceVisitor> visitors) {
if (createDebugInfo) {
- Map<TextMarkerElement, Long> timeInfo = getTimeInfo(visitors);
+ Map<RutaElement, Long> timeInfo = getTimeInfo(visitors);
DebugScriptApply debugScriptApply = debugFactory.createDebugScriptApply(rootApply, stream,
false, withMatches, timeInfo);
@@ -178,8 +178,8 @@ public class DebugInfoCollectorVisitor i
}
}
- private Map<TextMarkerElement, Long> getTimeInfo(List<TextMarkerInferenceVisitor> visitors) {
- for (TextMarkerInferenceVisitor each : visitors) {
+ private Map<RutaElement, Long> getTimeInfo(List<RutaInferenceVisitor> visitors) {
+ for (RutaInferenceVisitor each : visitors) {
if (each instanceof TimeProfilerVisitor) {
return ((TimeProfilerVisitor) each).getTimeInfo();
}
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/DebugInfoFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/DebugInfoFactory.java?rev=1477075&r1=1477074&r2=1477075&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/DebugInfoFactory.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/DebugInfoFactory.java Mon Apr 29 13:48:17 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.visitor;
+package org.apache.uima.ruta.visitor;
import java.util.ArrayList;
import java.util.List;
@@ -28,59 +28,59 @@ import java.util.Set;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.cas.FSArray;
-import org.apache.uima.textmarker.BlockApply;
-import org.apache.uima.textmarker.ScriptApply;
-import org.apache.uima.textmarker.TextMarkerBlock;
-import org.apache.uima.textmarker.TextMarkerElement;
-import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.rule.AbstractRule;
-import org.apache.uima.textmarker.rule.AbstractRuleMatch;
-import org.apache.uima.textmarker.rule.ComposedRuleElement;
-import org.apache.uima.textmarker.rule.ComposedRuleElementMatch;
-import org.apache.uima.textmarker.rule.EvaluatedCondition;
-import org.apache.uima.textmarker.rule.RegExpRule;
-import org.apache.uima.textmarker.rule.RegExpRuleMatch;
-import org.apache.uima.textmarker.rule.RuleApply;
-import org.apache.uima.textmarker.rule.RuleElement;
-import org.apache.uima.textmarker.rule.RuleElementMatch;
-import org.apache.uima.textmarker.rule.RuleMatch;
-import org.apache.uima.textmarker.rule.TextMarkerRule;
-import org.apache.uima.textmarker.rule.TextMarkerRuleElement;
-import org.apache.uima.textmarker.type.DebugBlockApply;
-import org.apache.uima.textmarker.type.DebugEvaluatedCondition;
-import org.apache.uima.textmarker.type.DebugFailedRuleMatch;
-import org.apache.uima.textmarker.type.DebugMatchedRuleMatch;
-import org.apache.uima.textmarker.type.DebugRuleApply;
-import org.apache.uima.textmarker.type.DebugRuleElementMatch;
-import org.apache.uima.textmarker.type.DebugRuleElementMatches;
-import org.apache.uima.textmarker.type.DebugRuleMatch;
-import org.apache.uima.textmarker.type.DebugScriptApply;
-import org.apache.uima.textmarker.utils.UIMAUtils;
-import org.apache.uima.textmarker.verbalize.TextMarkerVerbalizer;
+import org.apache.uima.ruta.BlockApply;
+import org.apache.uima.ruta.ScriptApply;
+import org.apache.uima.ruta.RutaBlock;
+import org.apache.uima.ruta.RutaElement;
+import org.apache.uima.ruta.RutaStream;
+import org.apache.uima.ruta.rule.AbstractRule;
+import org.apache.uima.ruta.rule.AbstractRuleMatch;
+import org.apache.uima.ruta.rule.ComposedRuleElement;
+import org.apache.uima.ruta.rule.ComposedRuleElementMatch;
+import org.apache.uima.ruta.rule.EvaluatedCondition;
+import org.apache.uima.ruta.rule.RegExpRule;
+import org.apache.uima.ruta.rule.RegExpRuleMatch;
+import org.apache.uima.ruta.rule.RuleApply;
+import org.apache.uima.ruta.rule.RuleElement;
+import org.apache.uima.ruta.rule.RuleElementMatch;
+import org.apache.uima.ruta.rule.RuleMatch;
+import org.apache.uima.ruta.rule.RutaRule;
+import org.apache.uima.ruta.rule.RutaRuleElement;
+import org.apache.uima.ruta.type.DebugBlockApply;
+import org.apache.uima.ruta.type.DebugEvaluatedCondition;
+import org.apache.uima.ruta.type.DebugFailedRuleMatch;
+import org.apache.uima.ruta.type.DebugMatchedRuleMatch;
+import org.apache.uima.ruta.type.DebugRuleApply;
+import org.apache.uima.ruta.type.DebugRuleElementMatch;
+import org.apache.uima.ruta.type.DebugRuleElementMatches;
+import org.apache.uima.ruta.type.DebugRuleMatch;
+import org.apache.uima.ruta.type.DebugScriptApply;
+import org.apache.uima.ruta.utils.UIMAUtils;
+import org.apache.uima.ruta.verbalize.RutaVerbalizer;
public class DebugInfoFactory {
- private TextMarkerVerbalizer verbalizer;
+ private RutaVerbalizer verbalizer;
- public DebugInfoFactory(TextMarkerVerbalizer verbalizer) {
+ public DebugInfoFactory(RutaVerbalizer verbalizer) {
super();
this.verbalizer = verbalizer;
}
- public DebugBlockApply createDummyBlockApply(RuleMatch ruleMatch, TextMarkerStream stream,
- boolean addToIndex, boolean withMatches, Map<TextMarkerElement, Long> timeInfo) {
+ public DebugBlockApply createDummyBlockApply(RuleMatch ruleMatch, RutaStream stream,
+ boolean addToIndex, boolean withMatches, Map<RutaElement, Long> timeInfo) {
JCas cas = stream.getJCas();
DebugBlockApply dba = new DebugBlockApply(cas);
AnnotationFS matchedAnnotation = ruleMatch.getMatchedAnnotationsOf(
- ((TextMarkerRule) ruleMatch.getRule()).getRoot(), stream).get(0);
+ ((RutaRule) ruleMatch.getRule()).getRoot(), stream).get(0);
dba.setElement(matchedAnnotation.getCoveredText());
dba.setBegin(matchedAnnotation.getBegin());
dba.setEnd(matchedAnnotation.getEnd());
return dba;
}
- public DebugBlockApply createDebugBlockApply(BlockApply blockApply, TextMarkerStream stream,
- boolean addToIndex, boolean withMatches, Map<TextMarkerElement, Long> timeInfo) {
+ public DebugBlockApply createDebugBlockApply(BlockApply blockApply, RutaStream stream,
+ boolean addToIndex, boolean withMatches, Map<RutaElement, Long> timeInfo) {
JCas cas = stream.getJCas();
DebugBlockApply dba = new DebugBlockApply(cas);
List<DebugScriptApply> innerApply = new ArrayList<DebugScriptApply>();
@@ -122,7 +122,7 @@ public class DebugInfoFactory {
counter++;
}
dba.setInnerApply(UIMAUtils.toFSArray(cas, innerApply));
- dba.setElement(verbalizer.verbalize((TextMarkerBlock) blockApply.getElement(), false));
+ dba.setElement(verbalizer.verbalize((RutaBlock) blockApply.getElement(), false));
DebugRuleApply ruleApply = createDebugRuleApply(blockApply.getRuleApply(), stream,
addToIndex, withMatches, timeInfo);
dba.setApplied(ruleApply.getApplied());
@@ -143,7 +143,7 @@ public class DebugInfoFactory {
innerApply.add(createDebugScriptApply(each, stream, addToIndex, withMatches, timeInfo));
}
dba.setInnerApply(UIMAUtils.toFSArray(cas, innerApply));
- dba.setElement(verbalizer.verbalize((TextMarkerBlock) blockApply.getElement(), false));
+ dba.setElement(verbalizer.verbalize((RutaBlock) blockApply.getElement(), false));
DebugRuleApply ruleApply = createDebugRuleApply(blockApply.getRuleApply(), stream,
addToIndex, withMatches, timeInfo);
dba.setApplied(ruleApply.getApplied());
@@ -161,8 +161,8 @@ public class DebugInfoFactory {
}
}
- public DebugRuleApply createDebugRuleApply(RuleApply ruleApply, TextMarkerStream stream,
- boolean addToIndex, boolean withMatches, Map<TextMarkerElement, Long> timeInfo) {
+ public DebugRuleApply createDebugRuleApply(RuleApply ruleApply, RutaStream stream,
+ boolean addToIndex, boolean withMatches, Map<RutaElement, Long> timeInfo) {
JCas cas = stream.getJCas();
DebugRuleApply dra = new DebugRuleApply(cas);
List<DebugRuleMatch> ruleMatches = new ArrayList<DebugRuleMatch>();
@@ -197,8 +197,8 @@ public class DebugInfoFactory {
return dra;
}
- public DebugRuleMatch createDebugRuleMatch(AbstractRuleMatch<? extends AbstractRule> match, TextMarkerStream stream,
- boolean addToIndex, boolean withMatches, Map<TextMarkerElement, Long> timeInfo) {
+ public DebugRuleMatch createDebugRuleMatch(AbstractRuleMatch<? extends AbstractRule> match, RutaStream stream,
+ boolean addToIndex, boolean withMatches, Map<RutaElement, Long> timeInfo) {
JCas cas = stream.getJCas();
DebugRuleMatch drm = null;
if (match.matchedCompletely()) {
@@ -270,7 +270,7 @@ public class DebugInfoFactory {
return drm;
}
- private void setInnerMatches(TextMarkerStream stream, boolean addToIndex, JCas cas,
+ private void setInnerMatches(RutaStream stream, boolean addToIndex, JCas cas,
DebugRuleMatch drm, ComposedRuleElementMatch rootMatch) {
Set<Entry<RuleElement, List<RuleElementMatch>>> entrySet = rootMatch.getInnerMatches()
.entrySet();
@@ -284,7 +284,7 @@ public class DebugInfoFactory {
drm.setElements(UIMAUtils.toFSArray(cas, ruleElementMatches));
}
- private void setInnerMatches(TextMarkerStream stream, boolean addToIndex, JCas cas,
+ private void setInnerMatches(RutaStream stream, boolean addToIndex, JCas cas,
DebugRuleElementMatch drm, ComposedRuleElementMatch rootMatch) {
Set<Entry<RuleElement, List<RuleElementMatch>>> entrySet = rootMatch.getInnerMatches()
.entrySet();
@@ -298,7 +298,7 @@ public class DebugInfoFactory {
}
public DebugRuleElementMatches createDebugRuleElementMatches(RuleElement re,
- List<RuleElementMatch> rems, TextMarkerStream stream, boolean addToIndex) {
+ List<RuleElementMatch> rems, RutaStream stream, boolean addToIndex) {
JCas cas = stream.getJCas();
DebugRuleElementMatches drems = new DebugRuleElementMatches(cas);
drems.setElement(verbalizer.verbalize(re));
@@ -323,7 +323,7 @@ public class DebugInfoFactory {
}
public DebugRuleElementMatch createDebugComposedRuleElementMatch(ComposedRuleElementMatch rem,
- TextMarkerStream stream, boolean addToIndex) {
+ RutaStream stream, boolean addToIndex) {
JCas cas = stream.getJCas();
DebugRuleElementMatch drem = new DebugRuleElementMatch(cas);
@@ -347,7 +347,7 @@ public class DebugInfoFactory {
}
public DebugRuleElementMatch createDebugRuleElementMatch(RuleElementMatch rem,
- TextMarkerStream stream, boolean addToIndex) {
+ RutaStream stream, boolean addToIndex) {
JCas cas = stream.getJCas();
DebugRuleElementMatch drem = new DebugRuleElementMatch(cas);
@@ -355,8 +355,8 @@ public class DebugInfoFactory {
base.setValue(rem.isBaseConditionMatched());
RuleElement ruleElement = rem.getRuleElement();
String baseString = "";
- if (ruleElement instanceof TextMarkerRuleElement) {
- baseString = verbalizer.verbalizeMatcher((TextMarkerRuleElement) ruleElement);
+ if (ruleElement instanceof RutaRuleElement) {
+ baseString = verbalizer.verbalizeMatcher((RutaRuleElement) ruleElement);
} else if (ruleElement instanceof ComposedRuleElement) {
baseString = verbalizer.verbalizeComposed((ComposedRuleElement) ruleElement);
}
@@ -374,7 +374,7 @@ public class DebugInfoFactory {
return drem;
}
- private FSArray createEvaluatedConditions(RuleElementMatch rem, TextMarkerStream stream,
+ private FSArray createEvaluatedConditions(RuleElementMatch rem, RutaStream stream,
boolean addToIndex) {
JCas cas = stream.getJCas();
List<DebugEvaluatedCondition> ecs = new ArrayList<DebugEvaluatedCondition>();
@@ -391,7 +391,7 @@ public class DebugInfoFactory {
return result;
}
- private FSArray createEvaluatedConditions(EvaluatedCondition eval, TextMarkerStream stream,
+ private FSArray createEvaluatedConditions(EvaluatedCondition eval, RutaStream stream,
boolean addToIndex) {
JCas cas = stream.getJCas();
List<DebugEvaluatedCondition> ecs = new ArrayList<DebugEvaluatedCondition>();
@@ -406,8 +406,8 @@ public class DebugInfoFactory {
return result;
}
- public DebugScriptApply createDebugScriptApply(ScriptApply apply, TextMarkerStream stream,
- boolean addToIndex, boolean withMatches, Map<TextMarkerElement, Long> timeInfo) {
+ public DebugScriptApply createDebugScriptApply(ScriptApply apply, RutaStream stream,
+ boolean addToIndex, boolean withMatches, Map<RutaElement, Long> timeInfo) {
DebugScriptApply debug = null;
if (apply instanceof BlockApply) {
debug = createDebugBlockApply((BlockApply) apply, stream, addToIndex, withMatches, timeInfo);
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/InferenceCrowd.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/InferenceCrowd.java?rev=1477075&r1=1477074&r2=1477075&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/InferenceCrowd.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/InferenceCrowd.java Mon Apr 29 13:48:17 2013
@@ -17,51 +17,51 @@
* under the License.
*/
-package org.apache.uima.textmarker.visitor;
+package org.apache.uima.ruta.visitor;
import java.util.List;
import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.textmarker.ScriptApply;
-import org.apache.uima.textmarker.TextMarkerElement;
-import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.rule.AbstractRule;
-import org.apache.uima.textmarker.rule.AbstractRuleMatch;
+import org.apache.uima.ruta.ScriptApply;
+import org.apache.uima.ruta.RutaElement;
+import org.apache.uima.ruta.RutaStream;
+import org.apache.uima.ruta.rule.AbstractRule;
+import org.apache.uima.ruta.rule.AbstractRuleMatch;
-public class InferenceCrowd implements TextMarkerInferenceVisitor {
+public class InferenceCrowd implements RutaInferenceVisitor {
- private final List<TextMarkerInferenceVisitor> visitors;
+ private final List<RutaInferenceVisitor> visitors;
- public InferenceCrowd(List<TextMarkerInferenceVisitor> visitors) {
+ public InferenceCrowd(List<RutaInferenceVisitor> visitors) {
super();
this.visitors = visitors;
}
- public void beginVisit(TextMarkerElement element, ScriptApply result) {
- for (TextMarkerInferenceVisitor each : visitors) {
+ public void beginVisit(RutaElement element, ScriptApply result) {
+ for (RutaInferenceVisitor each : visitors) {
each.beginVisit(element, result);
}
}
- public void endVisit(TextMarkerElement element, ScriptApply result) {
- for (TextMarkerInferenceVisitor each : visitors) {
+ public void endVisit(RutaElement element, ScriptApply result) {
+ for (RutaInferenceVisitor each : visitors) {
each.endVisit(element, result);
}
}
- public void finished(TextMarkerStream stream) {
- for (TextMarkerInferenceVisitor each : visitors) {
+ public void finished(RutaStream stream) {
+ for (RutaInferenceVisitor each : visitors) {
each.finished(stream, visitors);
}
}
- public void finished(TextMarkerStream stream, List<TextMarkerInferenceVisitor> visitors) {
+ public void finished(RutaStream stream, List<RutaInferenceVisitor> visitors) {
finished(stream);
}
public void annotationAdded(AnnotationFS annotation, AbstractRuleMatch<? extends AbstractRule> creator) {
- for (TextMarkerInferenceVisitor each : visitors) {
+ for (RutaInferenceVisitor each : visitors) {
each.annotationAdded(annotation, creator);
}
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/StatisticsVisitor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/StatisticsVisitor.java?rev=1477075&r1=1477074&r2=1477075&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/StatisticsVisitor.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/StatisticsVisitor.java Mon Apr 29 13:48:17 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.visitor;
+package org.apache.uima.ruta.visitor;
import java.util.ArrayList;
import java.util.HashMap;
@@ -32,18 +32,18 @@ import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.cas.DoubleArray;
import org.apache.uima.jcas.cas.IntegerArray;
import org.apache.uima.jcas.cas.StringArray;
-import org.apache.uima.textmarker.ScriptApply;
-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.AbstractRule;
-import org.apache.uima.textmarker.rule.AbstractRuleMatch;
-import org.apache.uima.textmarker.type.Statistics;
-import org.apache.uima.textmarker.utils.UIMAUtils;
-import org.apache.uima.textmarker.verbalize.TextMarkerVerbalizer;
+import org.apache.uima.ruta.ScriptApply;
+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.AbstractRule;
+import org.apache.uima.ruta.rule.AbstractRuleMatch;
+import org.apache.uima.ruta.type.Statistics;
+import org.apache.uima.ruta.utils.UIMAUtils;
+import org.apache.uima.ruta.verbalize.RutaVerbalizer;
-public class StatisticsVisitor implements TextMarkerInferenceVisitor {
+public class StatisticsVisitor implements RutaInferenceVisitor {
private Map<String, Long> conditionTime;
@@ -57,9 +57,9 @@ public class StatisticsVisitor implement
private Map<String, Long> actionDelta;
- private TextMarkerVerbalizer verbalizer;
+ private RutaVerbalizer verbalizer;
- public StatisticsVisitor(TextMarkerVerbalizer verbalizer) {
+ public StatisticsVisitor(RutaVerbalizer verbalizer) {
super();
this.verbalizer = verbalizer;
conditionTime = new HashMap<String, Long>();
@@ -70,9 +70,9 @@ public class StatisticsVisitor implement
actionDelta = new HashMap<String, Long>();
}
- public void beginVisit(TextMarkerElement element, ScriptApply result) {
- if (element instanceof AbstractTextMarkerCondition) {
- AbstractTextMarkerCondition c = (AbstractTextMarkerCondition) element;
+ public void beginVisit(RutaElement element, ScriptApply result) {
+ if (element instanceof AbstractRutaCondition) {
+ AbstractRutaCondition c = (AbstractRutaCondition) element;
String name = verbalizer.verbalizeName(c);
Integer amount = conditionAmount.get(name);
if (amount == null)
@@ -80,8 +80,8 @@ public class StatisticsVisitor implement
amount++;
conditionAmount.put(name, amount);
conditionDelta.put(name, System.currentTimeMillis());
- } else if (element instanceof AbstractTextMarkerAction) {
- AbstractTextMarkerAction a = (AbstractTextMarkerAction) element;
+ } else if (element instanceof AbstractRutaAction) {
+ AbstractRutaAction a = (AbstractRutaAction) element;
String name = verbalizer.verbalizeName(a);
Integer amount = actionAmount.get(name);
if (amount == null)
@@ -92,9 +92,9 @@ public class StatisticsVisitor implement
}
}
- public void endVisit(TextMarkerElement element, ScriptApply result) {
- if (element instanceof AbstractTextMarkerCondition) {
- AbstractTextMarkerCondition c = (AbstractTextMarkerCondition) element;
+ public void endVisit(RutaElement element, ScriptApply result) {
+ if (element instanceof AbstractRutaCondition) {
+ AbstractRutaCondition c = (AbstractRutaCondition) element;
String name = verbalizer.verbalizeName(c);
Long start = conditionDelta.get(name);
long delta = System.currentTimeMillis() - start;
@@ -103,8 +103,8 @@ public class StatisticsVisitor implement
total = 0L;
total += delta;
conditionTime.put(name, total);
- } else if (element instanceof AbstractTextMarkerAction) {
- AbstractTextMarkerAction a = (AbstractTextMarkerAction) element;
+ } else if (element instanceof AbstractRutaAction) {
+ AbstractRutaAction a = (AbstractRutaAction) element;
String name = verbalizer.verbalizeName(a);
Long start = actionDelta.get(name);
long delta = System.currentTimeMillis() - start;
@@ -116,7 +116,7 @@ public class StatisticsVisitor implement
}
}
- public void finished(TextMarkerStream stream, List<TextMarkerInferenceVisitor> visitors) {
+ public void finished(RutaStream stream, List<RutaInferenceVisitor> visitors) {
List<String> names = new ArrayList<String>();
List<Double> totals = new ArrayList<Double>();
List<Integer> amounts = new ArrayList<Integer>();
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/TimeProfilerVisitor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/TimeProfilerVisitor.java?rev=1477075&r1=1477074&r2=1477075&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/TimeProfilerVisitor.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/visitor/TimeProfilerVisitor.java Mon Apr 29 13:48:17 2013
@@ -17,44 +17,44 @@
* under the License.
*/
-package org.apache.uima.textmarker.visitor;
+package org.apache.uima.ruta.visitor;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.textmarker.ScriptApply;
-import org.apache.uima.textmarker.TextMarkerElement;
-import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.rule.AbstractRule;
-import org.apache.uima.textmarker.rule.AbstractRuleMatch;
+import org.apache.uima.ruta.ScriptApply;
+import org.apache.uima.ruta.RutaElement;
+import org.apache.uima.ruta.RutaStream;
+import org.apache.uima.ruta.rule.AbstractRule;
+import org.apache.uima.ruta.rule.AbstractRuleMatch;
-public class TimeProfilerVisitor implements TextMarkerInferenceVisitor {
+public class TimeProfilerVisitor implements RutaInferenceVisitor {
- private Map<TextMarkerElement, Long> timeInfo;
+ private Map<RutaElement, Long> timeInfo;
public TimeProfilerVisitor() {
super();
- timeInfo = new HashMap<TextMarkerElement, Long>();
+ timeInfo = new HashMap<RutaElement, Long>();
}
- public void beginVisit(TextMarkerElement element, ScriptApply result) {
+ public void beginVisit(RutaElement element, ScriptApply result) {
getTimeInfo().put(element, System.currentTimeMillis());
}
- public void endVisit(TextMarkerElement element, ScriptApply result) {
+ public void endVisit(RutaElement element, ScriptApply result) {
Long start = getTimeInfo().get(element);
long value = System.currentTimeMillis() - start;
getTimeInfo().put(element, value);
}
- public void finished(TextMarkerStream stream, List<TextMarkerInferenceVisitor> visitors) {
+ public void finished(RutaStream stream, List<RutaInferenceVisitor> visitors) {
// others do the work
}
- public Map<TextMarkerElement, Long> getTimeInfo() {
+ public Map<RutaElement, Long> getTimeInfo() {
return timeInfo;
}