You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2020/05/11 19:03:23 UTC
svn commit: r1877602 - in /uima/ruta/branches/trunk-v3: ./
example-projects/ruta-ep-example-extensions/ ruta-core/
ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/
ruta-core/src/main/java/org/apache/uima/ruta/
ruta-core/src/main/java/org/apache/u...
Author: rec
Date: Mon May 11 19:03:23 2020
New Revision: 1877602
URL: http://svn.apache.org/viewvc?rev=1877602&view=rev
Log:
[UIMA-6231] Reducing memory pressure generated by UIMA Ruta
- Merge changes from master (v2)
Modified:
uima/ruta/branches/trunk-v3/ (props changed)
uima/ruta/branches/trunk-v3/example-projects/ruta-ep-example-extensions/ (props changed)
uima/ruta/branches/trunk-v3/ruta-core/ (props changed)
uima/ruta/branches/trunk-v3/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/ (props changed)
uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/RutaEnvironment.java
uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/expression/RutaExpression.java
uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/rule/EvaluatedCondition.java
uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleMatch.java
uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaMatcher.java
uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/visitor/InferenceCrowd.java
uima/ruta/branches/trunk-v3/ruta-docbook/ (props changed)
uima/ruta/branches/trunk-v3/ruta-eclipse-feature/ (props changed)
uima/ruta/branches/trunk-v3/ruta-eclipse-update-site/ (props changed)
uima/ruta/branches/trunk-v3/ruta-ep-addons/ (props changed)
uima/ruta/branches/trunk-v3/ruta-ep-caseditor/ (props changed)
uima/ruta/branches/trunk-v3/ruta-ep-engine/ (props changed)
uima/ruta/branches/trunk-v3/ruta-ep-ide/ (props changed)
uima/ruta/branches/trunk-v3/ruta-ep-ide-ui/ (props changed)
uima/ruta/branches/trunk-v3/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/ (props changed)
uima/ruta/branches/trunk-v3/ruta-ep-textruler/ (props changed)
uima/ruta/branches/trunk-v3/ruta-parent/ (props changed)
Propchange: uima/ruta/branches/trunk-v3/
------------------------------------------------------------------------------
Merged /uima/ruta/branches/UIMA-6231-memory-pressure:r1877514-1877589
Merged /uima/ruta/trunk:r1807571-1877591
Propchange: uima/ruta/branches/trunk-v3/example-projects/ruta-ep-example-extensions/
------------------------------------------------------------------------------
Merged /uima/ruta/trunk/example-projects/ruta-ep-example-extensions:r1807571-1877591
Propchange: uima/ruta/branches/trunk-v3/ruta-core/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon May 11 19:03:23 2020
@@ -3,3 +3,5 @@ target
.project
.settings
api-change-report
+input
+TypeSystem.xml
Propchange: uima/ruta/branches/trunk-v3/ruta-core/
------------------------------------------------------------------------------
Merged /uima/ruta/trunk/ruta-core:r1807571-1877591
Merged /uima/ruta/branches/UIMA-6231-memory-pressure/ruta-core:r1877514-1877589
Propchange: uima/ruta/branches/trunk-v3/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon May 11 19:03:23 2020
@@ -0,0 +1 @@
+output
Modified: uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/RutaEnvironment.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/RutaEnvironment.java?rev=1877602&r1=1877601&r2=1877602&view=diff
==============================================================================
--- uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/RutaEnvironment.java (original)
+++ uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/RutaEnvironment.java Mon May 11 19:03:23 2020
@@ -188,23 +188,23 @@ public class RutaEnvironment {
super();
this.owner = owner;
- types = new HashMap<String, Type>();
- namespaces = new HashMap<String, String>();
- ambiguousTypeAlias = new HashMap<String, Set<String>>();
- typesystems = new HashSet<String>();
- scripts = new HashSet<String>();
- typeImports = new HashMap<String, List<Alias>>();
- packageImports = new HashMap<String, List<String>>();
- declaredAnnotationTypes = new HashSet<String>();
- wordLists = new HashMap<String, RutaWordList>();
- tables = new HashMap<String, RutaTable>();
- variableValues = new HashMap<String, Object>();
- tempVariableValues = new HashMap<String, Object>();
- variableTypes = new HashMap<String, Class<?>>();
- variableGenericTypes = new HashMap<String, Class<?>>();
+ types = new HashMap<>();
+ namespaces = new HashMap<>();
+ ambiguousTypeAlias = new HashMap<>();
+ typesystems = new HashSet<>();
+ scripts = new HashSet<>();
+ typeImports = new HashMap<>();
+ packageImports = new HashMap<>();
+ declaredAnnotationTypes = new HashSet<>();
+ wordLists = new HashMap<>();
+ tables = new HashMap<>();
+ variableValues = new HashMap<>();
+ tempVariableValues = new HashMap<>();
+ variableTypes = new HashMap<>();
+ variableGenericTypes = new HashMap<>();
macroConditions = new HashMap<>();
macroActions = new HashMap<>();
- availableTypes = new HashMap<String, Class<?>>();
+ availableTypes = new HashMap<>();
availableTypes.put(RutaConstants.RUTA_VARIABLE_ANNOTATION, AnnotationFS.class);
availableTypes.put("INT", Integer.class);
availableTypes.put("STRING", String.class);
@@ -223,7 +223,7 @@ public class RutaEnvironment {
availableTypes.put("FLOATLIST", List.class);
availableTypes.put("STRINGLIST", List.class);
availableTypes.put(RutaConstants.RUTA_VARIABLE_TYPE_LIST, List.class);
- availableListTypes = new HashMap<String, Class<?>>();
+ availableListTypes = new HashMap<>();
availableListTypes.put(RutaConstants.RUTA_VARIABLE_ANNOTATION_LIST, AnnotationFS.class);
availableListTypes.put("BOOLEANLIST", Boolean.class);
availableListTypes.put("INTLIST", Integer.class);
@@ -232,7 +232,7 @@ public class RutaEnvironment {
availableListTypes.put("STRINGLIST", String.class);
availableListTypes.put(RutaConstants.RUTA_VARIABLE_TYPE_LIST, Type.class);
resourcePaths = getResourcePaths();
- initializedVariables = new HashMap<String, Object>();
+ initializedVariables = new HashMap<>();
variableAliases = new HashMap<>();
// Always import BasicTypeSystem
@@ -527,7 +527,7 @@ public class RutaEnvironment {
if (existing != null && !existing.equals(longName)) {
// shortName can now be resolved to "existing" or "longName"
- targets = new HashSet<String>(2);
+ targets = new HashSet<>(2);
targets.add(existing);
targets.add(longName);
@@ -556,7 +556,7 @@ public class RutaEnvironment {
List<Alias> aliases = typeImports.get(key);
if (aliases == null) {
- aliases = new ArrayList<Alias>();
+ aliases = new ArrayList<>();
typeImports.put(key, aliases);
}
@@ -635,7 +635,7 @@ public class RutaEnvironment {
public void importPackage(String packageName, String alias) {
List<String> aliases = packageImports.get(packageName);
if (aliases == null) {
- aliases = new ArrayList<String>(1);
+ aliases = new ArrayList<>(1);
packageImports.put(packageName, aliases);
}
@@ -753,7 +753,7 @@ public class RutaEnvironment {
Object init = initializedVariables.get(name);
if (init != null) {
if (init instanceof List) {
- ArrayList<Object> list = new ArrayList<Object>();
+ ArrayList<Object> list = new ArrayList<>();
list.addAll((Collection<? extends Object>) init);
return list;
}
@@ -772,7 +772,7 @@ public class RutaEnvironment {
} else if (Type.class.equals(type)) {
return null;
} else if (List.class.equals(type)) {
- return new ArrayList<Object>();
+ return new ArrayList<>();
}
return null;
}
@@ -964,7 +964,7 @@ public class RutaEnvironment {
public void setInitialVariableValue(String var, Object value) {
if (ownsVariable(var)) {
if (value instanceof List) {
- List<Object> initValue = new ArrayList<Object>();
+ List<Object> initValue = new ArrayList<>();
initValue.addAll((Collection<? extends Object>) value);
initializedVariables.put(var, initValue);
} else {
@@ -1057,16 +1057,12 @@ public class RutaEnvironment {
public void addMacroAction(String name, Map<String, String> def, Set<String> vars,
List<AbstractRutaAction> actions) {
- macroActions.put(name,
- new ImmutableTriple<Map<String, String>, List<AbstractRutaAction>, Set<String>>(def,
- actions, vars));
+ macroActions.put(name, new ImmutableTriple<>(def, actions, vars));
}
public void addMacroCondition(String name, Map<String, String> def, Set<String> vars,
List<AbstractRutaCondition> conditions) {
- macroConditions.put(name,
- new ImmutableTriple<Map<String, String>, List<AbstractRutaCondition>, Set<String>>(def,
- conditions, vars));
+ macroConditions.put(name, new ImmutableTriple<>(def, conditions, vars));
}
public boolean isMacroAction(String name) {
Modified: uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/expression/RutaExpression.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/expression/RutaExpression.java?rev=1877602&r1=1877601&r2=1877602&view=diff
==============================================================================
--- uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/expression/RutaExpression.java (original)
+++ uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/expression/RutaExpression.java Mon May 11 19:03:23 2020
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,7 +19,8 @@
package org.apache.uima.ruta.expression;
-import java.util.ArrayList;
+import static java.util.Arrays.asList;
+
import java.util.Collections;
import java.util.List;
@@ -45,9 +46,7 @@ public class RutaExpression extends Ruta
IAnnotationListExpression annotationListExpression = sfe.getMatchReference()
.getAnnotationListExpression(context, stream);
if (annotationExpression != null) {
- List<AnnotationFS> as = new ArrayList<>(1);
- as.add(annotationExpression.getAnnotation(context, stream));
- return as;
+ return asList(annotationExpression.getAnnotation(context, stream));
} else if (annotationListExpression != null) {
return annotationListExpression.getAnnotationList(context, stream);
}
@@ -65,19 +64,15 @@ public class RutaExpression extends Ruta
AnnotationFS documentAnnotation = stream.getCas().getDocumentAnnotation();
Type docType = documentAnnotation.getType();
if (docType.equals(type)) {
- List<AnnotationFS> result = new ArrayList<AnnotationFS>(1);
AnnotationFS windowAnnotation = stream.getFilter().getWindowAnnotation();
+
if (windowAnnotation == null) {
- result.add(documentAnnotation);
- return result;
- } else {
- result.add(windowAnnotation);
- return result;
+ return asList(documentAnnotation);
}
+
+ return asList(windowAnnotation);
}
return stream.getBestGuessedAnnotationsAt(matchedAnnotation, type);
-
}
-
}
Modified: uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/rule/EvaluatedCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/rule/EvaluatedCondition.java?rev=1877602&r1=1877601&r2=1877602&view=diff
==============================================================================
--- uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/rule/EvaluatedCondition.java (original)
+++ uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/rule/EvaluatedCondition.java Mon May 11 19:03:23 2020
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,7 +19,9 @@
package org.apache.uima.ruta.rule;
-import java.util.ArrayList;
+import static java.util.Arrays.asList;
+import static java.util.Collections.emptyList;
+
import java.util.List;
import org.apache.uima.ruta.condition.AbstractRutaCondition;
@@ -33,8 +35,6 @@ public class EvaluatedCondition {
private final List<EvaluatedCondition> conditions;
- private final List<EvaluatedCondition> noConditions = new ArrayList<EvaluatedCondition>(0);
-
public EvaluatedCondition(AbstractRutaCondition condition, boolean value,
List<EvaluatedCondition> conditions) {
super();
@@ -47,15 +47,14 @@ public class EvaluatedCondition {
super();
this.condition = condition;
this.value = value;
- this.conditions = noConditions;
+ conditions = emptyList();
}
public EvaluatedCondition(NotCondition condition, boolean value, EvaluatedCondition eval) {
super();
this.condition = condition;
this.value = value;
- this.conditions = new ArrayList<EvaluatedCondition>();
- conditions.add(eval);
+ conditions = asList(eval);
}
public AbstractRutaCondition getCondition() {
@@ -69,5 +68,4 @@ public class EvaluatedCondition {
public List<EvaluatedCondition> getConditions() {
return conditions;
}
-
}
Modified: uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleMatch.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleMatch.java?rev=1877602&r1=1877601&r2=1877602&view=diff
==============================================================================
--- uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleMatch.java (original)
+++ uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/rule/RuleMatch.java Mon May 11 19:03:23 2020
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,7 +19,10 @@
package org.apache.uima.ruta.rule;
+import static java.util.Arrays.asList;
+
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -44,7 +47,7 @@ public class RuleMatch extends AbstractR
public RuleMatch(RutaRule rule) {
super(rule);
- delegateApply = new HashMap<RutaElement, ScriptApply>(0);
+ delegateApply = new HashMap<>(0);
}
@Override
@@ -94,7 +97,7 @@ public class RuleMatch extends AbstractR
public List<AnnotationFS> getMatchedAnnotations(List<Integer> indexes,
RuleElementContainer container) {
- List<AnnotationFS> result = new ArrayList<AnnotationFS>();
+ List<AnnotationFS> result = new ArrayList<>();
indexes = extendIndexes(indexes);
if (container == null) {
container = rule.getRoot();
@@ -103,7 +106,7 @@ public class RuleMatch extends AbstractR
// TODO refactor this!
if (indexes == null) {
List<RuleElement> ruleElements = container.getRuleElements();
- indexes = new ArrayList<Integer>();
+ indexes = new ArrayList<>();
for (RuleElement ruleElement : ruleElements) {
indexes.add(ruleElements.indexOf(ruleElement) + 1);
}
@@ -130,7 +133,7 @@ public class RuleMatch extends AbstractR
}
// TODO rethink the reverse
- List<List<List<RuleElementMatch>>> reverseList = new ArrayList<List<List<RuleElementMatch>>>();
+ List<List<List<RuleElementMatch>>> reverseList = new ArrayList<>();
for (Integer index : indexes) {
if (index > container.getRuleElements().size()) {
continue;
@@ -155,7 +158,7 @@ public class RuleMatch extends AbstractR
boolean mergingRequired = list.size() > 1;
for (List<RuleElementMatch> list2 : list) {
if (list2 != null) {
- if(list2.size()>1) {
+ if (list2.size() > 1) {
mergingRequired = true;
}
if (list2.size() == 1 && !mergingRequired) {
@@ -167,7 +170,7 @@ public class RuleMatch extends AbstractR
mergingRequired = true;
}
}
- if(mergingRequired) {
+ if (mergingRequired) {
for (RuleElementMatch ruleElementMatch : list2) {
List<AnnotationFS> textsMatched = ruleElementMatch.getTextsMatched();
if (textsMatched != null && !textsMatched.isEmpty()) {
@@ -239,7 +242,7 @@ public class RuleMatch extends AbstractR
if (indexes == null || indexes.size() <= 1) {
return indexes;
}
- List<Integer> result = new ArrayList<Integer>();
+ List<Integer> result = new ArrayList<>();
int pointer = indexes.get(0);
for (Integer each : indexes) {
while (pointer < each - 1) {
@@ -281,8 +284,7 @@ public class RuleMatch extends AbstractR
copy.setRootMatch(rootMatch.copy2(extendedContainerMatch, after));
}
- Map<RutaElement, ScriptApply> newDelegateApply = new HashMap<RutaElement, ScriptApply>(
- delegateApply);
+ Map<RutaElement, ScriptApply> newDelegateApply = new HashMap<>(delegateApply);
copy.setDelegateApply(newDelegateApply);
return copy;
}
@@ -291,8 +293,7 @@ public class RuleMatch extends AbstractR
RuleMatch copy = new RuleMatch(rule);
copy.setMatched(matched);
copy.setRootMatch(rootMatch.copy());
- Map<RutaElement, ScriptApply> newDelegateApply = new HashMap<RutaElement, ScriptApply>(
- delegateApply);
+ Map<RutaElement, ScriptApply> newDelegateApply = new HashMap<>(delegateApply);
copy.setDelegateApply(newDelegateApply);
return copy;
}
@@ -331,29 +332,28 @@ public class RuleMatch extends AbstractR
public List<List<RuleElementMatch>> getMatchInfo(RuleElementMatch rootMatch,
RuleElement element) {
- List<List<RuleElementMatch>> result = new ArrayList<List<RuleElementMatch>>();
- RuleElement root = rootMatch.getRuleElement();
- if (element.equals(root)) {
- List<RuleElementMatch> list = new ArrayList<RuleElementMatch>(1);
- list.add(rootMatch);
- result.add(list);
- } else if (rootMatch instanceof ComposedRuleElementMatch) {
+ if (element.equals(rootMatch.getRuleElement())) {
+ return asList(asList(rootMatch));
+ }
+
+ if (rootMatch instanceof ComposedRuleElementMatch) {
+ List<List<RuleElementMatch>> result = new ArrayList<>();
ComposedRuleElementMatch crem = (ComposedRuleElementMatch) rootMatch;
Set<Entry<RuleElement, List<RuleElementMatch>>> entrySet = crem.getInnerMatches().entrySet();
for (Entry<RuleElement, List<RuleElementMatch>> entry : entrySet) {
List<RuleElementMatch> value = entry.getValue();
if (element.equals(entry.getKey())) {
result.add(value);
- } else {
- if (value != null) {
- for (RuleElementMatch eachMatch : value) {
- result.addAll(getMatchInfo(eachMatch, element));
- }
+ } else if (value != null) {
+ for (RuleElementMatch eachMatch : value) {
+ result.addAll(getMatchInfo(eachMatch, element));
}
}
}
+ return result;
}
- return result;
+
+ return Collections.emptyList();
}
public RuleElementMatch getLastMatch(RuleElement ruleElement, boolean direction) {
Modified: uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaMatcher.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaMatcher.java?rev=1877602&r1=1877601&r2=1877602&view=diff
==============================================================================
--- uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaMatcher.java (original)
+++ uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaMatcher.java Mon May 11 19:03:23 2020
@@ -29,6 +29,10 @@ import org.apache.uima.ruta.expression.I
public interface RutaMatcher {
+ /**
+ * @return a collection containing the matching annotations. Note that there is no
+ * guarantee that the returned collection is modifiable.
+ */
Collection<? extends AnnotationFS> getMatchingAnnotations(RutaBlock parent, RutaStream stream);
Type getType(RutaBlock parent, RutaStream stream);
@@ -37,9 +41,17 @@ public interface RutaMatcher {
long estimateAnchors(RutaBlock parent, RutaStream stream);
+ /**
+ * @return a collection containing the matching annotations. Note that there is no
+ * guarantee that the returned collection is modifiable.
+ */
Collection<? extends AnnotationFS> getAnnotationsAfter(RutaRuleElement ruleElement,
AnnotationFS annotation, RutaBlock parent, RutaStream stream);
+ /**
+ * @return a collection containing the matching annotations. Note that there is no
+ * guarantee that the returned collection is modifiable.
+ */
Collection<? extends AnnotationFS> getAnnotationsBefore(RutaRuleElement ruleElement,
AnnotationFS annotation, RutaBlock parent, RutaStream stream);
Modified: uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/visitor/InferenceCrowd.java
URL: http://svn.apache.org/viewvc/uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/visitor/InferenceCrowd.java?rev=1877602&r1=1877601&r2=1877602&view=diff
==============================================================================
--- uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/visitor/InferenceCrowd.java (original)
+++ uima/ruta/branches/trunk-v3/ruta-core/src/main/java/org/apache/uima/ruta/visitor/InferenceCrowd.java Mon May 11 19:03:23 2020
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,6 +19,8 @@
package org.apache.uima.ruta.visitor;
+import static java.util.Arrays.asList;
+
import java.util.Collections;
import java.util.List;
@@ -31,13 +33,14 @@ import org.apache.uima.ruta.rule.Abstrac
public class InferenceCrowd implements RutaInferenceVisitor {
- public static InferenceCrowd emptyCrowd = new InferenceCrowd(Collections.<RutaInferenceVisitor>emptyList());
-
- private final List<RutaInferenceVisitor> visitors;
+ public static InferenceCrowd emptyCrowd = new InferenceCrowd(
+ Collections.<RutaInferenceVisitor> emptyList());
+
+ private final RutaInferenceVisitor[] visitors;
public InferenceCrowd(List<RutaInferenceVisitor> visitors) {
super();
- this.visitors = visitors;
+ this.visitors = visitors.toArray(new RutaInferenceVisitor[visitors.size()]);
}
@Override
@@ -55,8 +58,9 @@ public class InferenceCrowd implements R
}
public void finished(RutaStream stream) {
+ List<RutaInferenceVisitor> visitorList = asList(visitors);
for (RutaInferenceVisitor each : visitors) {
- each.finished(stream, visitors);
+ each.finished(stream, visitorList);
}
}
@@ -68,13 +72,8 @@ public class InferenceCrowd implements R
@Override
public void annotationAdded(AnnotationFS annotation,
AbstractRuleMatch<? extends AbstractRule> creator) {
- if (visitors.isEmpty()) {
- return;
- }
for (RutaInferenceVisitor each : visitors) {
each.annotationAdded(annotation, creator);
}
-
}
-
}
Propchange: uima/ruta/branches/trunk-v3/ruta-docbook/
------------------------------------------------------------------------------
Merged /uima/ruta/trunk/ruta-docbook:r1807571-1877591
Propchange: uima/ruta/branches/trunk-v3/ruta-eclipse-feature/
------------------------------------------------------------------------------
Merged /uima/ruta/trunk/ruta-eclipse-feature:r1807571-1877591
Propchange: uima/ruta/branches/trunk-v3/ruta-eclipse-update-site/
------------------------------------------------------------------------------
Merged /uima/ruta/trunk/ruta-eclipse-update-site:r1807571-1877591
Propchange: uima/ruta/branches/trunk-v3/ruta-ep-addons/
------------------------------------------------------------------------------
Merged /uima/ruta/trunk/ruta-ep-addons:r1807571-1877591
Propchange: uima/ruta/branches/trunk-v3/ruta-ep-caseditor/
------------------------------------------------------------------------------
Merged /uima/ruta/trunk/ruta-ep-caseditor:r1807571-1877591
Propchange: uima/ruta/branches/trunk-v3/ruta-ep-engine/
------------------------------------------------------------------------------
Merged /uima/ruta/trunk/ruta-ep-engine:r1807571-1877591
Propchange: uima/ruta/branches/trunk-v3/ruta-ep-ide/
------------------------------------------------------------------------------
Merged /uima/ruta/trunk/ruta-ep-ide:r1807571-1877591
Propchange: uima/ruta/branches/trunk-v3/ruta-ep-ide-ui/
------------------------------------------------------------------------------
Merged /uima/ruta/trunk/ruta-ep-ide-ui:r1807571-1877591
Propchange: uima/ruta/branches/trunk-v3/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon May 11 19:03:23 2020
@@ -0,0 +1 @@
+output
Propchange: uima/ruta/branches/trunk-v3/ruta-ep-textruler/
------------------------------------------------------------------------------
Merged /uima/ruta/trunk/ruta-ep-textruler:r1807571-1877591
Propchange: uima/ruta/branches/trunk-v3/ruta-parent/
------------------------------------------------------------------------------
Merged /uima/ruta/trunk/ruta-parent:r1807571-1877591