Author: pkluegl Date: Mon Apr 29 13:48:03 2013 New Revision: 1477074 URL: http://svn.apache.org/r1477074 Log: UIMA-2850 - renaming
Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ActionVerbalizer.java uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ConditionVerbalizer.java uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ExpressionVerbalizer.java uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ScriptVerbalizer.java uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/VerbalizerUtils.java Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ActionVerbalizer.java URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ActionVerbalizer.java?rev=1477074&r1=1477073&r2=1477074&view=diff ============================================================================== --- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ActionVerbalizer.java (original) +++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ActionVerbalizer.java Mon Apr 29 13:48:03 2013 @@ -17,65 +17,65 @@ * under the License. */ -package org.apache.uima.textmarker.verbalize; +package org.apache.uima.ruta.verbalize; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import org.apache.uima.textmarker.action.AbstractTextMarkerAction; -import org.apache.uima.textmarker.action.AddAction; -import org.apache.uima.textmarker.action.AssignAction; -import org.apache.uima.textmarker.action.CallAction; -import org.apache.uima.textmarker.action.ClearAction; -import org.apache.uima.textmarker.action.ColorAction; -import org.apache.uima.textmarker.action.ConfigureAction; -import org.apache.uima.textmarker.action.CreateAction; -import org.apache.uima.textmarker.action.DelAction; -import org.apache.uima.textmarker.action.DynamicAnchoringAction; -import org.apache.uima.textmarker.action.ExecAction; -import org.apache.uima.textmarker.action.FillAction; -import org.apache.uima.textmarker.action.FilterTypeAction; -import org.apache.uima.textmarker.action.GatherAction; -import org.apache.uima.textmarker.action.GetAction; -import org.apache.uima.textmarker.action.GetFeatureAction; -import org.apache.uima.textmarker.action.GetListAction; -import org.apache.uima.textmarker.action.LogAction; -import org.apache.uima.textmarker.action.MarkAction; -import org.apache.uima.textmarker.action.MarkFastAction; -import org.apache.uima.textmarker.action.MarkLastAction; -import org.apache.uima.textmarker.action.MarkOnceAction; -import org.apache.uima.textmarker.action.MarkTableAction; -import org.apache.uima.textmarker.action.MatchedTextAction; -import org.apache.uima.textmarker.action.MergeAction; -import org.apache.uima.textmarker.action.RemoveAction; -import org.apache.uima.textmarker.action.RemoveDuplicateAction; -import org.apache.uima.textmarker.action.ReplaceAction; -import org.apache.uima.textmarker.action.RetainTypeAction; -import org.apache.uima.textmarker.action.SetFeatureAction; -import org.apache.uima.textmarker.action.ShiftAction; -import org.apache.uima.textmarker.action.TransferAction; -import org.apache.uima.textmarker.action.TrieAction; -import org.apache.uima.textmarker.action.UnmarkAction; -import org.apache.uima.textmarker.action.UnmarkAllAction; -import org.apache.uima.textmarker.expression.TextMarkerExpression; -import org.apache.uima.textmarker.expression.bool.BooleanExpression; -import org.apache.uima.textmarker.expression.list.TypeListExpression; -import org.apache.uima.textmarker.expression.number.NumberExpression; -import org.apache.uima.textmarker.expression.resource.WordTableExpression; -import org.apache.uima.textmarker.expression.string.StringExpression; -import org.apache.uima.textmarker.expression.type.TypeExpression; +import org.apache.uima.ruta.action.AbstractRutaAction; +import org.apache.uima.ruta.action.AddAction; +import org.apache.uima.ruta.action.AssignAction; +import org.apache.uima.ruta.action.CallAction; +import org.apache.uima.ruta.action.ClearAction; +import org.apache.uima.ruta.action.ColorAction; +import org.apache.uima.ruta.action.ConfigureAction; +import org.apache.uima.ruta.action.CreateAction; +import org.apache.uima.ruta.action.DelAction; +import org.apache.uima.ruta.action.DynamicAnchoringAction; +import org.apache.uima.ruta.action.ExecAction; +import org.apache.uima.ruta.action.FillAction; +import org.apache.uima.ruta.action.FilterTypeAction; +import org.apache.uima.ruta.action.GatherAction; +import org.apache.uima.ruta.action.GetAction; +import org.apache.uima.ruta.action.GetFeatureAction; +import org.apache.uima.ruta.action.GetListAction; +import org.apache.uima.ruta.action.LogAction; +import org.apache.uima.ruta.action.MarkAction; +import org.apache.uima.ruta.action.MarkFastAction; +import org.apache.uima.ruta.action.MarkLastAction; +import org.apache.uima.ruta.action.MarkOnceAction; +import org.apache.uima.ruta.action.MarkTableAction; +import org.apache.uima.ruta.action.MatchedTextAction; +import org.apache.uima.ruta.action.MergeAction; +import org.apache.uima.ruta.action.RemoveAction; +import org.apache.uima.ruta.action.RemoveDuplicateAction; +import org.apache.uima.ruta.action.ReplaceAction; +import org.apache.uima.ruta.action.RetainTypeAction; +import org.apache.uima.ruta.action.SetFeatureAction; +import org.apache.uima.ruta.action.ShiftAction; +import org.apache.uima.ruta.action.TransferAction; +import org.apache.uima.ruta.action.TrieAction; +import org.apache.uima.ruta.action.UnmarkAction; +import org.apache.uima.ruta.action.UnmarkAllAction; +import org.apache.uima.ruta.expression.RutaExpression; +import org.apache.uima.ruta.expression.bool.BooleanExpression; +import org.apache.uima.ruta.expression.list.TypeListExpression; +import org.apache.uima.ruta.expression.number.NumberExpression; +import org.apache.uima.ruta.expression.resource.WordTableExpression; +import org.apache.uima.ruta.expression.string.StringExpression; +import org.apache.uima.ruta.expression.type.TypeExpression; public class ActionVerbalizer { - private TextMarkerVerbalizer verbalizer; + private RutaVerbalizer verbalizer; - public ActionVerbalizer(TextMarkerVerbalizer verbalizer) { + public ActionVerbalizer(RutaVerbalizer verbalizer) { super(); this.verbalizer = verbalizer; } - public String verbalizeName(AbstractTextMarkerAction action) { + public String verbalizeName(AbstractRutaAction action) { if (action instanceof AddAction) { return "ADD"; } else if (action instanceof AssignAction) { @@ -157,7 +157,7 @@ public class ActionVerbalizer { return action.getClass().getSimpleName(); } - public String verbalize(AbstractTextMarkerAction action) { + public String verbalize(AbstractRutaAction action) { String name = verbalizeName(action) + "("; if (action instanceof AssignAction) { AssignAction a = (AssignAction) action; @@ -180,7 +180,7 @@ public class ActionVerbalizer { StringBuilder features = new StringBuilder(); if (a.getFeatures() != null) { features.append(", "); - for (Entry<StringExpression, TextMarkerExpression> each : a.getFeatures().entrySet()) { + for (Entry<StringExpression, RutaExpression> each : a.getFeatures().entrySet()) { features.append(verbalizer.verbalize(each.getKey())); features.append(" = "); features.append(verbalizer.verbalize(each.getValue())); Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ConditionVerbalizer.java URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ConditionVerbalizer.java?rev=1477074&r1=1477073&r2=1477074&view=diff ============================================================================== --- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ConditionVerbalizer.java (original) +++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ConditionVerbalizer.java Mon Apr 29 13:48:03 2013 @@ -17,53 +17,53 @@ * under the License. */ -package org.apache.uima.textmarker.verbalize; +package org.apache.uima.ruta.verbalize; import java.util.Iterator; import java.util.List; -import org.apache.uima.textmarker.condition.AbstractTextMarkerCondition; -import org.apache.uima.textmarker.condition.AfterCondition; -import org.apache.uima.textmarker.condition.AndCondition; -import org.apache.uima.textmarker.condition.BeforeCondition; -import org.apache.uima.textmarker.condition.ContainsCondition; -import org.apache.uima.textmarker.condition.ContextCountCondition; -import org.apache.uima.textmarker.condition.CountCondition; -import org.apache.uima.textmarker.condition.CurrentCountCondition; -import org.apache.uima.textmarker.condition.EndsWithCondition; -import org.apache.uima.textmarker.condition.FeatureCondition; -import org.apache.uima.textmarker.condition.IfCondition; -import org.apache.uima.textmarker.condition.InListCondition; -import org.apache.uima.textmarker.condition.IsCondition; -import org.apache.uima.textmarker.condition.LastCondition; -import org.apache.uima.textmarker.condition.MOfNCondition; -import org.apache.uima.textmarker.condition.NearCondition; -import org.apache.uima.textmarker.condition.NotCondition; -import org.apache.uima.textmarker.condition.OrCondition; -import org.apache.uima.textmarker.condition.ParseCondition; -import org.apache.uima.textmarker.condition.PartOfCondition; -import org.apache.uima.textmarker.condition.PartOfNeqCondition; -import org.apache.uima.textmarker.condition.PositionCondition; -import org.apache.uima.textmarker.condition.RegExpCondition; -import org.apache.uima.textmarker.condition.ScoreCondition; -import org.apache.uima.textmarker.condition.SizeCondition; -import org.apache.uima.textmarker.condition.StartsWithCondition; -import org.apache.uima.textmarker.condition.TotalCountCondition; -import org.apache.uima.textmarker.condition.VoteCondition; -import org.apache.uima.textmarker.expression.list.ListExpression; -import org.apache.uima.textmarker.expression.number.NumberExpression; -import org.apache.uima.textmarker.expression.number.SimpleNumberExpression; +import org.apache.uima.ruta.condition.AbstractRutaCondition; +import org.apache.uima.ruta.condition.AfterCondition; +import org.apache.uima.ruta.condition.AndCondition; +import org.apache.uima.ruta.condition.BeforeCondition; +import org.apache.uima.ruta.condition.ContainsCondition; +import org.apache.uima.ruta.condition.ContextCountCondition; +import org.apache.uima.ruta.condition.CountCondition; +import org.apache.uima.ruta.condition.CurrentCountCondition; +import org.apache.uima.ruta.condition.EndsWithCondition; +import org.apache.uima.ruta.condition.FeatureCondition; +import org.apache.uima.ruta.condition.IfCondition; +import org.apache.uima.ruta.condition.InListCondition; +import org.apache.uima.ruta.condition.IsCondition; +import org.apache.uima.ruta.condition.LastCondition; +import org.apache.uima.ruta.condition.MOfNCondition; +import org.apache.uima.ruta.condition.NearCondition; +import org.apache.uima.ruta.condition.NotCondition; +import org.apache.uima.ruta.condition.OrCondition; +import org.apache.uima.ruta.condition.ParseCondition; +import org.apache.uima.ruta.condition.PartOfCondition; +import org.apache.uima.ruta.condition.PartOfNeqCondition; +import org.apache.uima.ruta.condition.PositionCondition; +import org.apache.uima.ruta.condition.RegExpCondition; +import org.apache.uima.ruta.condition.ScoreCondition; +import org.apache.uima.ruta.condition.SizeCondition; +import org.apache.uima.ruta.condition.StartsWithCondition; +import org.apache.uima.ruta.condition.TotalCountCondition; +import org.apache.uima.ruta.condition.VoteCondition; +import org.apache.uima.ruta.expression.list.ListExpression; +import org.apache.uima.ruta.expression.number.NumberExpression; +import org.apache.uima.ruta.expression.number.SimpleNumberExpression; public class ConditionVerbalizer { - private TextMarkerVerbalizer verbalizer; + private RutaVerbalizer verbalizer; - public ConditionVerbalizer(TextMarkerVerbalizer verbalizer) { + public ConditionVerbalizer(RutaVerbalizer verbalizer) { super(); this.verbalizer = verbalizer; } - public String verbalizeName(AbstractTextMarkerCondition condition) { + public String verbalizeName(AbstractRutaCondition condition) { if (condition instanceof AndCondition) { return "AND"; } else if (condition instanceof ContainsCondition) { @@ -140,16 +140,16 @@ public class ConditionVerbalizer { return condition.getClass().getSimpleName(); } - public String verbalize(AbstractTextMarkerCondition condition) { + public String verbalize(AbstractRutaCondition condition) { String name = verbalizeName(condition) + "("; if (condition instanceof AndCondition) { AndCondition c = (AndCondition) condition; - List<AbstractTextMarkerCondition> conditions = c.getConditions(); + List<AbstractRutaCondition> conditions = c.getConditions(); StringBuilder sb = new StringBuilder(); sb.append(name); - Iterator<AbstractTextMarkerCondition> it = conditions.iterator(); + Iterator<AbstractRutaCondition> it = conditions.iterator(); while (it.hasNext()) { - AbstractTextMarkerCondition each = (AbstractTextMarkerCondition) it.next(); + AbstractRutaCondition each = (AbstractRutaCondition) it.next(); sb.append(verbalize(each)); if (it.hasNext()) { sb.append(", "); @@ -245,13 +245,13 @@ public class ConditionVerbalizer { String max = verbalizeMax(maxE, Integer.MAX_VALUE); sb.append(min.substring(2, min.length())); sb.append(max); - List<AbstractTextMarkerCondition> conditions = c.getConditions(); + List<AbstractRutaCondition> conditions = c.getConditions(); if (!conditions.isEmpty()) { sb.append(", "); } - Iterator<AbstractTextMarkerCondition> it = conditions.iterator(); + Iterator<AbstractRutaCondition> it = conditions.iterator(); while (it.hasNext()) { - AbstractTextMarkerCondition each = (AbstractTextMarkerCondition) it.next(); + AbstractRutaCondition each = (AbstractRutaCondition) it.next(); sb.append(verbalize(each)); if (it.hasNext()) { sb.append(", "); @@ -274,13 +274,13 @@ public class ConditionVerbalizer { return name + type + min + max + ", " + var + filtered + ")"; } else if (condition instanceof NotCondition) { NotCondition c = (NotCondition) condition; - List<AbstractTextMarkerCondition> conditions = c.getConditions(); + List<AbstractRutaCondition> conditions = c.getConditions(); if (conditions.size() != 1) { StringBuilder sb = new StringBuilder(); sb.append(name); - Iterator<AbstractTextMarkerCondition> it = conditions.iterator(); + Iterator<AbstractRutaCondition> it = conditions.iterator(); while (it.hasNext()) { - AbstractTextMarkerCondition each = (AbstractTextMarkerCondition) it.next(); + AbstractRutaCondition each = (AbstractRutaCondition) it.next(); sb.append(verbalize(each)); if (it.hasNext()) { sb.append(", "); @@ -293,12 +293,12 @@ public class ConditionVerbalizer { } } else if (condition instanceof OrCondition) { OrCondition c = (OrCondition) condition; - List<AbstractTextMarkerCondition> conditions = c.getConditions(); + List<AbstractRutaCondition> conditions = c.getConditions(); StringBuilder sb = new StringBuilder(); sb.append(name); - Iterator<AbstractTextMarkerCondition> it = conditions.iterator(); + Iterator<AbstractRutaCondition> it = conditions.iterator(); while (it.hasNext()) { - AbstractTextMarkerCondition each = (AbstractTextMarkerCondition) it.next(); + AbstractRutaCondition each = (AbstractRutaCondition) it.next(); sb.append(verbalize(each)); if (it.hasNext()) { sb.append(", "); Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ExpressionVerbalizer.java URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ExpressionVerbalizer.java?rev=1477074&r1=1477073&r2=1477074&view=diff ============================================================================== --- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ExpressionVerbalizer.java (original) +++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ExpressionVerbalizer.java Mon Apr 29 13:48:03 2013 @@ -17,53 +17,53 @@ * under the License. */ -package org.apache.uima.textmarker.verbalize; +package org.apache.uima.ruta.verbalize; import java.util.Iterator; -import org.apache.uima.textmarker.expression.TextMarkerExpression; -import org.apache.uima.textmarker.expression.bool.BooleanExpression; -import org.apache.uima.textmarker.expression.bool.BooleanNumberExpression; -import org.apache.uima.textmarker.expression.bool.BooleanTypeExpression; -import org.apache.uima.textmarker.expression.bool.ReferenceBooleanExpression; -import org.apache.uima.textmarker.expression.bool.SimpleBooleanExpression; -import org.apache.uima.textmarker.expression.list.ListExpression; -import org.apache.uima.textmarker.expression.list.ReferenceBooleanListExpression; -import org.apache.uima.textmarker.expression.list.ReferenceNumberListExpression; -import org.apache.uima.textmarker.expression.list.ReferenceStringListExpression; -import org.apache.uima.textmarker.expression.list.ReferenceTypeListExpression; -import org.apache.uima.textmarker.expression.list.SimpleBooleanListExpression; -import org.apache.uima.textmarker.expression.list.SimpleNumberListExpression; -import org.apache.uima.textmarker.expression.list.SimpleStringListExpression; -import org.apache.uima.textmarker.expression.list.SimpleTypeListExpression; -import org.apache.uima.textmarker.expression.number.ComposedNumberExpression; -import org.apache.uima.textmarker.expression.number.NegativeNumberExpression; -import org.apache.uima.textmarker.expression.number.NumberExpression; -import org.apache.uima.textmarker.expression.number.ReferenceNumberExpression; -import org.apache.uima.textmarker.expression.number.SimpleNumberExpression; -import org.apache.uima.textmarker.expression.resource.ReferenceWordListExpression; -import org.apache.uima.textmarker.expression.resource.ReferenceWordTableExpression; -import org.apache.uima.textmarker.expression.resource.WordListExpression; -import org.apache.uima.textmarker.expression.resource.WordTableExpression; -import org.apache.uima.textmarker.expression.string.ComposedStringExpression; -import org.apache.uima.textmarker.expression.string.LiteralStringExpression; -import org.apache.uima.textmarker.expression.string.ReferenceStringExpression; -import org.apache.uima.textmarker.expression.string.SimpleStringExpression; -import org.apache.uima.textmarker.expression.string.StringExpression; -import org.apache.uima.textmarker.expression.type.ReferenceTypeExpression; -import org.apache.uima.textmarker.expression.type.SimpleTypeExpression; -import org.apache.uima.textmarker.expression.type.TypeExpression; +import org.apache.uima.ruta.expression.RutaExpression; +import org.apache.uima.ruta.expression.bool.BooleanExpression; +import org.apache.uima.ruta.expression.bool.BooleanNumberExpression; +import org.apache.uima.ruta.expression.bool.BooleanTypeExpression; +import org.apache.uima.ruta.expression.bool.ReferenceBooleanExpression; +import org.apache.uima.ruta.expression.bool.SimpleBooleanExpression; +import org.apache.uima.ruta.expression.list.ListExpression; +import org.apache.uima.ruta.expression.list.ReferenceBooleanListExpression; +import org.apache.uima.ruta.expression.list.ReferenceNumberListExpression; +import org.apache.uima.ruta.expression.list.ReferenceStringListExpression; +import org.apache.uima.ruta.expression.list.ReferenceTypeListExpression; +import org.apache.uima.ruta.expression.list.SimpleBooleanListExpression; +import org.apache.uima.ruta.expression.list.SimpleNumberListExpression; +import org.apache.uima.ruta.expression.list.SimpleStringListExpression; +import org.apache.uima.ruta.expression.list.SimpleTypeListExpression; +import org.apache.uima.ruta.expression.number.ComposedNumberExpression; +import org.apache.uima.ruta.expression.number.NegativeNumberExpression; +import org.apache.uima.ruta.expression.number.NumberExpression; +import org.apache.uima.ruta.expression.number.ReferenceNumberExpression; +import org.apache.uima.ruta.expression.number.SimpleNumberExpression; +import org.apache.uima.ruta.expression.resource.ReferenceWordListExpression; +import org.apache.uima.ruta.expression.resource.ReferenceWordTableExpression; +import org.apache.uima.ruta.expression.resource.WordListExpression; +import org.apache.uima.ruta.expression.resource.WordTableExpression; +import org.apache.uima.ruta.expression.string.ComposedStringExpression; +import org.apache.uima.ruta.expression.string.LiteralStringExpression; +import org.apache.uima.ruta.expression.string.ReferenceStringExpression; +import org.apache.uima.ruta.expression.string.SimpleStringExpression; +import org.apache.uima.ruta.expression.string.StringExpression; +import org.apache.uima.ruta.expression.type.ReferenceTypeExpression; +import org.apache.uima.ruta.expression.type.SimpleTypeExpression; +import org.apache.uima.ruta.expression.type.TypeExpression; public class ExpressionVerbalizer { - private TextMarkerVerbalizer verbalizer; + private RutaVerbalizer verbalizer; - public ExpressionVerbalizer(TextMarkerVerbalizer verbalizer) { + public ExpressionVerbalizer(RutaVerbalizer verbalizer) { super(); this.verbalizer = verbalizer; } - public String verbalize(TextMarkerExpression expression) { + public String verbalize(RutaExpression expression) { if (expression instanceof TypeExpression) { return verbalize((TypeExpression) expression); } else if (expression instanceof BooleanExpression) { Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ScriptVerbalizer.java URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ScriptVerbalizer.java?rev=1477074&r1=1477073&r2=1477074&view=diff ============================================================================== --- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ScriptVerbalizer.java (original) +++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ScriptVerbalizer.java Mon Apr 29 13:48:03 2013 @@ -17,54 +17,54 @@ * under the License. */ -package org.apache.uima.textmarker.verbalize; +package org.apache.uima.ruta.verbalize; import java.util.Iterator; import java.util.List; import java.util.Map.Entry; -import org.apache.uima.textmarker.TextMarkerBlock; -import org.apache.uima.textmarker.TextMarkerElement; -import org.apache.uima.textmarker.TextMarkerStatement; -import org.apache.uima.textmarker.action.AbstractTextMarkerAction; -import org.apache.uima.textmarker.condition.AbstractTextMarkerCondition; -import org.apache.uima.textmarker.expression.TextMarkerExpression; -import org.apache.uima.textmarker.expression.number.NumberExpression; -import org.apache.uima.textmarker.expression.type.TypeExpression; -import org.apache.uima.textmarker.rule.ComposedRuleElement; -import org.apache.uima.textmarker.rule.RegExpRule; -import org.apache.uima.textmarker.rule.RuleElement; -import org.apache.uima.textmarker.rule.TextMarkerDisjunctiveMatcher; -import org.apache.uima.textmarker.rule.TextMarkerMatcher; -import org.apache.uima.textmarker.rule.TextMarkerRule; -import org.apache.uima.textmarker.rule.TextMarkerRuleElement; -import org.apache.uima.textmarker.rule.WildCardRuleElement; -import org.apache.uima.textmarker.rule.quantifier.MinMaxGreedy; -import org.apache.uima.textmarker.rule.quantifier.MinMaxReluctant; -import org.apache.uima.textmarker.rule.quantifier.NormalQuantifier; -import org.apache.uima.textmarker.rule.quantifier.PlusGreedy; -import org.apache.uima.textmarker.rule.quantifier.PlusReluctant; -import org.apache.uima.textmarker.rule.quantifier.QuestionGreedy; -import org.apache.uima.textmarker.rule.quantifier.QuestionReluctant; -import org.apache.uima.textmarker.rule.quantifier.RuleElementQuantifier; -import org.apache.uima.textmarker.rule.quantifier.StarGreedy; -import org.apache.uima.textmarker.rule.quantifier.StarReluctant; +import org.apache.uima.ruta.RutaBlock; +import org.apache.uima.ruta.RutaElement; +import org.apache.uima.ruta.RutaStatement; +import org.apache.uima.ruta.action.AbstractRutaAction; +import org.apache.uima.ruta.condition.AbstractRutaCondition; +import org.apache.uima.ruta.expression.RutaExpression; +import org.apache.uima.ruta.expression.number.NumberExpression; +import org.apache.uima.ruta.expression.type.TypeExpression; +import org.apache.uima.ruta.rule.ComposedRuleElement; +import org.apache.uima.ruta.rule.RegExpRule; +import org.apache.uima.ruta.rule.RuleElement; +import org.apache.uima.ruta.rule.RutaDisjunctiveMatcher; +import org.apache.uima.ruta.rule.RutaMatcher; +import org.apache.uima.ruta.rule.RutaRule; +import org.apache.uima.ruta.rule.RutaRuleElement; +import org.apache.uima.ruta.rule.WildCardRuleElement; +import org.apache.uima.ruta.rule.quantifier.MinMaxGreedy; +import org.apache.uima.ruta.rule.quantifier.MinMaxReluctant; +import org.apache.uima.ruta.rule.quantifier.NormalQuantifier; +import org.apache.uima.ruta.rule.quantifier.PlusGreedy; +import org.apache.uima.ruta.rule.quantifier.PlusReluctant; +import org.apache.uima.ruta.rule.quantifier.QuestionGreedy; +import org.apache.uima.ruta.rule.quantifier.QuestionReluctant; +import org.apache.uima.ruta.rule.quantifier.RuleElementQuantifier; +import org.apache.uima.ruta.rule.quantifier.StarGreedy; +import org.apache.uima.ruta.rule.quantifier.StarReluctant; public class ScriptVerbalizer { private static final String THEN = " -> "; - private TextMarkerVerbalizer verbalizer; + private RutaVerbalizer verbalizer; - public ScriptVerbalizer(TextMarkerVerbalizer verbalizer) { + public ScriptVerbalizer(RutaVerbalizer verbalizer) { super(); this.verbalizer = verbalizer; } - public String verbalizeBlock(TextMarkerBlock block, boolean withElements) { + public String verbalizeBlock(RutaBlock block, boolean withElements) { StringBuilder result = new StringBuilder(); - TextMarkerRule rule = block.getRule(); - List<TextMarkerStatement> elements = block.getElements(); + RutaRule rule = block.getRule(); + List<RutaStatement> elements = block.getElements(); result.append("BLOCK("); result.append(block.getName()); result.append(")"); @@ -74,11 +74,11 @@ public class ScriptVerbalizer { } if (withElements) { result.append(" {\n"); - for (TextMarkerStatement each : elements) { - if (each instanceof TextMarkerBlock) { - result.append(verbalizeBlock((TextMarkerBlock) each, withElements)); - } else if (each instanceof TextMarkerRule) { - result.append(verbalizeRule((TextMarkerRule) each)); + for (RutaStatement each : elements) { + if (each instanceof RutaBlock) { + result.append(verbalizeBlock((RutaBlock) each, withElements)); + } else if (each instanceof RutaRule) { + result.append(verbalizeRule((RutaRule) each)); } result.append(";"); result.append("\n"); @@ -88,7 +88,7 @@ public class ScriptVerbalizer { return result.toString(); } - public String verbalizeRule(TextMarkerRule rule) { + public String verbalizeRule(RutaRule rule) { List<RuleElement> elements = rule.getRuleElements(); StringBuilder result = new StringBuilder(); for (RuleElement each : elements) { @@ -99,14 +99,14 @@ public class ScriptVerbalizer { } public String verbalizeRuleElement(RuleElement re) { - List<AbstractTextMarkerCondition> conditions = re.getConditions(); - List<AbstractTextMarkerAction> actions = re.getActions(); + List<AbstractRutaCondition> conditions = re.getConditions(); + List<AbstractRutaAction> actions = re.getActions(); RuleElementQuantifier quantifier = re.getQuantifier(); StringBuilder result = new StringBuilder(); if (re instanceof ComposedRuleElement) { result.append(verbalizeComposed((ComposedRuleElement) re)); - } else if (re instanceof TextMarkerRuleElement) { - TextMarkerRuleElement tmre = (TextMarkerRuleElement) re; + } else if (re instanceof RutaRuleElement) { + RutaRuleElement tmre = (RutaRuleElement) re; result.append(verbalizeMatcher(tmre)); } else if(re instanceof WildCardRuleElement) { result.append("#"); @@ -115,9 +115,9 @@ public class ScriptVerbalizer { if (!conditions.isEmpty() || !actions.isEmpty()) { result.append("{"); - Iterator<AbstractTextMarkerCondition> cit = conditions.iterator(); + Iterator<AbstractRutaCondition> cit = conditions.iterator(); while (cit.hasNext()) { - AbstractTextMarkerCondition each = cit.next(); + AbstractRutaCondition each = cit.next(); result.append(verbalizer.verbalize(each)); if (cit.hasNext()) { result.append(","); @@ -125,9 +125,9 @@ public class ScriptVerbalizer { } if (!actions.isEmpty()) { result.append(THEN); - Iterator<AbstractTextMarkerAction> ait = actions.iterator(); + Iterator<AbstractRutaAction> ait = actions.iterator(); while (ait.hasNext()) { - AbstractTextMarkerAction each = ait.next(); + AbstractRutaAction each = ait.next(); result.append(verbalizer.verbalize(each)); if (ait.hasNext()) { result.append(","); @@ -153,14 +153,14 @@ public class ScriptVerbalizer { return result.toString(); } - public String verbalizeMatcher(TextMarkerRuleElement tmre) { + public String verbalizeMatcher(RutaRuleElement tmre) { StringBuilder result = new StringBuilder(); - TextMarkerMatcher matcher = tmre.getMatcher(); - if (matcher instanceof TextMarkerDisjunctiveMatcher) { - TextMarkerDisjunctiveMatcher dmatcher = (TextMarkerDisjunctiveMatcher) matcher; - List<TextMarkerExpression> expressions = dmatcher.getExpressions(); + RutaMatcher matcher = tmre.getMatcher(); + if (matcher instanceof RutaDisjunctiveMatcher) { + RutaDisjunctiveMatcher dmatcher = (RutaDisjunctiveMatcher) matcher; + List<RutaExpression> expressions = dmatcher.getExpressions(); result.append("("); - for (TextMarkerExpression each : expressions) { + for (RutaExpression each : expressions) { if (expressions.indexOf(each) != 0) { result.append(" | "); } @@ -200,17 +200,17 @@ public class ScriptVerbalizer { return null; } - public String verbalize(TextMarkerElement element) { - if (element instanceof TextMarkerBlock) { - return verbalizeBlock((TextMarkerBlock) element, false); + public String verbalize(RutaElement element) { + if (element instanceof RutaBlock) { + return verbalizeBlock((RutaBlock) element, false); } else if (element instanceof RuleElementQuantifier) { return verbalizeQuantifier((RuleElementQuantifier) element); - } else if (element instanceof TextMarkerRule) { - return verbalizeRule((TextMarkerRule) element); + } else if (element instanceof RutaRule) { + return verbalizeRule((RutaRule) element); } else if (element instanceof RegExpRule) { return verbalizeRegExpRule((RegExpRule) element); - } else if (element instanceof TextMarkerRuleElement) { - return verbalizeRuleElement((TextMarkerRuleElement) element); + } else if (element instanceof RutaRuleElement) { + return verbalizeRuleElement((RutaRuleElement) element); } return null; } Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/VerbalizerUtils.java URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/VerbalizerUtils.java?rev=1477074&r1=1477073&r2=1477074&view=diff ============================================================================== --- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/VerbalizerUtils.java (original) +++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/VerbalizerUtils.java Mon Apr 29 13:48:03 2013 @@ -17,19 +17,19 @@ * under the License. */ -package org.apache.uima.textmarker.verbalize; +package org.apache.uima.ruta.verbalize; import java.util.Iterator; import java.util.List; import org.apache.uima.cas.Type; -import org.apache.uima.textmarker.expression.TextMarkerExpression; +import org.apache.uima.ruta.expression.RutaExpression; public class VerbalizerUtils { - private TextMarkerVerbalizer verbalizer; + private RutaVerbalizer verbalizer; - public VerbalizerUtils(TextMarkerVerbalizer verbalizer) { + public VerbalizerUtils(RutaVerbalizer verbalizer) { super(); this.verbalizer = verbalizer; } @@ -60,11 +60,11 @@ public class VerbalizerUtils { return result.toString(); } - public String verbalizeExpressionList(List<? extends TextMarkerExpression> list) { + public String verbalizeExpressionList(List<? extends RutaExpression> list) { StringBuilder result = new StringBuilder(); - Iterator<? extends TextMarkerExpression> it = list.iterator(); + Iterator<? extends RutaExpression> it = list.iterator(); while (it.hasNext()) { - TextMarkerExpression e = it.next(); + RutaExpression e = it.next(); result.append(verbalizer.verbalize(e)); if (it.hasNext()) { result.append(", ");