diff --git a/cif/org.eclipse.escet.cif.cif2supremica/src/org/eclipse/escet/cif/cif2supremica/CifToSupremica.java b/cif/org.eclipse.escet.cif.cif2supremica/src/org/eclipse/escet/cif/cif2supremica/CifToSupremica.java index b276c59d5506c6317bbe4d9a1bd62324c0f998fc..732e869c3a2e53f9d4ddfd6ffa4c8a7060194ecf 100644 --- a/cif/org.eclipse.escet.cif.cif2supremica/src/org/eclipse/escet/cif/cif2supremica/CifToSupremica.java +++ b/cif/org.eclipse.escet.cif.cif2supremica/src/org/eclipse/escet/cif/cif2supremica/CifToSupremica.java @@ -140,7 +140,7 @@ public class CifToSupremica { } // Check preconditions and perform further preprocessing. - new CifToSupremicaPreChecker().check(spec); + CifToSupremicaPreChecker.check(spec); preprocess(spec, elimEnums); // Modify the CIF specification for state invariants. diff --git a/cif/org.eclipse.escet.cif.cif2supremica/src/org/eclipse/escet/cif/cif2supremica/CifToSupremicaPreChecker.java b/cif/org.eclipse.escet.cif.cif2supremica/src/org/eclipse/escet/cif/cif2supremica/CifToSupremicaPreChecker.java index c18d5befefa3390a5d8bf05692f769ea96eb19ec..a6ec835c7be3e4acf592bf85d90d5e0405ef38fc 100644 --- a/cif/org.eclipse.escet.cif.cif2supremica/src/org/eclipse/escet/cif/cif2supremica/CifToSupremicaPreChecker.java +++ b/cif/org.eclipse.escet.cif.cif2supremica/src/org/eclipse/escet/cif/cif2supremica/CifToSupremicaPreChecker.java @@ -13,96 +13,46 @@ package org.eclipse.escet.cif.cif2supremica; -import static org.eclipse.escet.cif.common.CifEvalUtils.evalPreds; -import static org.eclipse.escet.cif.common.CifTextUtils.exprToStr; -import static org.eclipse.escet.cif.common.CifTextUtils.exprsToStr; -import static org.eclipse.escet.cif.common.CifTextUtils.getAbsName; -import static org.eclipse.escet.cif.common.CifTextUtils.getComponentText1; -import static org.eclipse.escet.cif.common.CifTextUtils.getLocationText1; -import static org.eclipse.escet.cif.common.CifTextUtils.invToStr; -import static org.eclipse.escet.cif.common.CifTextUtils.operatorToStr; -import static org.eclipse.escet.cif.common.CifTextUtils.typeToStr; -import static org.eclipse.escet.cif.common.CifTypeUtils.isRangeless; -import static org.eclipse.escet.cif.common.CifTypeUtils.normalizeType; import static org.eclipse.escet.common.java.Lists.list; -import static org.eclipse.escet.common.java.Maps.map; -import static org.eclipse.escet.common.java.Strings.fmt; -import java.util.Collections; import java.util.List; -import java.util.Map; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.escet.cif.common.CifEvalException; -import org.eclipse.escet.cif.common.CifTextUtils; -import org.eclipse.escet.cif.common.CifTypeUtils; -import org.eclipse.escet.cif.common.RangeCompat; -import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; -import org.eclipse.escet.cif.metamodel.cif.InvKind; -import org.eclipse.escet.cif.metamodel.cif.Invariant; -import org.eclipse.escet.cif.metamodel.cif.LocationParameter; +import org.eclipse.escet.cif.common.checkers.CifCheck; +import org.eclipse.escet.cif.common.checkers.CifPreconditionChecker; +import org.eclipse.escet.cif.common.checkers.NoChannelsCheck; +import org.eclipse.escet.cif.common.checkers.NoContinuousVariablesCheck; +import org.eclipse.escet.cif.common.checkers.NoDiscVarsWithMultiInitValuesCheck; +import org.eclipse.escet.cif.common.checkers.NoInitPredsInCompsCheck; +import org.eclipse.escet.cif.common.checkers.NoInputVariablesCheck; +import org.eclipse.escet.cif.common.checkers.NoKindlessAutomataCheck; +import org.eclipse.escet.cif.common.checkers.NoKindlessStateEvtExclInvsCheck; +import org.eclipse.escet.cif.common.checkers.NoSpecificBinaryExprsCheck; +import org.eclipse.escet.cif.common.checkers.NoSpecificBinaryExprsCheck.NoSpecificBinaryOp; +import org.eclipse.escet.cif.common.checkers.NoSpecificExprsCheck; +import org.eclipse.escet.cif.common.checkers.NoSpecificExprsCheck.NoSpecificExpr; +import org.eclipse.escet.cif.common.checkers.NoSpecificTypesCheck; +import org.eclipse.escet.cif.common.checkers.NoSpecificTypesCheck.NoSpecificType; +import org.eclipse.escet.cif.common.checkers.NoSpecificUnaryExprsCheck; +import org.eclipse.escet.cif.common.checkers.NoSpecificUnaryExprsCheck.NoSpecificUnaryOp; +import org.eclipse.escet.cif.common.checkers.NoStateInvsInLocsCheck; +import org.eclipse.escet.cif.common.checkers.NoUrgentEdgesCheck; +import org.eclipse.escet.cif.common.checkers.NoUrgentLocationsCheck; +import org.eclipse.escet.cif.common.checkers.NoUserDefinedFunctionsCheck; +import org.eclipse.escet.cif.common.checkers.OnlyAutsWithOneInitLocCheck; +import org.eclipse.escet.cif.common.checkers.OnlyEventsWithControllabilityCheck; +import org.eclipse.escet.cif.common.checkers.OnlyReqStateInvsInCompsCheck; +import org.eclipse.escet.cif.common.checkers.OnlySimpleAssignmentsCheck; +import org.eclipse.escet.cif.common.checkers.OnlyStaticEvalMarkerPredsInLocsCheck; +import org.eclipse.escet.cif.common.checkers.OnlyVarValueMarkerPredsInCompsCheck; import org.eclipse.escet.cif.metamodel.cif.Specification; -import org.eclipse.escet.cif.metamodel.cif.SupKind; -import org.eclipse.escet.cif.metamodel.cif.automata.Assignment; -import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; -import org.eclipse.escet.cif.metamodel.cif.automata.Edge; -import org.eclipse.escet.cif.metamodel.cif.automata.IfUpdate; -import org.eclipse.escet.cif.metamodel.cif.automata.Location; -import org.eclipse.escet.cif.metamodel.cif.declarations.ContVariable; -import org.eclipse.escet.cif.metamodel.cif.declarations.DiscVariable; -import org.eclipse.escet.cif.metamodel.cif.declarations.Event; -import org.eclipse.escet.cif.metamodel.cif.declarations.InputVariable; -import org.eclipse.escet.cif.metamodel.cif.declarations.VariableValue; -import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryExpression; -import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryOperator; -import org.eclipse.escet.cif.metamodel.cif.expressions.CastExpression; -import org.eclipse.escet.cif.metamodel.cif.expressions.DictExpression; -import org.eclipse.escet.cif.metamodel.cif.expressions.DiscVariableExpression; -import org.eclipse.escet.cif.metamodel.cif.expressions.Expression; -import org.eclipse.escet.cif.metamodel.cif.expressions.FunctionCallExpression; -import org.eclipse.escet.cif.metamodel.cif.expressions.IfExpression; -import org.eclipse.escet.cif.metamodel.cif.expressions.ListExpression; -import org.eclipse.escet.cif.metamodel.cif.expressions.ProjectionExpression; -import org.eclipse.escet.cif.metamodel.cif.expressions.RealExpression; -import org.eclipse.escet.cif.metamodel.cif.expressions.SetExpression; -import org.eclipse.escet.cif.metamodel.cif.expressions.SliceExpression; -import org.eclipse.escet.cif.metamodel.cif.expressions.StringExpression; -import org.eclipse.escet.cif.metamodel.cif.expressions.SwitchExpression; -import org.eclipse.escet.cif.metamodel.cif.expressions.TauExpression; -import org.eclipse.escet.cif.metamodel.cif.expressions.TimeExpression; -import org.eclipse.escet.cif.metamodel.cif.expressions.TupleExpression; -import org.eclipse.escet.cif.metamodel.cif.expressions.UnaryExpression; -import org.eclipse.escet.cif.metamodel.cif.expressions.UnaryOperator; -import org.eclipse.escet.cif.metamodel.cif.functions.Function; -import org.eclipse.escet.cif.metamodel.cif.types.BoolType; -import org.eclipse.escet.cif.metamodel.cif.types.CifType; -import org.eclipse.escet.cif.metamodel.cif.types.DictType; -import org.eclipse.escet.cif.metamodel.cif.types.DistType; -import org.eclipse.escet.cif.metamodel.cif.types.FuncType; -import org.eclipse.escet.cif.metamodel.cif.types.IntType; -import org.eclipse.escet.cif.metamodel.cif.types.ListType; -import org.eclipse.escet.cif.metamodel.cif.types.RealType; -import org.eclipse.escet.cif.metamodel.cif.types.SetType; -import org.eclipse.escet.cif.metamodel.cif.types.StringType; -import org.eclipse.escet.cif.metamodel.cif.types.TupleType; -import org.eclipse.escet.cif.metamodel.java.CifWalker; import org.eclipse.escet.common.app.framework.exceptions.UnsupportedException; -import org.eclipse.escet.common.java.Assert; -import org.eclipse.escet.common.java.Strings; /** CIF to Supremica transformation precondition checker. */ -public class CifToSupremicaPreChecker extends CifWalker { - /** Precondition violations found so far. */ - private final List problems = list(); - - /** Mapping from discrete variables to their marked values. Filled during checking. */ - private Map> markeds = map(); - - /** - * The number of initial locations found for the automaton being checked. Only valid while checking an automaton. Is - * set to {@code -1} to disable this check due to evaluation errors in initialization predicates. - */ - private int initLocCount; +public class CifToSupremicaPreChecker { + /** Constructor for the {@link CifToSupremicaPreChecker} class. */ + private CifToSupremicaPreChecker() { + // Static class. + } /** * Checks the CIF specification to make sure it satisfies the preconditions for the transformation. @@ -110,585 +60,152 @@ public class CifToSupremicaPreChecker extends CifWalker { * @param spec The CIF specification to check. * @throws UnsupportedException If a precondition is violated. */ - public void check(Specification spec) { - // Find precondition violations. - walkSpecification(spec); - - // If we have any problems, the specification is unsupported. - Collections.sort(problems, Strings.SORTER); - if (!problems.isEmpty()) { - String msg = "CIF to Supremica transformation failed due to unsatisfied preconditions:\n - " - + String.join("\n - ", problems); - throw new UnsupportedException(msg); - } - } - - @Override - protected void preprocessEvent(Event event) { - // Event must be controllable or uncontrollable. - if (event.getControllable() == null) { - String msg = fmt("Unsupported event \"%s\": event is not declared as controllable or uncontrollable.", - getAbsName(event)); - problems.add(msg); - } - - // Event must not have a data type. - if (event.getType() != null) { - String msg = fmt("Unsupported event \"%s\": event is a channel (has a data type).", getAbsName(event)); - problems.add(msg); - } - } - - @Override - protected void preprocessTauExpression(TauExpression obj) { - problems.add( - "Unsupported event \"tau\": event is not controllable or uncontrollable (explicit use of \"tau\")."); - } - - @Override - protected void preprocessComplexComponent(ComplexComponent comp) { - // Initialization predicates only in locations. - if (!comp.getInitials().isEmpty()) { - String msg = fmt("Unsupported %s: initialization predicates are currently only supported in locations.", - getComponentText1(comp)); - problems.add(msg); - } - - // Check for supported/duplicate variable marking predicates. - for (Expression marked: comp.getMarkeds()) { - boolean supported = processComponentMarker(marked); - if (!supported) { - String msg = fmt("Unsupported %s: unsupported marker predicate \"%s\".", getComponentText1(comp), - exprToStr(marked)); - problems.add(msg); - } - } - - // Check supervisory and invariant kinds of invariants. State invariants must be requirements. State/event - // exclusion invariants are transformed into automata and must have a kind. - for (Invariant inv: comp.getInvariants()) { - SupKind supKind = inv.getSupKind(); - - if (inv.getInvKind() == InvKind.STATE) { - if (supKind != SupKind.REQUIREMENT) { - String kindTxt = (supKind == SupKind.NONE) ? "kindless" : CifTextUtils.kindToStr(supKind); - String msg = fmt("Unsupported %s: unsupported %s state invariant \"%s\".", getComponentText1(comp), - kindTxt, invToStr(inv, false)); - problems.add(msg); - } - } else if (inv.getInvKind() == InvKind.EVENT_NEEDS || inv.getInvKind() == InvKind.EVENT_DISABLES) { - if (supKind == SupKind.NONE) { - String msg = fmt("Unsupported %s: unsupported kindless state/event exclusion invariant \"%s\".", - getComponentText1(comp), invToStr(inv, false)); - problems.add(msg); - } - } else { - Assert.fail("Unexpected invariant kind."); - } - } - } - - /** - * Processes the given marker predicate of a component. The predicate should be of the form 'discrete_variable = - * marked_value'. Other forms are not supported. If supported, the variable and marked value are added to - * {@link #markeds}. Also checks for duplicate marked values for a single discrete variable. - * - * @param marker The marker predicate to process. - * @return Whether the marker predicate is supported ({@code true}) or not ({@code false}). Duplicate marked values - * do not affect the result of this method. - */ - private boolean processComponentMarker(Expression marker) { - // Analyze. - if (!(marker instanceof BinaryExpression)) { - return false; - } - BinaryExpression bexpr = (BinaryExpression)marker; - if (bexpr.getOperator() != BinaryOperator.EQUAL) { - return false; - } - if (!(bexpr.getLeft() instanceof DiscVariableExpression)) { - return false; - } + public static void check(Specification spec) { + // Configure precondition checks. + List preconditions = list(); - // Add to supported marker predicates mapping. - DiscVariableExpression vref = (DiscVariableExpression)bexpr.getLeft(); - DiscVariable var = vref.getVariable(); - List values = markeds.get(var); - if (values == null) { - values = list(); - markeds.put(var, values); - } - values.add(bexpr.getRight()); + // Kindless automata are not supported. + preconditions.add(new NoKindlessAutomataCheck()); - // We only support at most one marker value. Report duplicates only - // once per variable. - if (values.size() == 2) { - String msg = fmt("Unsupported declaration \"%s\": discrete variables with multiple marker predicates are " - + "currently not supported.", getAbsName(var)); - problems.add(msg); - } + // Events must be controllable or uncontrollable. Tau events are thus not supported. + preconditions.add(new OnlyEventsWithControllabilityCheck()); - // The predicate is supported, although it may be a duplicate. - return true; - } - - @Override - protected void preprocessAutomaton(Automaton aut) { - // Check kind. - if (aut.getKind() == SupKind.NONE) { - String msg = fmt("Unsupported automaton \"%s\": kindless/regular automata are currently not supported.", - getAbsName(aut)); - problems.add(msg); - } + // Initialization predicates outside of locations are not supported. + preconditions.add(new NoInitPredsInCompsCheck()); - // Reset initial locations counter. - initLocCount = 0; - } + // Marker predicates outside of locations are only supported if they have the form discrete_variable = + // marked_value. Discrete variables with multiple marker predicates are also not supported. + preconditions.add(new OnlyVarValueMarkerPredsInCompsCheck()); - @Override - protected void postprocessAutomaton(Automaton aut) { - // Exactly one initial location. This is required to ensure that the - // elimination of location references in expressions does not introduce - // additional initialization predicates. - if (initLocCount == 0) { - String msg = fmt("Unsupported automaton \"%s\": automata without an initial location are currently " - + "not supported.", getAbsName(aut)); - problems.add(msg); - } + // Locations with initialization or marker predicates that are not trivially true or false are not supported. + // This check only checks marker predicates. The check for a single initial location in each automaton, checks + // the initialization predicates. + preconditions.add(new OnlyStaticEvalMarkerPredsInLocsCheck()); - if (initLocCount > 1) { - String msg = fmt("Unsupported automaton \"%s\": automata with multiple (%d) initial locations are " - + "currently not supported.", getAbsName(aut), initLocCount); - problems.add(msg); - } - } + // Automata that do not have exactly one initial location are not supported. We allow only exactly one initial + // location to ensure that the elimination of location references in expressions does not introduce additional + // initialization predicates. + preconditions.add(new OnlyAutsWithOneInitLocCheck()); - @Override - protected void preprocessDiscVariable(DiscVariable var) { - // Discrete variables with multiple initial values are not supported. - // Actually, Supremica allows an initialization predicate, rather than - // a value, and the latest version seems to require initialization - // predicates instead of initial values. However, using - // 'x == 1 | x != 1' for a variable 'x' in range '0..9', in the latest - // version, seems to result in value '0' as initial value during - // simulation, without any way to get an other initial value. To be - // safe, we'll require a single initial value. - // - // Discrete variables that represent function parameters or local - // variables of functions are ignored here, as functions are already - // reported separately. - EObject parent = var.eContainer(); - if (parent instanceof ComplexComponent) { - VariableValue values = var.getValue(); - if (values != null && values.getValues().size() != 1) { - String msg = fmt("Unsupported declaration \"%s\": discrete variables with multiple potential initial " - + "values are currently not supported.", getAbsName(var)); - problems.add(msg); - } - } - } - - @Override - protected void preprocessContVariable(ContVariable var) { - // Continuous variables not supported. - String msg = fmt("Unsupported declaration \"%s\": continuous variables are currently unsupported.", - getAbsName(var)); - problems.add(msg); - } - - @Override - protected void preprocessInputVariable(InputVariable var) { - // Input variables not supported. - String msg = fmt("Unsupported declaration \"%s\": input variables are currently unsupported.", getAbsName(var)); - problems.add(msg); - } - - @Override - protected void preprocessLocation(Location loc) { - // Skip location parameters. - EObject parent = loc.eContainer(); - if (parent instanceof LocationParameter) { - return; - } - - // No urgent locations. - if (loc.isUrgent()) { - String msg = fmt("Unsupported %s: urgent locations are currently unsupported.", getLocationText1(loc)); - problems.add(msg); - } - - // Initialization. - boolean initial = false; - try { - initial = loc.getInitials().isEmpty() ? false : evalPreds(loc.getInitials(), true, true); - } catch (CifEvalException e) { - // Can only fail if there is at least one predicate. - String msg = fmt("Failed to evaluate initialization predicate(s): %s.", exprsToStr(loc.getInitials())); - problems.add(msg); - - // Disable initial location count checking. - initLocCount = -1; - } - - if (initial && initLocCount != -1) { - initLocCount++; - } - - // Marked. - if (!loc.getMarkeds().isEmpty()) { - try { - evalPreds(loc.getMarkeds(), false, true); - } catch (CifEvalException e) { - // Can only fail if there is at least one predicate. - String msg = fmt("Failed to evaluate marker predicate(s): %s.", exprsToStr(loc.getInitials())); - problems.add(msg); - } - } - - // No state invariants in locations. We would need to change 'invariant X' - // in location 'L' to 'invariant L => X' (in the automaton), but - // references to locations are not supported by the transformation. We do - // eliminate location references, so we could make a CIF to CIF - // transformation that lifts state invariants out of locations to the - // surrounding automaton, and apply that transformation before the + // State invariants in locations are not supported. We would need to change 'invariant X' in location 'L' to + // 'invariant L => X' (in the automaton), but references to locations are not supported by the transformation. + // We do eliminate location references, so we could make a CIF to CIF transformation that lifts state + // invariants out of locations to the surrounding automaton, and apply that transformation before the // elimination of location references. - for (Invariant inv: loc.getInvariants()) { - if (inv.getInvKind() == InvKind.STATE) { - String msg = fmt("Unsupported %s: state invariants in locations are currently unsupported.", - getLocationText1(loc)); - problems.add(msg); - } - } - } - - @Override - protected void preprocessEdge(Edge edge) { - // Tau unsupported. - if (edge.getEvents().isEmpty()) { - problems.add("Unsupported event \"tau\": event is not controllable or uncontrollable (implicit use of " - + "\"tau\")."); - } - - // No urgent edges. - if (edge.isUrgent()) { - Location loc = (Location)edge.eContainer(); - String msg = fmt("Unsupported %s: urgent edges are currently unsupported.", getLocationText1(loc)); - problems.add(msg); - } - } - - @Override - protected void preprocessAssignment(Assignment asgn) { - // Check for multi-assignment and partial variable assignment. - if (asgn.getAddressable() instanceof TupleExpression) { - // Multi-assignment unsupported. - EObject loc = asgn; - while (!(loc instanceof Location)) { - loc = loc.eContainer(); - } - Assert.check(loc instanceof Location); - - String msg = fmt("Unsupported %s: edges with multi-assignments are currently unsupported.", - getLocationText1((Location)loc)); - problems.add(msg); - } else if (asgn.getAddressable() instanceof ProjectionExpression) { - // Partial variable assignment unsupported. - EObject loc = asgn; - while (!(loc instanceof Location)) { - loc = loc.eContainer(); - } - Assert.check(loc instanceof Location); - - String msg = fmt("Unsupported %s: edges with partial variable assignments are currently unsupported.", - getLocationText1((Location)loc)); - problems.add(msg); - } - } - - @Override - protected void preprocessIfUpdate(IfUpdate update) { - // 'if' update unsupported. - EObject loc = update; - while (!(loc instanceof Location)) { - loc = loc.eContainer(); - } - Assert.check(loc instanceof Location); - - String msg = fmt("Unsupported %s: edges with 'if' updates are currently unsupported.", - getLocationText1((Location)loc)); - problems.add(msg); - } - - @Override - protected void preprocessFunction(Function func) { - // User-defined functions are unsupported. - String msg = fmt("Unsupported function \"%s\": user-defined functions are currently unsupported.", - getAbsName(func)); - problems.add(msg); - } - - @Override - protected void preprocessDictType(DictType type) { - String msg = fmt("Unsupported type \"%s\": dictionary types are currently not supported.", typeToStr(type)); - problems.add(msg); - } - - @Override - protected void preprocessDistType(DistType type) { - String msg = fmt("Unsupported type \"%s\": distribution types are currently not supported.", typeToStr(type)); - problems.add(msg); - } - - @Override - protected void preprocessFuncType(FuncType type) { - // User-defined functions as well as all standard library functions - // are unsupported. - String msg = fmt("Unsupported type \"%s\": function types are currently not supported.", typeToStr(type)); - problems.add(msg); - } - - @Override - protected void preprocessIntType(IntType type) { - // Rangeless integer types unsupported. - if (isRangeless(type)) { - String msg = fmt("Unsupported type \"%s\": rangeless integer types are currently not supported.", - typeToStr(type)); - problems.add(msg); - } - } - - @Override - protected void preprocessListType(ListType type) { - String msg = fmt("Unsupported type \"%s\": list types are currently not supported.", typeToStr(type)); - problems.add(msg); - } - - @Override - protected void preprocessRealType(RealType type) { - String msg = fmt("Unsupported type \"%s\": real types are currently not supported.", typeToStr(type)); - problems.add(msg); - } - - @Override - protected void preprocessSetType(SetType type) { - String msg = fmt("Unsupported type \"%s\": set types are currently not supported.", typeToStr(type)); - problems.add(msg); - } - - @Override - protected void preprocessStringType(StringType type) { - String msg = fmt("Unsupported type \"%s\": string types are currently not supported.", typeToStr(type)); - problems.add(msg); - } - - @Override - protected void preprocessTupleType(TupleType type) { - // Tuples, tuple types, and multi-assignments are unsupported. - String msg = fmt("Unsupported type \"%s\": tuple types are currently not supported.", typeToStr(type)); - problems.add(msg); - } - - @Override - protected void preprocessBinaryExpression(BinaryExpression expr) { - BinaryOperator op = expr.getOperator(); - switch (op) { - // Always boolean. - case IMPLICATION: - case BI_CONDITIONAL: - return; - - // Check boolean arguments. - case CONJUNCTION: - case DISJUNCTION: { - CifType ltype = normalizeType(expr.getLeft().getType()); - CifType rtype = normalizeType(expr.getRight().getType()); - if (ltype instanceof BoolType && rtype instanceof BoolType) { - return; - } - break; - } - - // Check rangeless integer arguments. - case ADDITION: - case SUBTRACTION: - case MULTIPLICATION: - case INTEGER_DIVISION: - case MODULUS: { - CifType ltype = normalizeType(expr.getLeft().getType()); - CifType rtype = normalizeType(expr.getRight().getType()); - if (ltype instanceof IntType && !isRangeless((IntType)ltype) && rtype instanceof IntType - && !isRangeless((IntType)rtype)) - { - return; - } - break; - } - - // Always OK, as same type operands, and types of operands checked - // elsewhere. - case EQUAL: - case UNEQUAL: - return; - - // Check rangeless integer arguments. - case GREATER_EQUAL: - case GREATER_THAN: - case LESS_EQUAL: - case LESS_THAN: { - CifType ltype = normalizeType(expr.getLeft().getType()); - CifType rtype = normalizeType(expr.getRight().getType()); - if (ltype instanceof IntType && !isRangeless((IntType)ltype) && rtype instanceof IntType - && !isRangeless((IntType)rtype)) - { - return; - } - break; - } - - // Unsupported, regardless of types of operands. - case DIVISION: // Real division. - case ELEMENT_OF: - case SUBSET: - break; - - // Error. - default: - throw new RuntimeException("Unknown bin op: " + op); - } - - // Unsupported. - String msg = fmt("Unsupported expression \"%s\": binary operator \"%s\" is currently not supported, " - + "or is not supported for the operands that are used.", exprToStr(expr), operatorToStr(op)); - problems.add(msg); - } - - @Override - protected void preprocessCastExpression(CastExpression expr) { - CifType ctype = expr.getChild().getType(); - CifType rtype = expr.getType(); - if (CifTypeUtils.checkTypeCompat(ctype, rtype, RangeCompat.EQUAL)) { - // Ignore casting to the child type. - return; - } - - String msg = fmt("Unsupported expression \"%s\": cast expressions are currently not supported.", - exprToStr(expr)); - problems.add(msg); - } - - @Override - protected void preprocessDictExpression(DictExpression expr) { - String msg = fmt("Unsupported expression \"%s\": dictionary expressions are currently not supported.", - exprToStr(expr)); - problems.add(msg); - } - - @Override - protected void preprocessFunctionCallExpression(FunctionCallExpression expr) { - String msg = fmt("Unsupported expression \"%s\": function calls are currently not supported.", exprToStr(expr)); - problems.add(msg); - } - - @Override - protected void preprocessIfExpression(IfExpression expr) { - String msg = fmt("Unsupported expression \"%s\": 'if' expressions are currently not supported.", - exprToStr(expr)); - problems.add(msg); - } - - @Override - protected void preprocessListExpression(ListExpression expr) { - String msg = fmt("Unsupported expression \"%s\": list expressions are currently not supported.", - exprToStr(expr)); - problems.add(msg); - } - - @Override - protected void preprocessProjectionExpression(ProjectionExpression expr) { - String msg = fmt("Unsupported expression \"%s\": projection expressions are currently not supported.", - exprToStr(expr)); - problems.add(msg); - } - - @Override - protected void preprocessRealExpression(RealExpression expr) { - String msg = fmt("Unsupported expression \"%s\": real number expressions are currently not supported.", - exprToStr(expr)); - problems.add(msg); - } - - @Override - protected void preprocessSetExpression(SetExpression expr) { - String msg = fmt("Unsupported expression \"%s\": set expressions are currently not supported.", - exprToStr(expr)); - problems.add(msg); - } - - @Override - protected void preprocessSliceExpression(SliceExpression expr) { - String msg = fmt("Unsupported expression \"%s\": slice expressions are currently not supported.", - exprToStr(expr)); - problems.add(msg); - } - - @Override - protected void preprocessStringExpression(StringExpression expr) { - String msg = fmt("Unsupported expression \"%s\": string literal expressions are currently not supported.", - exprToStr(expr)); - problems.add(msg); - } - - @Override - protected void preprocessSwitchExpression(SwitchExpression expr) { - String msg = fmt("Unsupported expression \"%s\": 'switch' expressions are currently not supported.", - exprToStr(expr)); - problems.add(msg); - } - - @Override - protected void preprocessTimeExpression(TimeExpression expr) { - String msg = fmt("Unsupported expression \"%s\": the use of variable \"time\" is currently not supported.", - exprToStr(expr)); - problems.add(msg); - } - - @Override - protected void preprocessTupleExpression(TupleExpression expr) { - String msg = fmt("Unsupported expression \"%s\": tuple expressions are currently not supported.", - exprToStr(expr)); - problems.add(msg); - } - - @Override - protected void preprocessUnaryExpression(UnaryExpression expr) { - UnaryOperator op = expr.getOperator(); - switch (op) { - // Always boolean. - case INVERSE: - return; - - // Check rangeless integer argument. - case NEGATE: - case PLUS: { - CifType ctype = normalizeType(expr.getChild().getType()); - if (ctype instanceof IntType && !isRangeless((IntType)ctype)) { - return; - } - break; - } - - // Unsupported. - case SAMPLE: - break; - - // Error. - default: - throw new RuntimeException("Unknown un op: " + op); - } - - // Unsupported. - String msg = fmt("Unsupported expression \"%s\": unary operator \"%s\" is currently not supported, " - + "or is not supported for the operand that is used.", exprToStr(expr), operatorToStr(op)); - problems.add(msg); + preconditions.add(new NoStateInvsInLocsCheck()); + + // State invariants in components are only supported if they are requirement invariants. + preconditions.add(new OnlyReqStateInvsInCompsCheck()); + + // State/event exclusion invariants are transformed into automata and must have a kind. + preconditions.add(new NoKindlessStateEvtExclInvsCheck()); + + // Discrete variables with multiple potential initial values are not supported. Actually, Supremica allows an + // initialization predicate, rather than a value, and the latest version seems to require initialization + // predicates instead of initial values. However, using 'x == 1 | x != 1' for a variable 'x' in range '0..9', + // in the latest version, seems to result in value '0' as initial value during simulation, without any way to + // get an other initial value. To be safe, we'll require a single initial value. + preconditions.add(new NoDiscVarsWithMultiInitValuesCheck()); + + // Continuous variables are not supported. + preconditions.add(new NoContinuousVariablesCheck()); + + // Input variables are not supported. + preconditions.add(new NoInputVariablesCheck()); + + // Multi-assignments, partial variable assignments and conditional updates on edges are not supported. + preconditions.add(new OnlySimpleAssignmentsCheck()); + + // Urgent locations and urgent edges are not supported. + preconditions.add(new NoUrgentLocationsCheck()); + preconditions.add(new NoUrgentEdgesCheck()); + + // User-defined functions are not supported. + preconditions.add(new NoUserDefinedFunctionsCheck()); + + // Channels are not supported. + preconditions.add(new NoChannelsCheck()); + + // Only the following data types are supported: boolean types, ranged integer types, and enumeration types. + NoSpecificTypesCheck typesCheck = new NoSpecificTypesCheck( // + NoSpecificType.DICT_TYPES, // + NoSpecificType.DIST_TYPES, // + NoSpecificType.FUNC_TYPES, // + NoSpecificType.INT_TYPES_RANGELESS, // + NoSpecificType.LIST_TYPES, // + NoSpecificType.REAL_TYPES, // + NoSpecificType.SET_TYPES, // + NoSpecificType.STRING_TYPES, // + NoSpecificType.TUPLE_TYPES); + preconditions.add(typesCheck); + + // Only the following expressions are supported: boolean literal values, integer literal values, binary + // expressions (partially, see below), unary expressions (partially, see below), and references to constants, + // discrete variables, enumeration literals, and casts that don’t change the type. + NoSpecificExprsCheck exprsCheck = new NoSpecificExprsCheck( // + NoSpecificExpr.CAST_EXPRS_NON_EQUAL_TYPE, // + NoSpecificExpr.DICT_LITS, // + NoSpecificExpr.FUNC_CALLS, // + NoSpecificExpr.IF_EXPRS, // + NoSpecificExpr.LIST_LITS, // + NoSpecificExpr.PROJECTION_EXPRS, // + NoSpecificExpr.REAL_LITS, // + NoSpecificExpr.SET_LITS, // + NoSpecificExpr.SLICE_EXPRS, // + NoSpecificExpr.STRING_LITS, // + NoSpecificExpr.SWITCH_EXPRS, // + NoSpecificExpr.TIME_VAR_REFS, // + NoSpecificExpr.TUPLE_LITS); + preconditions.add(exprsCheck); + + // Only the following binary operators are supported: logical equivalence (<=>), logical implication (=>), + // conjunction (and) on boolean operands, disjunction (or) on boolean operands, addition (+) on ranged integer + // operands, subtraction (-) on ranged integer operands, multiplication (*) on ranged integer operands, integer + // division (div) on ranged integer operands, integer modulus (mod) on ranged integer operands, equality (=), + // inequality (!=), less than (<) on ranged integer operands, less than or equal to (<=) on ranged integer + // operands, greater than (>) on ranged integer operands, and greater than or equal to (>=) on ranged integer + // operands. + NoSpecificBinaryExprsCheck binCheck = new NoSpecificBinaryExprsCheck( // + NoSpecificBinaryOp.CONJUNCTION_SETS, // + NoSpecificBinaryOp.DISJUNCTION_SETS, // + NoSpecificBinaryOp.ADDITION_DICTS, // + NoSpecificBinaryOp.ADDITION_INTS_RANGELESS, // + NoSpecificBinaryOp.ADDITION_LISTS, // + NoSpecificBinaryOp.ADDITION_REALS, // + NoSpecificBinaryOp.ADDITION_STRINGS, // + NoSpecificBinaryOp.SUBTRACTION_DICTS, // + NoSpecificBinaryOp.SUBTRACTION_INTS_RANGELESS, // + NoSpecificBinaryOp.SUBTRACTION_LISTS, // + NoSpecificBinaryOp.SUBTRACTION_REALS, // + NoSpecificBinaryOp.SUBTRACTION_SETS, // + NoSpecificBinaryOp.MULTIPLICATION_INTS_RANGELESS, // + NoSpecificBinaryOp.MULTIPLICATION_REALS, // + NoSpecificBinaryOp.INTEGER_DIVISION_INTS_RANGELESS, // + NoSpecificBinaryOp.MODULUS_INTS_RANGELESS, // + NoSpecificBinaryOp.GREATER_EQUAL_INTS_RANGELESS, // + NoSpecificBinaryOp.GREATER_EQUAL_REALS, // + NoSpecificBinaryOp.GREATER_THAN_INTS_RANGELESS, // + NoSpecificBinaryOp.GREATER_THAN_REALS, // + NoSpecificBinaryOp.LESS_EQUAL_INTS_RANGELESS, // + NoSpecificBinaryOp.LESS_EQUAL_REALS, // + NoSpecificBinaryOp.LESS_THAN_INTS_RANGELESS, // + NoSpecificBinaryOp.LESS_THAN_REALS, // + NoSpecificBinaryOp.DIVISION, // + NoSpecificBinaryOp.ELEMENT_OF, // + NoSpecificBinaryOp.SUBSET); + preconditions.add(binCheck); + + // Only the following unary operators are supported: logical inverse (not), negation (-) on a ranged integer + // operand, and plus (+) on a ranged integer operand. + NoSpecificUnaryExprsCheck unCheck = new NoSpecificUnaryExprsCheck( // + NoSpecificUnaryOp.NEGATE_INTS_RANGELESS, // + NoSpecificUnaryOp.NEGATE_REALS, // + NoSpecificUnaryOp.PLUS_INTS_RANGELESS, // + NoSpecificUnaryOp.PLUS_REALS, // + NoSpecificUnaryOp.SAMPLE); + preconditions.add(unCheck); + + // Perform precondition check. + new CifPreconditionChecker(preconditions).reportPreconditionViolations(spec, "CIF to Supremica transformation"); } } diff --git a/cif/org.eclipse.escet.cif.common/META-INF/MANIFEST.MF b/cif/org.eclipse.escet.cif.common/META-INF/MANIFEST.MF index be7aa87104bbe730357b31a56104ccb68871f588..9c858928cc0d59da9fdd28749ad85766fc27cd97 100644 --- a/cif/org.eclipse.escet.cif.common/META-INF/MANIFEST.MF +++ b/cif/org.eclipse.escet.cif.common/META-INF/MANIFEST.MF @@ -6,7 +6,8 @@ Bundle-Version: 0.6.0.qualifier Bundle-Vendor: Eclipse ESCET Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.escet.cif.common +Export-Package: org.eclipse.escet.cif.common, + org.eclipse.escet.cif.common.checkers Require-Bundle: org.eclipse.escet.cif.metamodel;bundle-version="0.6.0", org.eclipse.escet.common.java;bundle-version="0.6.0", org.eclipse.escet.cif.metamodel.java;bundle-version="0.6.0", diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/CifTextUtils.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/CifTextUtils.java index bb1312236a825ad24b75cc6a6c2c3242763681c1..f9aba5eba3b74feb668d75dfab8b56ba8ffe8755 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/CifTextUtils.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/CifTextUtils.java @@ -1217,6 +1217,50 @@ public class CifTextUtils { return rslt.toString(); } + /** + * Returns whether the given CIF object has a name. + * + *

+ * Note that {@link Specification}s are considered not to have a name, as the name can't be specified in the textual + * syntax, and is fixed in the metamodel. + *

+ * + *

+ * Note that {@link Field}s are considered not to have a name, even when they do have one, for compatibility with + * {@link #getName}. The caller should handle fields as a special case, if relevant. + *

+ * + * @param obj The CIF object for which to determine whether it has a name. + * @return Whether the CIF object has a name ({@code true}) or not ({@code false}). + * @see #getName + * @see #getAbsName + */ + public static boolean hasName(PositionObject obj) { + if (obj instanceof Specification) { + return false; // Explicitly 'false'. See method JavaDoc. + } else if (obj instanceof Component) { + return true; // Non-specification component. + } else if (obj instanceof ComponentDef) { + return true; + } else if (obj instanceof Parameter) { + return true; + } else if (obj instanceof Declaration) { + return true; + } else if (obj instanceof EnumLiteral) { + return true; + } else if (obj instanceof Location) { + return ((Location)obj).getName() != null; + } else if (obj instanceof Invariant) { + return ((Invariant)obj).getName() != null; + } else if (obj instanceof FunctionParameter) { + return true; + } else if (obj instanceof Field) { + return false; // Explicitly 'false'. See method JavaDoc. + } else { + return false; // Not a CIF object with a name. + } + } + /** * Returns the name of the given CIF object. Names that are keywords are not escaped. For specifications, {@code ""} * is returned. @@ -1228,6 +1272,7 @@ public class CifTextUtils { * * @param obj The CIF object for which to return the name. Must be a named object. * @return The name of the CIF object. + * @see #hasName */ public static String getName(PositionObject obj) { if (obj instanceof Component) { @@ -1283,6 +1328,21 @@ public class CifTextUtils { return getName(obj); } + /** + * Returns the object itself if it is itself a named object, the closest named ancestor of the given object if one + * exists, or {@code null} if the given object is itself not a named object, and also has no named ancestor. + * + * @param obj The given object. + * @return The given object itself (if named), its closest named ancestor (if any), or {@code null} (otherwise). + */ + public static PositionObject getNamedSelfOrAncestor(PositionObject obj) { + PositionObject cur = obj; + while (cur != null && !hasName(cur)) { + cur = (PositionObject)cur.eContainer(); + } + return cur; + } + /** * Returns an end-user readable textual (reference) representation of a location, mostly for use in error messages. * diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..18ad34bb3ce2280a03790a7779d059f3bf5ae060 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheck.java @@ -0,0 +1,26 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import org.eclipse.escet.cif.metamodel.java.CifWithArgWalker; + +/** + * CIF check. Checks whether a given CIF specification satisfies a certain condition. + * + * @implSpec Override only the relevant {@code preprocess*} and {@code postprocess*} methods. The {@code *crawl*} and + * {@code walk*} methods should not be overridden, as they are ignored by {@link CifChecker}. + */ +public abstract class CifCheck extends CifWithArgWalker { + // Nothing to do here. +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolation.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolation.java new file mode 100644 index 0000000000000000000000000000000000000000..ffb3c84f488774a4df8ebab20551fe54106f1e1d --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolation.java @@ -0,0 +1,73 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import static org.eclipse.escet.common.java.Strings.fmt; + +import java.util.Objects; + +import org.eclipse.escet.cif.common.CifTextUtils; +import org.eclipse.escet.common.java.Assert; +import org.eclipse.escet.common.position.metamodel.position.PositionObject; + +/** CIF check condition violation. */ +public class CifCheckViolation { + /** + * The named CIF object for which the violation is reported, or {@code null} to report it for the CIF specification. + */ + private final PositionObject cifObject; + + /** The message describing the violation. */ + private final String message; + + /** + * Constructor for the {@link CifCheckViolation} class. + * + * @param cifObject The named CIF object for which the violation is reported, or {@code null} to report it for the + * CIF specification. + * @param message The message describing the violation. E.g., {@code "event is a channel"}, + * {@code "automaton is a kindless automaton, lacking a supervisory kind"} or + * {@code "specification has no automata"}. + */ + public CifCheckViolation(PositionObject cifObject, String message) { + this.cifObject = cifObject; + this.message = message; + if (cifObject != null) { + Assert.check(CifTextUtils.hasName(cifObject), cifObject); + } + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof CifCheckViolation)) { + return false; + } + CifCheckViolation that = (CifCheckViolation)obj; + return this.cifObject == that.cifObject && this.message.equals(that.message); + } + + @Override + public int hashCode() { + return Objects.hash(cifObject, message); + } + + @Override + public String toString() { + String name = (cifObject == null) ? "specification" : "\"" + CifTextUtils.getAbsName(cifObject) + "\""; + return fmt("%s: %s.", name, message); + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolations.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolations.java new file mode 100644 index 0000000000000000000000000000000000000000..765f72490c935a31408a38ee392bd9f12df50eb5 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolations.java @@ -0,0 +1,58 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import static org.eclipse.escet.common.java.Sets.set; + +import java.util.Set; +import java.util.stream.Stream; + +import org.eclipse.escet.common.position.metamodel.position.PositionObject; + +/** CIF check condition violations. */ +public class CifCheckViolations { + /** The violations collected so far. */ + private final Set violations = set(); + + /** + * Returns whether any violations were collected so far. + * + * @return {@code true} if violations were collected, {@code false} otherwise. + */ + public boolean hasViolations() { + return !violations.isEmpty(); + } + + /** + * Returns the violations collected so far. + * + * @return The violations. + */ + public Stream getViolations() { + return violations.stream(); + } + + /** + * Add a violation. + * + * @param cifObject The named CIF object for which the violation is reported, or {@code null} to report it for the + * CIF specification. + * @param message The message describing the violation. E.g., {@code "event is a channel"}, + * {@code "automaton is a kindless automaton, lacking a supervisory kind"} or + * {@code "specification has no automata"}. + */ + public void add(PositionObject cifObject, String message) { + violations.add(new CifCheckViolation(cifObject, message)); + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifChecker.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifChecker.java new file mode 100644 index 0000000000000000000000000000000000000000..bde8a0165ddda1bb35f374f0c66cb5036db5054e --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifChecker.java @@ -0,0 +1,52 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import java.util.List; + +import org.eclipse.escet.cif.metamodel.cif.Specification; +import org.eclipse.escet.cif.metamodel.java.CompositeCifWithArgWalker; + +/** CIF checker. Checks whether a given CIF specification satisfies certain {@link CifCheck conditions}. */ +public class CifChecker extends CompositeCifWithArgWalker { + /** + * Constructor for the {@link CifChecker} class. + * + * @param conditions The conditions to check. + */ + public CifChecker(List conditions) { + super(conditions.toArray(i -> new CifCheck[i])); + } + + /** + * Constructor for the {@link CifChecker} class. + * + * @param conditions The conditions to check. + */ + public CifChecker(CifCheck[] conditions) { + super(conditions); + } + + /** + * Check whether a given CIF specification satisfies the given conditions. + * + * @param spec The CIF specification to check. + * @return The violations. + */ + public CifCheckViolations check(Specification spec) { + CifCheckViolations violations = new CifCheckViolations(); + walkSpecification(spec, violations); + return violations; + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifPreconditionChecker.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifPreconditionChecker.java new file mode 100644 index 0000000000000000000000000000000000000000..5056ba3bd0b2d5f0d68e3e15aa3b31f1f90d69b0 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifPreconditionChecker.java @@ -0,0 +1,68 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +import org.eclipse.escet.cif.metamodel.cif.Specification; +import org.eclipse.escet.common.app.framework.exceptions.UnsupportedException; +import org.eclipse.escet.common.java.Strings; + +/** + * CIF precondition checker. Checks whether a given CIF specification satisfies certain {@link CifCheck preconditions}. + */ +public class CifPreconditionChecker extends CifChecker { + /** + * Constructor for the {@link CifPreconditionChecker} class. + * + * @param preconditions The preconditions to check. + */ + public CifPreconditionChecker(List preconditions) { + super(preconditions); + } + + /** + * Constructor for the {@link CifPreconditionChecker} class. + * + * @param preconditions The preconditions to check. + */ + public CifPreconditionChecker(CifCheck[] preconditions) { + super(preconditions); + } + + /** + * Check whether a given CIF specification satisfies its preconditions. If any of the preconditions is violated, + * report that the tool failed to execute due to precondition violations indicating that the specification is + * unsupported. + * + * @param spec The CIF specification to check. + * @param toolName The human-readable name of the tool. + * @throws UnsupportedException If there are any precondition violations. + */ + public void reportPreconditionViolations(Specification spec, String toolName) { + // Check specification. + CifCheckViolations violations = check(spec); + + // Report unsupported specification, if there are any precondition violations. + if (violations.hasViolations()) { + List messages = violations.getViolations().map(v -> "Unsupported " + v.toString()) + .collect(Collectors.toList()); + Collections.sort(messages, Strings.SORTER); + String msg = toolName + " failed due to unsatisfied preconditions:\n - " + String.join("\n - ", messages); + throw new UnsupportedException(msg); + } + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoChannelsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoChannelsCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..37bd93d1aa44e4862bb6b6550a946cec2d1a4ce0 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoChannelsCheck.java @@ -0,0 +1,26 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import org.eclipse.escet.cif.metamodel.cif.declarations.Event; + +/** CIF check that does not allow channels. */ +public class NoChannelsCheck extends CifCheck { + @Override + protected void preprocessEvent(Event event, CifCheckViolations violations) { + if (event.getType() != null) { + violations.add(event, "event is a channel (has a data type)"); + } + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoContinuousVariablesCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoContinuousVariablesCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..19d3f97133778be4a6fb3e9a845cef5bb18a1699 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoContinuousVariablesCheck.java @@ -0,0 +1,24 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import org.eclipse.escet.cif.metamodel.cif.declarations.ContVariable; + +/** CIF check that does not allow continuous variables. */ +public class NoContinuousVariablesCheck extends CifCheck { + @Override + protected void preprocessContVariable(ContVariable var, CifCheckViolations violations) { + violations.add(var, "variable is a continuous variable"); + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoDiscVarsWithMultiInitValuesCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoDiscVarsWithMultiInitValuesCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..7dd1f18c160320fe32e261e2c645ae35154499c8 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoDiscVarsWithMultiInitValuesCheck.java @@ -0,0 +1,45 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import static org.eclipse.escet.common.java.Strings.fmt; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; +import org.eclipse.escet.cif.metamodel.cif.declarations.DiscVariable; + +/** CIF check that does not allow discrete variables with multiple potential initial values. */ +public class NoDiscVarsWithMultiInitValuesCheck extends CifCheck { + @Override + protected void preprocessDiscVariable(DiscVariable var, CifCheckViolations violations) { + // Ignore discrete variables that represent function parameters or local variables of functions. + EObject parent = var.eContainer(); + if (!(parent instanceof ComplexComponent)) { + return; + } + + // Ignore variables implicit default value. + if (var.getValue() == null) { + return; + } + + // Check number of potential initial values. + int count = var.getValue().getValues().size(); + if (count == 0) { // 0 means 'any' initial value. + violations.add(var, "discrete variable has multiple potential initial values (any value in its domain)"); + } else if (count > 1) { + violations.add(var, fmt("discrete variable has multiple (%d) potential initial values", count)); + } + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoIfUpdatesOnEdgesCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoIfUpdatesOnEdgesCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..b2175cb380e2044fe666304ec90ebeba087286c0 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoIfUpdatesOnEdgesCheck.java @@ -0,0 +1,45 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.metamodel.cif.automata.IfUpdate; +import org.eclipse.escet.cif.metamodel.cif.automata.Location; +import org.eclipse.escet.common.java.Assert; + +/** + * CIF check that does not allow 'if' updates on edges. + * + * @note This check is included in {@link OnlySimpleAssignmentsCheck}. + */ +public class NoIfUpdatesOnEdgesCheck extends CifCheck { + @Override + protected void preprocessIfUpdate(IfUpdate update, CifCheckViolations violations) { + // Get location. + EObject ancestor = update; + while (!(ancestor instanceof Location)) { + ancestor = ancestor.eContainer(); + } + Assert.check(ancestor instanceof Location); + Location loc = (Location)ancestor; + + // Report violation. + if (loc.getName() != null) { + violations.add(loc, "location has an edge with an 'if' update"); + } else { + violations.add((Automaton)loc.eContainer(), "automaton has an edge with an 'if' update"); + } + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoInitPredsInCompsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoInitPredsInCompsCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..36599fc51cbe4f46b8a3a8aeefeadca06bba73a1 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoInitPredsInCompsCheck.java @@ -0,0 +1,29 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; + +/** + * CIF check that does not allow initialization predicates in components, i.e., does not allow initialization predicates + * outside of locations. + */ +public class NoInitPredsInCompsCheck extends CifCheck { + @Override + protected void preprocessComplexComponent(ComplexComponent comp, CifCheckViolations violations) { + if (!comp.getInitials().isEmpty()) { + violations.add(comp, "component contains an initialization predicate"); + } + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoInputVariablesCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoInputVariablesCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..093a8d2cdc1bb6c57ddc937cc8f75814fcbd0cf5 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoInputVariablesCheck.java @@ -0,0 +1,24 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import org.eclipse.escet.cif.metamodel.cif.declarations.InputVariable; + +/** CIF check that does not allow input variables. */ +public class NoInputVariablesCheck extends CifCheck { + @Override + protected void preprocessInputVariable(InputVariable var, CifCheckViolations violations) { + violations.add(var, "variable is an input variable"); + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoKindlessAutomataCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoKindlessAutomataCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..d442888257a9e83c1b875bd74881b2cc2b544aee --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoKindlessAutomataCheck.java @@ -0,0 +1,27 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import org.eclipse.escet.cif.metamodel.cif.SupKind; +import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; + +/** CIF check that does not allow kindless automata (without a supervisory kind). */ +public class NoKindlessAutomataCheck extends CifCheck { + @Override + protected void preprocessAutomaton(Automaton aut, CifCheckViolations violations) { + if (aut.getKind() == SupKind.NONE) { + violations.add(aut, "automaton is a kindless automaton, lacking a supervisory kind"); + } + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoKindlessStateEvtExclInvsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoKindlessStateEvtExclInvsCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..1fa502d1b353bcd43a9cb327d5640f55dc2da754 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoKindlessStateEvtExclInvsCheck.java @@ -0,0 +1,56 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; +import org.eclipse.escet.cif.metamodel.cif.InvKind; +import org.eclipse.escet.cif.metamodel.cif.Invariant; +import org.eclipse.escet.cif.metamodel.cif.SupKind; +import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.metamodel.cif.automata.Location; + +/** CIF check that does not allow kindless state/event exclusion invariants (without a supervisory kind). */ +public class NoKindlessStateEvtExclInvsCheck extends CifCheck { + @Override + protected void preprocessComplexComponent(ComplexComponent comp, CifCheckViolations violations) { + for (Invariant inv: comp.getInvariants()) { + if (inv.getInvKind() == InvKind.EVENT_NEEDS || inv.getInvKind() == InvKind.EVENT_DISABLES) { + SupKind supKind = inv.getSupKind(); + if (supKind == SupKind.NONE) { + violations.add(comp, + "component has a kindless state/event exclusion invariant, lacking a supervisory kind"); + } + } + } + } + + @Override + protected void preprocessLocation(Location loc, CifCheckViolations violations) { + for (Invariant inv: loc.getInvariants()) { + if (inv.getInvKind() == InvKind.EVENT_NEEDS || inv.getInvKind() == InvKind.EVENT_DISABLES) { + SupKind supKind = inv.getSupKind(); + if (supKind == SupKind.NONE) { + if (loc.getName() != null) { + violations.add(loc, + "location has a kindless state/event exclusion invariant, lacking a supervisory kind"); + } else { + violations.add((Automaton)loc.eContainer(), + "automaton has a location with a kindless state/event exclusion invariant, " + + "lacking a supervisory kind"); + } + } + } + } + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoMultiAssignOnEdgesCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoMultiAssignOnEdgesCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..792990b9219aaf453468f3fe4db52d348bf182ec --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoMultiAssignOnEdgesCheck.java @@ -0,0 +1,49 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.escet.cif.metamodel.cif.automata.Assignment; +import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.metamodel.cif.automata.Location; +import org.eclipse.escet.cif.metamodel.cif.expressions.TupleExpression; +import org.eclipse.escet.common.java.Assert; + +/** + * CIF check that does not allow multi-assignments on edges. This check does not disallow multiple assignments on a + * single edge. + * + * @note This check is included in {@link OnlySimpleAssignmentsCheck}. + */ +public class NoMultiAssignOnEdgesCheck extends CifCheck { + @Override + protected void preprocessAssignment(Assignment asgn, CifCheckViolations violations) { + if (asgn.getAddressable() instanceof TupleExpression) { + // Get location. + EObject ancestor = asgn; + while (!(ancestor instanceof Location)) { + ancestor = ancestor.eContainer(); + } + Assert.check(ancestor instanceof Location); + Location loc = (Location)ancestor; + + // Report violation. + if (loc.getName() != null) { + violations.add(loc, "location has an edge with a multi-assignment"); + } else { + violations.add((Automaton)loc.eContainer(), "automaton has an edge with a multi-assignment"); + } + } + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoPartialVarAssignOnEdgesCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoPartialVarAssignOnEdgesCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..d54a81bd5b898b685805363bb33ed37b8c7a4fa7 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoPartialVarAssignOnEdgesCheck.java @@ -0,0 +1,48 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.escet.cif.metamodel.cif.automata.Assignment; +import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.metamodel.cif.automata.Location; +import org.eclipse.escet.cif.metamodel.cif.expressions.ProjectionExpression; +import org.eclipse.escet.common.java.Assert; + +/** + * CIF check that does not allow partial variable assignments on edges. + * + * @note This check is included in {@link OnlySimpleAssignmentsCheck}. + */ +public class NoPartialVarAssignOnEdgesCheck extends CifCheck { + @Override + protected void preprocessAssignment(Assignment asgn, CifCheckViolations violations) { + if (asgn.getAddressable() instanceof ProjectionExpression) { + // Get location. + EObject ancestor = asgn; + while (!(ancestor instanceof Location)) { + ancestor = ancestor.eContainer(); + } + Assert.check(ancestor instanceof Location); + Location loc = (Location)ancestor; + + // Report violation. + if (loc.getName() != null) { + violations.add(loc, "location has an edge with a partial variable assignment"); + } else { + violations.add((Automaton)loc.eContainer(), "automaton has an edge with a partial variable assignment"); + } + } + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoSpecificBinaryExprsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoSpecificBinaryExprsCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..342529da6b7cca0c0d67ed25798f5f8024db7a60 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoSpecificBinaryExprsCheck.java @@ -0,0 +1,636 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import static org.eclipse.escet.cif.common.CifTextUtils.exprToStr; +import static org.eclipse.escet.cif.common.CifTextUtils.getNamedSelfOrAncestor; +import static org.eclipse.escet.cif.common.CifTextUtils.operatorToStr; +import static org.eclipse.escet.cif.common.CifTextUtils.typeToStr; +import static org.eclipse.escet.common.java.Strings.fmt; + +import java.util.Arrays; +import java.util.EnumSet; + +import org.eclipse.escet.cif.common.CifTypeUtils; +import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryOperator; +import org.eclipse.escet.cif.metamodel.cif.types.CifType; +import org.eclipse.escet.cif.metamodel.cif.types.DictType; +import org.eclipse.escet.cif.metamodel.cif.types.IntType; +import org.eclipse.escet.cif.metamodel.cif.types.ListType; +import org.eclipse.escet.cif.metamodel.cif.types.RealType; +import org.eclipse.escet.cif.metamodel.cif.types.SetType; +import org.eclipse.escet.cif.metamodel.cif.types.StringType; + +/** CIF check that does not allow certain binary expressions. */ +public class NoSpecificBinaryExprsCheck extends CifCheck { + /** The binary operators, or binary operators operating on certain operand types, to disallow. */ + private final EnumSet disalloweds; + + /** + * Constructor for the {@link NoSpecificBinaryExprsCheck} class. + * + * @param disalloweds The binary operators, or binary operators operating on certain operand types, to disallow. + */ + public NoSpecificBinaryExprsCheck(NoSpecificBinaryOp... disalloweds) { + this(EnumSet.copyOf(Arrays.asList(disalloweds))); + } + + /** + * Constructor for the {@link NoSpecificBinaryExprsCheck} class. + * + * @param disalloweds The binary operators, or binary operators operating on certain operand types, to disallow. + */ + public NoSpecificBinaryExprsCheck(EnumSet disalloweds) { + this.disalloweds = disalloweds; + } + + @Override + protected void preprocessBinaryExpression(BinaryExpression binExpr, CifCheckViolations violations) { + BinaryOperator op = binExpr.getOperator(); + CifType ltype = CifTypeUtils.normalizeType(binExpr.getLeft().getType()); + CifType rtype = CifTypeUtils.normalizeType(binExpr.getRight().getType()); + switch (op) { + case ADDITION: + if (disalloweds.contains(NoSpecificBinaryOp.ADDITION)) { + addExprViolationOperator(binExpr, violations); + } else { + if (disalloweds.contains(NoSpecificBinaryOp.ADDITION_INTS)) { + if (ltype instanceof IntType || rtype instanceof IntType) { + addExprViolationOperand(binExpr, violations); + } + } else { + if (disalloweds.contains(NoSpecificBinaryOp.ADDITION_INTS_RANGED) + && ((ltype instanceof IntType && !CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && !CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + if (disalloweds.contains(NoSpecificBinaryOp.ADDITION_INTS_RANGELESS) + && ((ltype instanceof IntType && CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + } + if (disalloweds.contains(NoSpecificBinaryOp.ADDITION_REALS) + && (ltype instanceof RealType || rtype instanceof RealType)) + { + addExprViolationOperand(binExpr, violations); + } + if (disalloweds.contains(NoSpecificBinaryOp.ADDITION_LISTS) + && (ltype instanceof ListType || rtype instanceof ListType)) + { + addExprViolationOperand(binExpr, violations); + } + if (disalloweds.contains(NoSpecificBinaryOp.ADDITION_STRINGS) + && (ltype instanceof StringType || rtype instanceof StringType)) + { + addExprViolationOperand(binExpr, violations); + } + if (disalloweds.contains(NoSpecificBinaryOp.ADDITION_DICTS) + && (ltype instanceof DictType || rtype instanceof DictType)) + { + addExprViolationOperand(binExpr, violations); + } + } + break; + case BI_CONDITIONAL: + if (disalloweds.contains(NoSpecificBinaryOp.BI_CONDITIONAL)) { + addExprViolationOperator(binExpr, violations); + } + break; + case CONJUNCTION: + if (disalloweds.contains(NoSpecificBinaryOp.CONJUNCTION)) { + addExprViolationOperator(binExpr, violations); + } else if (disalloweds.contains(NoSpecificBinaryOp.CONJUNCTION_SETS) + && (ltype instanceof SetType || rtype instanceof SetType)) + { + addExprViolationOperand(binExpr, violations); + } + break; + case DISJUNCTION: + if (disalloweds.contains(NoSpecificBinaryOp.DISJUNCTION)) { + addExprViolationOperator(binExpr, violations); + } else if (disalloweds.contains(NoSpecificBinaryOp.DISJUNCTION_SETS) + && (ltype instanceof SetType || rtype instanceof SetType)) + { + addExprViolationOperand(binExpr, violations); + } + break; + case DIVISION: + if (disalloweds.contains(NoSpecificBinaryOp.DIVISION)) { + addExprViolationOperator(binExpr, violations); + } + break; + case ELEMENT_OF: + if (disalloweds.contains(NoSpecificBinaryOp.ELEMENT_OF)) { + addExprViolationOperator(binExpr, violations); + } else { + if (disalloweds.contains(NoSpecificBinaryOp.ELEMENT_OF_LISTS) + && (ltype instanceof ListType || rtype instanceof ListType)) + { + addExprViolationOperand(binExpr, violations); + } + if (disalloweds.contains(NoSpecificBinaryOp.ELEMENT_OF_SETS) + && (ltype instanceof SetType || rtype instanceof SetType)) + { + addExprViolationOperand(binExpr, violations); + } + if (disalloweds.contains(NoSpecificBinaryOp.ELEMENT_OF_DICTS) + && (ltype instanceof DictType || rtype instanceof DictType)) + { + addExprViolationOperand(binExpr, violations); + } + } + break; + case EQUAL: + if (disalloweds.contains(NoSpecificBinaryOp.EQUAL)) { + addExprViolationOperator(binExpr, violations); + } + break; + case GREATER_EQUAL: + if (disalloweds.contains(NoSpecificBinaryOp.GREATER_EQUAL)) { + addExprViolationOperator(binExpr, violations); + } else { + if (disalloweds.contains(NoSpecificBinaryOp.GREATER_EQUAL_INTS)) { + if (ltype instanceof IntType || rtype instanceof IntType) { + addExprViolationOperand(binExpr, violations); + } + } else { + if (disalloweds.contains(NoSpecificBinaryOp.GREATER_EQUAL_INTS_RANGED) + && ((ltype instanceof IntType && !CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && !CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + if (disalloweds.contains(NoSpecificBinaryOp.GREATER_EQUAL_INTS_RANGELESS) + && ((ltype instanceof IntType && CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + } + if (disalloweds.contains(NoSpecificBinaryOp.GREATER_EQUAL_REALS) + && (ltype instanceof RealType || rtype instanceof RealType)) + { + addExprViolationOperand(binExpr, violations); + } + } + break; + case GREATER_THAN: + if (disalloweds.contains(NoSpecificBinaryOp.GREATER_THAN)) { + addExprViolationOperator(binExpr, violations); + } else { + if (disalloweds.contains(NoSpecificBinaryOp.GREATER_THAN_INTS)) { + if (ltype instanceof IntType || rtype instanceof IntType) { + addExprViolationOperand(binExpr, violations); + } + } else { + if (disalloweds.contains(NoSpecificBinaryOp.GREATER_THAN_INTS_RANGED) + && ((ltype instanceof IntType && !CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && !CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + if (disalloweds.contains(NoSpecificBinaryOp.GREATER_THAN_INTS_RANGELESS) + && ((ltype instanceof IntType && CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + } + if (disalloweds.contains(NoSpecificBinaryOp.GREATER_THAN_REALS) + && (ltype instanceof RealType || rtype instanceof RealType)) + { + addExprViolationOperand(binExpr, violations); + } + } + break; + case IMPLICATION: + if (disalloweds.contains(NoSpecificBinaryOp.IMPLICATION)) { + addExprViolationOperator(binExpr, violations); + } + break; + case INTEGER_DIVISION: + if (disalloweds.contains(NoSpecificBinaryOp.INTEGER_DIVISION)) { + addExprViolationOperator(binExpr, violations); + } else { + if (disalloweds.contains(NoSpecificBinaryOp.INTEGER_DIVISION_INTS)) { + if (ltype instanceof IntType || rtype instanceof IntType) { + addExprViolationOperand(binExpr, violations); + } + } else { + if (disalloweds.contains(NoSpecificBinaryOp.INTEGER_DIVISION_INTS_RANGED) + && ((ltype instanceof IntType && !CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && !CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + if (disalloweds.contains(NoSpecificBinaryOp.INTEGER_DIVISION_INTS_RANGELESS) + && ((ltype instanceof IntType && CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + } + } + break; + case LESS_EQUAL: + if (disalloweds.contains(NoSpecificBinaryOp.LESS_EQUAL)) { + addExprViolationOperator(binExpr, violations); + } else { + if (disalloweds.contains(NoSpecificBinaryOp.LESS_EQUAL_INTS)) { + if (ltype instanceof IntType || rtype instanceof IntType) { + addExprViolationOperand(binExpr, violations); + } + } else { + if (disalloweds.contains(NoSpecificBinaryOp.LESS_EQUAL_INTS_RANGED) + && ((ltype instanceof IntType && !CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && !CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + if (disalloweds.contains(NoSpecificBinaryOp.LESS_EQUAL_INTS_RANGELESS) + && ((ltype instanceof IntType && CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + } + if (disalloweds.contains(NoSpecificBinaryOp.LESS_EQUAL_REALS) + && (ltype instanceof RealType || rtype instanceof RealType)) + { + addExprViolationOperand(binExpr, violations); + } + } + break; + case LESS_THAN: + if (disalloweds.contains(NoSpecificBinaryOp.LESS_THAN)) { + addExprViolationOperator(binExpr, violations); + } else { + if (disalloweds.contains(NoSpecificBinaryOp.LESS_THAN_INTS)) { + if (ltype instanceof IntType || rtype instanceof IntType) { + addExprViolationOperand(binExpr, violations); + } + } else { + if (disalloweds.contains(NoSpecificBinaryOp.LESS_THAN_INTS_RANGED) + && ((ltype instanceof IntType && !CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && !CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + if (disalloweds.contains(NoSpecificBinaryOp.LESS_THAN_INTS_RANGELESS) + && ((ltype instanceof IntType && CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + } + if (disalloweds.contains(NoSpecificBinaryOp.LESS_THAN_REALS) + && (ltype instanceof RealType || rtype instanceof RealType)) + { + addExprViolationOperand(binExpr, violations); + } + } + break; + case MODULUS: + if (disalloweds.contains(NoSpecificBinaryOp.MODULUS)) { + addExprViolationOperator(binExpr, violations); + } else { + if (disalloweds.contains(NoSpecificBinaryOp.MODULUS_INTS)) { + if (ltype instanceof IntType || rtype instanceof IntType) { + addExprViolationOperand(binExpr, violations); + } + } else { + if (disalloweds.contains(NoSpecificBinaryOp.MODULUS_INTS_RANGED) + && ((ltype instanceof IntType && !CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && !CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + if (disalloweds.contains(NoSpecificBinaryOp.MODULUS_INTS_RANGELESS) + && ((ltype instanceof IntType && CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + } + } + break; + case MULTIPLICATION: + if (disalloweds.contains(NoSpecificBinaryOp.MULTIPLICATION)) { + addExprViolationOperator(binExpr, violations); + } else { + if (disalloweds.contains(NoSpecificBinaryOp.MULTIPLICATION_INTS)) { + if (ltype instanceof IntType || rtype instanceof IntType) { + addExprViolationOperand(binExpr, violations); + } + } else { + if (disalloweds.contains(NoSpecificBinaryOp.MULTIPLICATION_INTS_RANGED) + && ((ltype instanceof IntType && !CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && !CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + if (disalloweds.contains(NoSpecificBinaryOp.MULTIPLICATION_INTS_RANGELESS) + && ((ltype instanceof IntType && CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + } + if (disalloweds.contains(NoSpecificBinaryOp.MULTIPLICATION_REALS) + && (ltype instanceof RealType || rtype instanceof RealType)) + { + addExprViolationOperand(binExpr, violations); + } + } + break; + case SUBSET: + if (disalloweds.contains(NoSpecificBinaryOp.SUBSET)) { + addExprViolationOperator(binExpr, violations); + } + break; + case SUBTRACTION: + if (disalloweds.contains(NoSpecificBinaryOp.SUBTRACTION)) { + addExprViolationOperator(binExpr, violations); + } else { + if (disalloweds.contains(NoSpecificBinaryOp.SUBTRACTION_INTS)) { + if (ltype instanceof IntType || rtype instanceof IntType) { + addExprViolationOperand(binExpr, violations); + } + } else { + if (disalloweds.contains(NoSpecificBinaryOp.SUBTRACTION_INTS_RANGED) + && ((ltype instanceof IntType && !CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && !CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + if (disalloweds.contains(NoSpecificBinaryOp.SUBTRACTION_INTS_RANGELESS) + && ((ltype instanceof IntType && CifTypeUtils.isRangeless((IntType)ltype)) + || (rtype instanceof IntType && CifTypeUtils.isRangeless((IntType)rtype)))) + { + addExprViolationOperand(binExpr, violations); + } + } + if (disalloweds.contains(NoSpecificBinaryOp.SUBTRACTION_REALS) + && (ltype instanceof RealType || rtype instanceof RealType)) + { + addExprViolationOperand(binExpr, violations); + } + if (disalloweds.contains(NoSpecificBinaryOp.SUBTRACTION_LISTS) + && (ltype instanceof ListType || rtype instanceof ListType)) + { + addExprViolationOperand(binExpr, violations); + } + if (disalloweds.contains(NoSpecificBinaryOp.SUBTRACTION_SETS) + && (ltype instanceof SetType || rtype instanceof SetType)) + { + addExprViolationOperand(binExpr, violations); + } + if (disalloweds.contains(NoSpecificBinaryOp.SUBTRACTION_DICTS) + && (ltype instanceof DictType || rtype instanceof DictType)) + { + addExprViolationOperand(binExpr, violations); + } + } + break; + case UNEQUAL: + if (disalloweds.contains(NoSpecificBinaryOp.UNEQUAL)) { + addExprViolationOperator(binExpr, violations); + } + break; + default: + throw new RuntimeException("Unknown binary operator: " + op); + } + } + + /** + * Add a violation for the operator of the given binary expression. + * + * @param binExpr The binary expression. + * @param violations The violations collected so far. Is modified in-place. + */ + private void addExprViolationOperator(BinaryExpression binExpr, CifCheckViolations violations) { + violations.add(getNamedSelfOrAncestor(binExpr), fmt("uses binary operator \"%s\" in binary expression \"%s\"", + operatorToStr(binExpr.getOperator()), exprToStr(binExpr))); + } + + /** + * Add a violation for an operand of the the given binary expression. + * + * @param binExpr The binary expression. + * @param violations The violations collected so far. Is modified in-place. + */ + private void addExprViolationOperand(BinaryExpression binExpr, CifCheckViolations violations) { + CifType ltype = CifTypeUtils.normalizeType(binExpr.getLeft().getType()); + CifType rtype = CifTypeUtils.normalizeType(binExpr.getRight().getType()); + violations.add(getNamedSelfOrAncestor(binExpr), + fmt("uses binary operator \"%s\" on operands of types \"%s\" and \"%s\" in binary expression \"%s\"", + operatorToStr(binExpr.getOperator()), typeToStr(ltype), typeToStr(rtype), exprToStr(binExpr))); + } + + /** The binary operator, or binary operator operating on certain operand types, to disallow. */ + public static enum NoSpecificBinaryOp { + /** Disallow {@link BinaryOperator#ADDITION}. */ + ADDITION, + + /** Disallow {@link BinaryOperator#ADDITION} on integers. */ + ADDITION_INTS, + + /** Disallow {@link BinaryOperator#ADDITION} on ranged integers. */ + ADDITION_INTS_RANGED, + + /** Disallow {@link BinaryOperator#ADDITION} on rangeless integers. */ + ADDITION_INTS_RANGELESS, + + /** Disallow {@link BinaryOperator#ADDITION} on reals. */ + ADDITION_REALS, + + /** Disallow {@link BinaryOperator#ADDITION} on lists. */ + ADDITION_LISTS, + + /** Disallow {@link BinaryOperator#ADDITION} on strings. */ + ADDITION_STRINGS, + + /** Disallow {@link BinaryOperator#ADDITION} on dictionaries. */ + ADDITION_DICTS, + + /** Disallow {@link BinaryOperator#BI_CONDITIONAL}. */ + BI_CONDITIONAL, + + /** Disallow {@link BinaryOperator#CONJUNCTION}. */ + CONJUNCTION, + + /** Disallow {@link BinaryOperator#CONJUNCTION} on sets. */ + CONJUNCTION_SETS, + + /** Disallow {@link BinaryOperator#DISJUNCTION}. */ + DISJUNCTION, + + /** Disallow {@link BinaryOperator#DISJUNCTION} on sets. */ + DISJUNCTION_SETS, + + /** Disallow {@link BinaryOperator#DIVISION}. */ + DIVISION, + + /** Disallow {@link BinaryOperator#ELEMENT_OF}. */ + ELEMENT_OF, + + /** Disallow {@link BinaryOperator#ELEMENT_OF} on lists. */ + ELEMENT_OF_LISTS, + + /** Disallow {@link BinaryOperator#ELEMENT_OF} on sets. */ + ELEMENT_OF_SETS, + + /** Disallow {@link BinaryOperator#ELEMENT_OF} on dictionaries. */ + ELEMENT_OF_DICTS, + + /** Disallow {@link BinaryOperator#EQUAL}. */ + EQUAL, + + /** Disallow {@link BinaryOperator#GREATER_EQUAL}. */ + GREATER_EQUAL, + + /** Disallow {@link BinaryOperator#GREATER_EQUAL} on integers. */ + GREATER_EQUAL_INTS, + + /** Disallow {@link BinaryOperator#GREATER_EQUAL} on ranged integers. */ + GREATER_EQUAL_INTS_RANGED, + + /** Disallow {@link BinaryOperator#GREATER_EQUAL} on rangeless integers. */ + GREATER_EQUAL_INTS_RANGELESS, + + /** Disallow {@link BinaryOperator#GREATER_EQUAL} on reals. */ + GREATER_EQUAL_REALS, + + /** Disallow {@link BinaryOperator#GREATER_THAN}. */ + GREATER_THAN, + + /** Disallow {@link BinaryOperator#GREATER_THAN} on integers. */ + GREATER_THAN_INTS, + + /** Disallow {@link BinaryOperator#GREATER_THAN} on ranged integers. */ + GREATER_THAN_INTS_RANGED, + + /** Disallow {@link BinaryOperator#GREATER_THAN} on rangeless integers. */ + GREATER_THAN_INTS_RANGELESS, + + /** Disallow {@link BinaryOperator#GREATER_THAN} on reals. */ + GREATER_THAN_REALS, + + /** Disallow {@link BinaryOperator#IMPLICATION}. */ + IMPLICATION, + + /** Disallow {@link BinaryOperator#INTEGER_DIVISION}. */ + INTEGER_DIVISION, + + /** Disallow {@link BinaryOperator#INTEGER_DIVISION} on integers. */ + INTEGER_DIVISION_INTS, + + /** Disallow {@link BinaryOperator#INTEGER_DIVISION} on ranged integers. */ + INTEGER_DIVISION_INTS_RANGED, + + /** Disallow {@link BinaryOperator#INTEGER_DIVISION} on rangeless integers. */ + INTEGER_DIVISION_INTS_RANGELESS, + + /** Disallow {@link BinaryOperator#LESS_EQUAL}. */ + LESS_EQUAL, + + /** Disallow {@link BinaryOperator#LESS_EQUAL} on integers. */ + LESS_EQUAL_INTS, + + /** Disallow {@link BinaryOperator#LESS_EQUAL} on ranged integers. */ + LESS_EQUAL_INTS_RANGED, + + /** Disallow {@link BinaryOperator#LESS_EQUAL} on rangeless integers. */ + LESS_EQUAL_INTS_RANGELESS, + + /** Disallow {@link BinaryOperator#LESS_EQUAL} on reals. */ + LESS_EQUAL_REALS, + + /** Disallow {@link BinaryOperator#LESS_THAN}. */ + LESS_THAN, + + /** Disallow {@link BinaryOperator#LESS_THAN} on integers. */ + LESS_THAN_INTS, + + /** Disallow {@link BinaryOperator#LESS_THAN} on ranged integers. */ + LESS_THAN_INTS_RANGED, + + /** Disallow {@link BinaryOperator#LESS_THAN} on rangeless integers. */ + LESS_THAN_INTS_RANGELESS, + + /** Disallow {@link BinaryOperator#LESS_THAN} on reals. */ + LESS_THAN_REALS, + + /** Disallow {@link BinaryOperator#MODULUS}. */ + MODULUS, + + /** Disallow {@link BinaryOperator#MODULUS} on integers. */ + MODULUS_INTS, + + /** Disallow {@link BinaryOperator#MODULUS} on ranged integers. */ + MODULUS_INTS_RANGED, + + /** Disallow {@link BinaryOperator#MODULUS} on rangeless integers. */ + MODULUS_INTS_RANGELESS, + + /** Disallow {@link BinaryOperator#MULTIPLICATION}. */ + MULTIPLICATION, + + /** Disallow {@link BinaryOperator#MULTIPLICATION} on integers. */ + MULTIPLICATION_INTS, + + /** Disallow {@link BinaryOperator#MULTIPLICATION} on ranged integers. */ + MULTIPLICATION_INTS_RANGED, + + /** Disallow {@link BinaryOperator#MULTIPLICATION} on rangeless integers. */ + MULTIPLICATION_INTS_RANGELESS, + + /** Disallow {@link BinaryOperator#MULTIPLICATION} on reals. */ + MULTIPLICATION_REALS, + + /** Disallow {@link BinaryOperator#SUBSET}. */ + SUBSET, + + /** Disallow {@link BinaryOperator#SUBTRACTION}. */ + SUBTRACTION, + + /** Disallow {@link BinaryOperator#SUBTRACTION} on integers. */ + SUBTRACTION_INTS, + + /** Disallow {@link BinaryOperator#SUBTRACTION} on ranged integers. */ + SUBTRACTION_INTS_RANGED, + + /** Disallow {@link BinaryOperator#SUBTRACTION} on rangeless integers. */ + SUBTRACTION_INTS_RANGELESS, + + /** Disallow {@link BinaryOperator#SUBTRACTION} on reals. */ + SUBTRACTION_REALS, + + /** Disallow {@link BinaryOperator#SUBTRACTION} on lists. */ + SUBTRACTION_LISTS, + + /** Disallow {@link BinaryOperator#SUBTRACTION} on sets. */ + SUBTRACTION_SETS, + + /** Disallow {@link BinaryOperator#SUBTRACTION} on dictionaries. */ + SUBTRACTION_DICTS, + + /** Disallow {@link BinaryOperator#UNEQUAL}. */ + UNEQUAL, + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoSpecificExprsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoSpecificExprsCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..078c4f62ad73120b0bd28ea928582c5b97177853 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoSpecificExprsCheck.java @@ -0,0 +1,526 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import static org.eclipse.escet.cif.common.CifTextUtils.exprToStr; +import static org.eclipse.escet.cif.common.CifTextUtils.getNamedSelfOrAncestor; +import static org.eclipse.escet.common.java.Strings.fmt; + +import java.util.Arrays; +import java.util.EnumSet; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.escet.cif.common.CifTypeUtils; +import org.eclipse.escet.cif.common.RangeCompat; +import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; +import org.eclipse.escet.cif.metamodel.cif.expressions.AlgVariableExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.BoolExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.CastExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.CompParamExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ComponentExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ConstantExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ContVariableExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.DictExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.DiscVariableExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.EnumLiteralExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.Expression; +import org.eclipse.escet.cif.metamodel.cif.expressions.FieldExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.FunctionCallExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.FunctionExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.IfExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.InputVariableExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.IntExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ListExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.LocationExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ProjectionExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.RealExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ReceivedExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.SelfExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.SetExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.SliceExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.StdLibFunctionExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.StringExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.SwitchExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.TimeExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.TupleExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.UnaryExpression; +import org.eclipse.escet.cif.metamodel.cif.functions.ExternalFunction; +import org.eclipse.escet.cif.metamodel.cif.functions.FunctionParameter; +import org.eclipse.escet.cif.metamodel.cif.functions.InternalFunction; +import org.eclipse.escet.cif.metamodel.cif.types.CifType; +import org.eclipse.escet.cif.metamodel.cif.types.DictType; +import org.eclipse.escet.cif.metamodel.cif.types.IntType; +import org.eclipse.escet.cif.metamodel.cif.types.ListType; +import org.eclipse.escet.cif.metamodel.cif.types.StringType; +import org.eclipse.escet.cif.metamodel.cif.types.TupleType; + +/** CIF check that does not allow certain expressions. */ +public class NoSpecificExprsCheck extends CifCheck { + /** The expressions to disallow. */ + private final EnumSet disalloweds; + + /** + * Constructor for the {@link NoSpecificExprsCheck} class. + * + * @param disalloweds The expressions to disallow. + */ + public NoSpecificExprsCheck(NoSpecificExpr... disalloweds) { + this(EnumSet.copyOf(Arrays.asList(disalloweds))); + } + + /** + * Constructor for the {@link NoSpecificExprsCheck} class. + * + * @param disalloweds The expressions to disallow. + */ + public NoSpecificExprsCheck(EnumSet disalloweds) { + this.disalloweds = disalloweds; + } + + @Override + protected void preprocessAlgVariableExpression(AlgVariableExpression algRef, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.ALG_VAR_REFS)) { + addExprViolation(algRef, "algebraic variable reference", violations); + } + } + + @Override + protected void preprocessFunctionExpression(FunctionExpression userDefFuncRef, CifCheckViolations violations) { + if ((disalloweds.contains(NoSpecificExpr.FUNC_REFS) || disalloweds.contains(NoSpecificExpr.FUNC_REFS_USER_DEF) + || disalloweds.contains(NoSpecificExpr.FUNC_REFS_USER_DEF_INT)) + && userDefFuncRef.getFunction() instanceof InternalFunction) + { + addExprViolation(userDefFuncRef, "internal user-defined function reference", violations); + } + + if ((disalloweds.contains(NoSpecificExpr.FUNC_REFS) || disalloweds.contains(NoSpecificExpr.FUNC_REFS_USER_DEF) + || disalloweds.contains(NoSpecificExpr.FUNC_REFS_USER_DEF_EXT)) + && userDefFuncRef.getFunction() instanceof ExternalFunction) + { + addExprViolation(userDefFuncRef, "external user-defined function reference", violations); + } + } + + @Override + protected void preprocessStdLibFunctionExpression(StdLibFunctionExpression stdLibRef, + CifCheckViolations violations) + { + if (disalloweds.contains(NoSpecificExpr.FUNC_REFS) || disalloweds.contains(NoSpecificExpr.FUNC_REFS_STD_LIB)) { + addExprViolation(stdLibRef, "standard library function reference", violations); + } + } + + @Override + protected void preprocessBinaryExpression(BinaryExpression binExpr, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.BINARY_EXPRS)) { + addExprViolation(binExpr, "binary expression", violations); + } + } + + @Override + protected void preprocessBoolExpression(BoolExpression boolLit, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.BOOL_LITS)) { + addExprViolation(boolLit, "boolean literal", violations); + } + } + + @Override + protected void preprocessCastExpression(CastExpression castExpr, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.CAST_EXPRS)) { + addExprViolation(castExpr, "cast expression", violations); + } else if (disalloweds.contains(NoSpecificExpr.CAST_EXPRS_NON_EQUAL_TYPE)) { + CifType ctype = castExpr.getChild().getType(); + CifType rtype = castExpr.getType(); + if (CifTypeUtils.checkTypeCompat(ctype, rtype, RangeCompat.EQUAL)) { + // Ignore casting to the child type. + return; + } + addExprViolation(castExpr, "type-changing cast expression", violations); + } + } + + @Override + protected void preprocessComponentExpression(ComponentExpression compRef, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.COMP_REFS) || disalloweds.contains(NoSpecificExpr.COMP_REFS_EXPLICIT)) { + addExprViolation(compRef, "component reference", violations); + } + } + + @Override + protected void preprocessCompParamExpression(CompParamExpression compParamRef, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.COMP_PARAM_REFS)) { + addExprViolation(compParamRef, "component parameter reference", violations); + } + } + + @Override + protected void preprocessConstantExpression(ConstantExpression constRef, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.CONST_REFS)) { + addExprViolation(constRef, "constant reference", violations); + } + } + + @Override + protected void preprocessContVariableExpression(ContVariableExpression contRef, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.CONT_VAR_REFS)) { + addExprViolation(contRef, "continuous variable reference", violations); + } + } + + @Override + protected void preprocessDictExpression(DictExpression dictLit, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.DICT_LITS)) { + addExprViolation(dictLit, "dictionary literal", violations); + } + } + + @Override + protected void preprocessDiscVariableExpression(DiscVariableExpression discRef, CifCheckViolations violations) { + EObject parent = discRef.getVariable().eContainer(); + if (parent instanceof ComplexComponent) { + if (disalloweds.contains(NoSpecificExpr.DISC_VAR_REFS)) { + addExprViolation(discRef, "discrete variable reference", violations); + } + } else if (parent instanceof FunctionParameter) { + if (disalloweds.contains(NoSpecificExpr.USER_DEF_FUNC_PARAM_REFS)) { + addExprViolation(discRef, "user-defined function parameter reference", violations); + } + } else if (parent instanceof InternalFunction) { + if (disalloweds.contains(NoSpecificExpr.INT_USER_DEF_FUNC_LOCAL_VAR_REFS)) { + addExprViolation(discRef, "internal user-defined function local variable reference", violations); + } + } else { + throw new RuntimeException("Unexpected disc var parent: " + parent); + } + } + + @Override + protected void preprocessEnumLiteralExpression(EnumLiteralExpression enumLitRef, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.ENUM_LIT_REFS)) { + addExprViolation(enumLitRef, "enumeration literal reference", violations); + } + } + + @Override + protected void preprocessFieldExpression(FieldExpression fieldRef, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.TUPLE_FIELD_REFS)) { + addExprViolation(fieldRef, "tuple field reference", violations); + } + } + + @Override + protected void preprocessFunctionCallExpression(FunctionCallExpression funcCall, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.FUNC_CALLS)) { + addExprViolation(funcCall, "function call", violations); + } + } + + @Override + protected void preprocessIfExpression(IfExpression ifExpr, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.IF_EXPRS)) { + addExprViolation(ifExpr, "conditional expression", violations); + } + } + + @Override + protected void preprocessInputVariableExpression(InputVariableExpression inputRef, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.INPUT_VAR_REFS)) { + addExprViolation(inputRef, "input variable reference", violations); + } + } + + @Override + protected void preprocessIntExpression(IntExpression intLit, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.INT_LITS)) { + addExprViolation(intLit, "integer number literal", violations); + } + } + + @Override + protected void preprocessListExpression(ListExpression listLit, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.LIST_LITS)) { + addExprViolation(listLit, "list literal", violations); + } + } + + @Override + protected void preprocessLocationExpression(LocationExpression locRef, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.LOC_REFS)) { + addExprViolation(locRef, "location reference", violations); + } + } + + @Override + protected void preprocessProjectionExpression(ProjectionExpression projExpr, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.PROJECTION_EXPRS)) { + addExprViolation(projExpr, "projection expression", violations); + } else { + if (disalloweds.contains(NoSpecificExpr.PROJECTION_EXPRS_LISTS)) { + CifType ctype = CifTypeUtils.normalizeType(projExpr.getChild().getType()); + if (ctype instanceof ListType) { + addExprViolation(projExpr, "list projection expression", violations); + } + } + if (disalloweds.contains(NoSpecificExpr.PROJECTION_EXPRS_DICTS)) { + CifType ctype = CifTypeUtils.normalizeType(projExpr.getChild().getType()); + if (ctype instanceof DictType) { + addExprViolation(projExpr, "dictionary projection expression", violations); + } + } + if (disalloweds.contains(NoSpecificExpr.PROJECTION_EXPRS_STRINGS)) { + CifType ctype = CifTypeUtils.normalizeType(projExpr.getChild().getType()); + if (ctype instanceof StringType) { + addExprViolation(projExpr, "string projection expression", violations); + } + } + if (disalloweds.contains(NoSpecificExpr.PROJECTION_EXPRS_TUPLES)) { + CifType ctype = CifTypeUtils.normalizeType(projExpr.getChild().getType()); + if (ctype instanceof TupleType) { + addExprViolation(projExpr, "tuple projection expression", violations); + } + } else { + if (disalloweds.contains(NoSpecificExpr.PROJECTION_EXPRS_TUPLES_INDEX)) { + CifType ctype = CifTypeUtils.normalizeType(projExpr.getChild().getType()); + CifType itype = CifTypeUtils.normalizeType(projExpr.getIndex().getType()); + if (ctype instanceof TupleType && itype instanceof IntType) { + addExprViolation(projExpr, "tuple index-projection expression", violations); + } + } + if (disalloweds.contains(NoSpecificExpr.PROJECTION_EXPRS_TUPLES_FIELD)) { + CifType ctype = CifTypeUtils.normalizeType(projExpr.getChild().getType()); + if (ctype instanceof TupleType && projExpr.getIndex() instanceof FieldExpression) { + addExprViolation(projExpr, "tuple field-projection expression", violations); + } + } + } + } + } + + @Override + protected void preprocessRealExpression(RealExpression realLit, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.REAL_LITS)) { + addExprViolation(realLit, "real number literal", violations); + } + } + + @Override + protected void preprocessReceivedExpression(ReceivedExpression receivedExpr, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.RECEIVE_EXPRS)) { + addExprViolation(receivedExpr, "received value expression", violations); + } + } + + @Override + protected void preprocessSelfExpression(SelfExpression selfRef, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.COMP_REFS) || disalloweds.contains(NoSpecificExpr.COMP_REFS_SELF)) { + addExprViolation(selfRef, "component reference", violations); + } + } + + @Override + protected void preprocessSetExpression(SetExpression setLit, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.SET_LITS)) { + addExprViolation(setLit, "set literal", violations); + } + } + + @Override + protected void preprocessSliceExpression(SliceExpression sliceExpr, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.SLICE_EXPRS)) { + addExprViolation(sliceExpr, "slice expression", violations); + } + } + + @Override + protected void preprocessStringExpression(StringExpression stringLit, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.STRING_LITS)) { + addExprViolation(stringLit, "string literal", violations); + } + } + + @Override + protected void preprocessSwitchExpression(SwitchExpression switchExpr, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.SWITCH_EXPRS)) { + addExprViolation(switchExpr, "switch expression", violations); + } + } + + @Override + protected void preprocessTimeExpression(TimeExpression timeRef, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.TIME_VAR_REFS)) { + addExprViolation(timeRef, "time variable reference", violations); + } + } + + @Override + protected void preprocessTupleExpression(TupleExpression tupleLit, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.TUPLE_LITS)) { + addExprViolation(tupleLit, "tuple literal", violations); + } + } + + @Override + protected void preprocessUnaryExpression(UnaryExpression unExpr, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificExpr.UNARY_EXPRS)) { + addExprViolation(unExpr, "unary expression", violations); + } + } + + /** + * Add a violation for the given expression. + * + * @param expr The expression. + * @param description The description of the expression. + * @param violations The violations collected so far. Is modified in-place. + */ + private void addExprViolation(Expression expr, String description, CifCheckViolations violations) { + violations.add(getNamedSelfOrAncestor(expr), fmt("uses %s \"%s\"", description, exprToStr(expr))); + } + + /** The expression to disallow. */ + public static enum NoSpecificExpr { + /** Disallow references to algebraic variables. */ + ALG_VAR_REFS, + + /** Disallow references to all functions (user-defined and standard library ones). */ + FUNC_REFS, + + /** Disallow references to all user-defined functions (internal and external ones). */ + FUNC_REFS_USER_DEF, + + /** Disallow references to internal user-defined functions. */ + FUNC_REFS_USER_DEF_INT, + + /** Disallow references to external user-defined functions. */ + FUNC_REFS_USER_DEF_EXT, + + /** Disallow references to standard library functions. */ + FUNC_REFS_STD_LIB, + + /** Disallow all binary expressions. */ + BINARY_EXPRS, + + /** Disallow boolean literals. */ + BOOL_LITS, + + /** Disallow all cast expressions. */ + CAST_EXPRS, + + /** Disallow cast expressions that cast to a different type. */ + CAST_EXPRS_NON_EQUAL_TYPE, + + /** Disallow all component references (explicit components and 'self' references). */ + COMP_REFS, + + /** Disallow explicit component references. */ + COMP_REFS_EXPLICIT, + + /** Disallow component 'self' references. */ + COMP_REFS_SELF, + + /** Disallow component parameter references. */ + COMP_PARAM_REFS, + + /** Disallow constant references. */ + CONST_REFS, + + /** Disallow continuous variable references. */ + CONT_VAR_REFS, + + /** Disallow dictionary literals. */ + DICT_LITS, + + /** Disallow discrete variable references. */ + DISC_VAR_REFS, + + /** Disallow user-defined function parameter references. */ + USER_DEF_FUNC_PARAM_REFS, + + /** Disallow references to local variables of internal user-defined functions. */ + INT_USER_DEF_FUNC_LOCAL_VAR_REFS, + + /** Disallow enumeration literal references. */ + ENUM_LIT_REFS, + + /** Disallow tuple field references. */ + TUPLE_FIELD_REFS, + + /** Disallow function calls (for user-defined functions and standard library functions). */ + FUNC_CALLS, + + /** Disallow 'if' expressions (conditional expressions). */ + IF_EXPRS, + + /** Disallow input variable references. */ + INPUT_VAR_REFS, + + /** Disallow integer number literals. */ + INT_LITS, + + /** Disallow list literals. */ + LIST_LITS, + + /** Disallow location references. */ + LOC_REFS, + + /** Disallow projection expressions. */ + PROJECTION_EXPRS, + + /** Disallow projection expressions on lists. */ + PROJECTION_EXPRS_LISTS, + + /** Disallow projection expressions on dictionaries. */ + PROJECTION_EXPRS_DICTS, + + /** Disallow projection expressions on strings. */ + PROJECTION_EXPRS_STRINGS, + + /** Disallow projection expressions on tuples. */ + PROJECTION_EXPRS_TUPLES, + + /** Disallow projection expressions on tuples using index. */ + PROJECTION_EXPRS_TUPLES_INDEX, + + /** Disallow projection expressions on tuples using field. */ + PROJECTION_EXPRS_TUPLES_FIELD, + + /** Disallow real number expressions. */ + REAL_LITS, + + /** Disallow received value expressions. */ + RECEIVE_EXPRS, + + /** Disallow set literals. */ + SET_LITS, + + /** Disallow slice expressions. */ + SLICE_EXPRS, + + /** Disallow string literals. */ + STRING_LITS, + + /** Disallow switch expressions. */ + SWITCH_EXPRS, + + /** Disallow 'time' variable references. */ + TIME_VAR_REFS, + + /** Disallow tuple literal expressions. */ + TUPLE_LITS, + + /** Disallow all unary expressions. */ + UNARY_EXPRS, + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoSpecificTypesCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoSpecificTypesCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..f3081a828b291d50b877eb3306a07ee6f435a2dc --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoSpecificTypesCheck.java @@ -0,0 +1,215 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import static org.eclipse.escet.cif.common.CifTextUtils.getNamedSelfOrAncestor; +import static org.eclipse.escet.cif.common.CifTextUtils.typeToStr; +import static org.eclipse.escet.common.java.Strings.fmt; + +import java.util.Arrays; +import java.util.EnumSet; + +import org.eclipse.escet.cif.common.CifTypeUtils; +import org.eclipse.escet.cif.metamodel.cif.types.CifType; +import org.eclipse.escet.cif.metamodel.cif.types.ComponentDefType; +import org.eclipse.escet.cif.metamodel.cif.types.ComponentType; +import org.eclipse.escet.cif.metamodel.cif.types.DictType; +import org.eclipse.escet.cif.metamodel.cif.types.DistType; +import org.eclipse.escet.cif.metamodel.cif.types.EnumType; +import org.eclipse.escet.cif.metamodel.cif.types.FuncType; +import org.eclipse.escet.cif.metamodel.cif.types.IntType; +import org.eclipse.escet.cif.metamodel.cif.types.ListType; +import org.eclipse.escet.cif.metamodel.cif.types.RealType; +import org.eclipse.escet.cif.metamodel.cif.types.SetType; +import org.eclipse.escet.cif.metamodel.cif.types.StringType; +import org.eclipse.escet.cif.metamodel.cif.types.TupleType; +import org.eclipse.escet.cif.metamodel.cif.types.VoidType; + +/** CIF check that does not allow certain types. */ +public class NoSpecificTypesCheck extends CifCheck { + /** The types, or sub-types, to disallow. */ + private final EnumSet disalloweds; + + /** + * Constructor for the {@link NoSpecificTypesCheck} class. + * + * @param disalloweds The types, or sub-types, to disallow. + */ + public NoSpecificTypesCheck(NoSpecificType... disalloweds) { + this(EnumSet.copyOf(Arrays.asList(disalloweds))); + } + + /** + * Constructor for the {@link NoSpecificTypesCheck} class. + * + * @param disalloweds The types, or sub-types, to disallow. + */ + public NoSpecificTypesCheck(EnumSet disalloweds) { + this.disalloweds = disalloweds; + } + + @Override + protected void preprocessComponentDefType(ComponentDefType compDefType, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificType.COMP_DEF_TYPES)) { + addTypeViolation(compDefType, "component definition type", violations); + } + } + + @Override + protected void preprocessComponentType(ComponentType compType, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificType.COMP_TYPES)) { + addTypeViolation(compType, "component type", violations); + } + } + + @Override + protected void preprocessDictType(DictType dictType, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificType.DICT_TYPES)) { + addTypeViolation(dictType, "dictionary type", violations); + } + } + + @Override + protected void preprocessDistType(DistType distType, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificType.DIST_TYPES)) { + addTypeViolation(distType, "distribution type", violations); + } + } + + @Override + protected void preprocessEnumType(EnumType enumType, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificType.ENUM_TYPES)) { + addTypeViolation(enumType, "enumeration type", violations); + } + } + + @Override + protected void preprocessFuncType(FuncType funcType, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificType.FUNC_TYPES)) { + addTypeViolation(funcType, "function type", violations); + } + } + + @Override + protected void preprocessIntType(IntType intType, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificType.INT_TYPES)) { + addTypeViolation(intType, "integer type", violations); + } else if (disalloweds.contains(NoSpecificType.INT_TYPES_RANGELESS) && CifTypeUtils.isRangeless(intType)) { + addTypeViolation(intType, "rangeless integer type", violations); + } + } + + @Override + protected void preprocessListType(ListType listType, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificType.LIST_TYPES)) { + addTypeViolation(listType, "list type", violations); + } else if (disalloweds.contains(NoSpecificType.LIST_TYPES_NON_ARRAY) && !CifTypeUtils.isArrayType(listType)) { + addTypeViolation(listType, "non-array list type", violations); + } + } + + @Override + protected void preprocessRealType(RealType realType, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificType.REAL_TYPES)) { + addTypeViolation(realType, "real type", violations); + } + } + + @Override + protected void preprocessSetType(SetType setType, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificType.SET_TYPES)) { + addTypeViolation(setType, "set type", violations); + } + } + + @Override + protected void preprocessStringType(StringType stringType, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificType.STRING_TYPES)) { + addTypeViolation(stringType, "string type", violations); + } + } + + @Override + protected void preprocessTupleType(TupleType tupleType, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificType.TUPLE_TYPES)) { + addTypeViolation(tupleType, "tuple type", violations); + } + } + + @Override + protected void preprocessVoidType(VoidType voidType, CifCheckViolations violations) { + if (disalloweds.contains(NoSpecificType.VOID_TYPES)) { + addTypeViolation(voidType, "void type", violations); + } + } + + /** + * Add a violation for the given type. + * + * @param type The type. + * @param description The description of the type. + * @param violations The violations collected so far. Is modified in-place. + */ + private void addTypeViolation(CifType type, String description, CifCheckViolations violations) { + violations.add(getNamedSelfOrAncestor(type), fmt("uses %s \"%s\"", description, typeToStr(type))); + } + + /** The type, or sub-type, to disallow. */ + public static enum NoSpecificType { + /** Disallow component definition types. */ + COMP_DEF_TYPES, + + /** Disallow component types. */ + COMP_TYPES, + + /** Disallow dictionary types. */ + DICT_TYPES, + + /** Disallow distribution types. */ + DIST_TYPES, + + /** Disallow enumeration types. */ + ENUM_TYPES, + + /** Disallow function types. Note that this includes standard library function types. */ + FUNC_TYPES, + + /** Disallow all integer types (ranged and rangeless ones). */ + INT_TYPES, + + /** Disallow rangeless integer types. */ + INT_TYPES_RANGELESS, + + /** Disallow all list types (array and non-array ones). */ + LIST_TYPES, + + /** Disallow non-array list types. */ + LIST_TYPES_NON_ARRAY, + + /** Disallow real types. */ + REAL_TYPES, + + /** Disallow set types. */ + SET_TYPES, + + /** Disallow string types. */ + STRING_TYPES, + + /** Disallow tuple types. Note that tuple types are also used for multi-assignments. */ + TUPLE_TYPES, + + /** Disallow void types (of channels). */ + VOID_TYPES, + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoSpecificUnaryExprsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoSpecificUnaryExprsCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..cff9f172125725dbe455a234d37a39aa4ebcc2f7 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoSpecificUnaryExprsCheck.java @@ -0,0 +1,187 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import static org.eclipse.escet.cif.common.CifTextUtils.exprToStr; +import static org.eclipse.escet.cif.common.CifTextUtils.getNamedSelfOrAncestor; +import static org.eclipse.escet.cif.common.CifTextUtils.operatorToStr; +import static org.eclipse.escet.cif.common.CifTextUtils.typeToStr; +import static org.eclipse.escet.common.java.Strings.fmt; + +import java.util.Arrays; +import java.util.EnumSet; + +import org.eclipse.escet.cif.common.CifTypeUtils; +import org.eclipse.escet.cif.metamodel.cif.expressions.UnaryExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.UnaryOperator; +import org.eclipse.escet.cif.metamodel.cif.types.CifType; +import org.eclipse.escet.cif.metamodel.cif.types.IntType; +import org.eclipse.escet.cif.metamodel.cif.types.RealType; + +/** CIF check that does not allow certain unary expressions. */ +public class NoSpecificUnaryExprsCheck extends CifCheck { + /** The unary operators, or unary operators operating on certain operand types, to disallow. */ + private final EnumSet disalloweds; + + /** + * Constructor for the {@link NoSpecificUnaryExprsCheck} class. + * + * @param disalloweds The unary operators, or unary operators operating on certain operand types, to disallow. + */ + public NoSpecificUnaryExprsCheck(NoSpecificUnaryOp... disalloweds) { + this(EnumSet.copyOf(Arrays.asList(disalloweds))); + } + + /** + * Constructor for the {@link NoSpecificUnaryExprsCheck} class. + * + * @param disalloweds The unary operators, or unary operators operating on certain operand types, to disallow. + */ + public NoSpecificUnaryExprsCheck(EnumSet disalloweds) { + this.disalloweds = disalloweds; + } + + @Override + protected void preprocessUnaryExpression(UnaryExpression unExpr, CifCheckViolations violations) { + UnaryOperator op = unExpr.getOperator(); + CifType ctype = CifTypeUtils.normalizeType(unExpr.getChild().getType()); + switch (op) { + case INVERSE: + if (disalloweds.contains(NoSpecificUnaryOp.INVERSE)) { + addExprViolationOperator(unExpr, violations); + } + break; + case NEGATE: + if (disalloweds.contains(NoSpecificUnaryOp.NEGATE)) { + addExprViolationOperator(unExpr, violations); + } else { + if (disalloweds.contains(NoSpecificUnaryOp.NEGATE_INTS)) { + if (ctype instanceof IntType) { + addExprViolationOperand(unExpr, violations); + } + } else { + if (disalloweds.contains(NoSpecificUnaryOp.NEGATE_INTS_RANGED) && ctype instanceof IntType + && !CifTypeUtils.isRangeless((IntType)ctype)) + { + addExprViolationOperand(unExpr, violations); + } + if (disalloweds.contains(NoSpecificUnaryOp.NEGATE_INTS_RANGELESS) && ctype instanceof IntType + && CifTypeUtils.isRangeless((IntType)ctype)) + { + addExprViolationOperand(unExpr, violations); + } + } + if (disalloweds.contains(NoSpecificUnaryOp.NEGATE_REALS) && ctype instanceof RealType) { + addExprViolationOperand(unExpr, violations); + } + } + break; + case PLUS: + if (disalloweds.contains(NoSpecificUnaryOp.PLUS)) { + addExprViolationOperator(unExpr, violations); + } else { + if (disalloweds.contains(NoSpecificUnaryOp.PLUS_INTS)) { + if (ctype instanceof IntType) { + addExprViolationOperand(unExpr, violations); + } + } else { + if (disalloweds.contains(NoSpecificUnaryOp.PLUS_INTS_RANGED) && ctype instanceof IntType + && !CifTypeUtils.isRangeless((IntType)ctype)) + { + addExprViolationOperand(unExpr, violations); + } + if (disalloweds.contains(NoSpecificUnaryOp.PLUS_INTS_RANGELESS) && ctype instanceof IntType + && CifTypeUtils.isRangeless((IntType)ctype)) + { + addExprViolationOperand(unExpr, violations); + } + } + if (disalloweds.contains(NoSpecificUnaryOp.PLUS_REALS) && ctype instanceof RealType) { + addExprViolationOperand(unExpr, violations); + } + } + break; + case SAMPLE: + if (disalloweds.contains(NoSpecificUnaryOp.SAMPLE)) { + addExprViolationOperator(unExpr, violations); + } + break; + default: + throw new RuntimeException("Unknown unary operator: " + op); + } + } + + /** + * Add a violation for the operator of the given unary expression. + * + * @param unExpr The unary expression. + * @param violations The violations collected so far. Is modified in-place. + */ + private void addExprViolationOperator(UnaryExpression unExpr, CifCheckViolations violations) { + violations.add(getNamedSelfOrAncestor(unExpr), fmt("uses unary operator \"%s\" in unary expression \"%s\"", + operatorToStr(unExpr.getOperator()), exprToStr(unExpr))); + } + + /** + * Add a violation for an operand of the the given unary expression. + * + * @param unExpr The unary expression. + * @param violations The violations collected so far. Is modified in-place. + */ + private void addExprViolationOperand(UnaryExpression unExpr, CifCheckViolations violations) { + CifType ctype = CifTypeUtils.normalizeType(unExpr.getChild().getType()); + violations.add(getNamedSelfOrAncestor(unExpr), + fmt("uses unary operator \"%s\" on an operand of type \"%s\" in unary expression \"%s\"", + operatorToStr(unExpr.getOperator()), typeToStr(ctype), exprToStr(unExpr))); + } + + /** The unary operator, or unary operator operating on certain operand types, to disallow. */ + public static enum NoSpecificUnaryOp { + /** Disallow {@link UnaryOperator#INVERSE}. */ + INVERSE, + + /** Disallow {@link UnaryOperator#NEGATE}. */ + NEGATE, + + /** Disallow {@link UnaryOperator#NEGATE} on integer numbers. */ + NEGATE_INTS, + + /** Disallow {@link UnaryOperator#NEGATE} on ranged integer numbers. */ + NEGATE_INTS_RANGED, + + /** Disallow {@link UnaryOperator#NEGATE} on rangeless integer numbers. */ + NEGATE_INTS_RANGELESS, + + /** Disallow {@link UnaryOperator#NEGATE} on real numbers. */ + NEGATE_REALS, + + /** Disallow {@link UnaryOperator#PLUS}. */ + PLUS, + + /** Disallow {@link UnaryOperator#PLUS} on integer numbers. */ + PLUS_INTS, + + /** Disallow {@link UnaryOperator#PLUS} on ranged integer numbers. */ + PLUS_INTS_RANGED, + + /** Disallow {@link UnaryOperator#PLUS} on rangeless integer numbers. */ + PLUS_INTS_RANGELESS, + + /** Disallow {@link UnaryOperator#PLUS} on real numbers. */ + PLUS_REALS, + + /** Disallow {@link UnaryOperator#SAMPLE}. */ + SAMPLE, + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoStateInvsInLocsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoStateInvsInLocsCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..4d52ecb1315c2c75b0bfbcd7aaed3ccf2db4c069 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoStateInvsInLocsCheck.java @@ -0,0 +1,44 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.escet.cif.metamodel.cif.InvKind; +import org.eclipse.escet.cif.metamodel.cif.Invariant; +import org.eclipse.escet.cif.metamodel.cif.LocationParameter; +import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.metamodel.cif.automata.Location; + +/** CIF check that does not allow state invariants in locations. */ +public class NoStateInvsInLocsCheck extends CifCheck { + @Override + protected void preprocessLocation(Location loc, CifCheckViolations violations) { + // Skip location parameters. + EObject parent = loc.eContainer(); + if (parent instanceof LocationParameter) { + return; + } + + // Check for violation. + for (Invariant inv: loc.getInvariants()) { + if (inv.getInvKind() == InvKind.STATE) { + if (loc.getName() != null) { + violations.add(loc, "location has a state invariant"); + } else { + violations.add((Automaton)loc.eContainer(), "automaton has a location with a state invariant"); + } + } + } + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoTauCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoTauCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..3a65da4cc5c8122ba499eb6a05338cdeb22ebf72 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoTauCheck.java @@ -0,0 +1,55 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import org.eclipse.escet.cif.common.CifEdgeUtils; +import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.metamodel.cif.automata.Edge; +import org.eclipse.escet.cif.metamodel.cif.automata.EdgeEvent; +import org.eclipse.escet.cif.metamodel.cif.automata.Location; +import org.eclipse.escet.cif.metamodel.cif.expressions.TauExpression; + +/** + * CIF check that does not allow the use of event 'tau', whether explicit or implicit. + * + * @note This check is included in {@link OnlyEventsWithControllabilityCheck}. + */ +public class NoTauCheck extends CifCheck { + @Override + protected void preprocessTauExpression(TauExpression tauExpr, CifCheckViolations violations) { + // Explicit tau. + EdgeEvent edgeEvent = (EdgeEvent)tauExpr.eContainer(); + Edge edge = (Edge)edgeEvent.eContainer(); + Location loc = CifEdgeUtils.getSource(edge); + if (loc.getName() != null) { + violations.add(loc, "location has an edge with explicitly event \"tau\" on it"); + } else { + violations.add((Automaton)loc.eContainer(), "automaton has an edge with explicitly event \"tau\" on it"); + } + } + + @Override + protected void preprocessEdge(Edge edge, CifCheckViolations violations) { + // Implicit tau. + if (edge.getEvents().isEmpty()) { + Location loc = CifEdgeUtils.getSource(edge); + if (loc.getName() != null) { + violations.add(loc, "location has an edge with implicitly event \"tau\" on it"); + } else { + violations.add((Automaton)loc.eContainer(), + "automaton has an edge with implicitly event \"tau\" on it"); + } + } + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoUrgentEdgesCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoUrgentEdgesCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..7151d5bb14a72f69871bc1bcd64ffb76807b61fc --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoUrgentEdgesCheck.java @@ -0,0 +1,33 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.metamodel.cif.automata.Edge; +import org.eclipse.escet.cif.metamodel.cif.automata.Location; + +/** CIF check that does not allow urgent edges. */ +public class NoUrgentEdgesCheck extends CifCheck { + @Override + protected void preprocessEdge(Edge edge, CifCheckViolations violations) { + if (edge.isUrgent()) { + Location loc = (Location)edge.eContainer(); + if (loc.getName() != null) { + violations.add(loc, "location has an urgent edge"); + } else { + violations.add((Automaton)loc.eContainer(), "automaton has an urgent edge"); + } + } + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoUrgentLocationsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoUrgentLocationsCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..7695b55484307143f0dbc1fde42078255773af8e --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoUrgentLocationsCheck.java @@ -0,0 +1,40 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.escet.cif.metamodel.cif.LocationParameter; +import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.metamodel.cif.automata.Location; + +/** CIF check that does not allow urgent locations. */ +public class NoUrgentLocationsCheck extends CifCheck { + @Override + protected void preprocessLocation(Location loc, CifCheckViolations violations) { + // Skip location parameters. + EObject parent = loc.eContainer(); + if (parent instanceof LocationParameter) { + return; + } + + // Check for violation. + if (loc.isUrgent()) { + if (loc.getName() != null) { + violations.add(loc, "location is urgent"); + } else { + violations.add((Automaton)loc.eContainer(), "automaton has an urgent location"); + } + } + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoUserDefinedFunctionsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoUserDefinedFunctionsCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..6082f1a14dba4235d982c863228d38a9b7d192aa --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/NoUserDefinedFunctionsCheck.java @@ -0,0 +1,24 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import org.eclipse.escet.cif.metamodel.cif.functions.Function; + +/** CIF check that does not allow user-defined functions. */ +public class NoUserDefinedFunctionsCheck extends CifCheck { + @Override + protected void preprocessFunction(Function func, CifCheckViolations violations) { + violations.add(func, "function is a user-defined function"); + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlyAutsWithOneInitLocCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlyAutsWithOneInitLocCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..ee6e57f40c78306e171631487169060e8ef1178f --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlyAutsWithOneInitLocCheck.java @@ -0,0 +1,91 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import static org.eclipse.escet.cif.common.CifEvalUtils.evalPreds; +import static org.eclipse.escet.common.java.Strings.fmt; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.escet.cif.common.CifEvalException; +import org.eclipse.escet.cif.metamodel.cif.LocationParameter; +import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.metamodel.cif.automata.Location; +import org.eclipse.escet.common.app.framework.exceptions.UnsupportedException; + +/** + * CIF check that allows automata only if they have exactly one initial location. Automata for which this can not be + * determined statically, are also not allowed. + */ +public class OnlyAutsWithOneInitLocCheck extends CifCheck { + /** + * The number of initial locations found for the automaton being checked. Only valid while checking an automaton. Is + * set to {@code -1} to disable this check due to evaluation errors in initialization predicates. + */ + private int initLocCount; + + @Override + protected void preprocessAutomaton(Automaton aut, CifCheckViolations violations) { + // Reset initial locations counter. + initLocCount = 0; + } + + @Override + protected void postprocessAutomaton(Automaton aut, CifCheckViolations violations) { + // There must be exactly one initial location. + if (initLocCount == 0) { + violations.add(aut, "automaton has no initial location"); + } else if (initLocCount > 1) { + violations.add(aut, fmt("automata has multiple (%d) initial locations", initLocCount)); + } // Skip if check is disabled (negative value). + } + + @Override + protected void preprocessLocation(Location loc, CifCheckViolations violations) { + // Skip location parameters. + EObject parent = loc.eContainer(); + if (parent instanceof LocationParameter) { + return; + } + + // Determine whether location is an initial location by statically evaluating the location's initialization + // predicates. + boolean initial = false; + String errMsg = null; + try { + initial = loc.getInitials().isEmpty() ? false : evalPreds(loc.getInitials(), true, true); + } catch (UnsupportedException e) { + // Can only fail if there is at least one predicate. + errMsg = "as one of its initialization predicates can not be statically evaluated"; + } catch (CifEvalException e) { + // Can only fail if there is at least one predicate. + errMsg = "as evaluating one of its initialization predicates resulted in an evaluation error"; + } + if (errMsg != null) { + if (loc.getName() != null) { + violations.add(loc, "failed to determine whether this is an initial location, " + errMsg); + } else { + violations.add((Automaton)loc.eContainer(), + "failed to determine whether the automaton's location is an initial location, " + errMsg); + } + + // Disable initial location count checking. + initLocCount = -1; + } + + // Update number of initial locations, if not disabled for this automaton. + if (initial && initLocCount != -1) { + initLocCount++; + } + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlyEventsWithControllabilityCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlyEventsWithControllabilityCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..100df9af9a61764cf82972b7fddba67436923a7b --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlyEventsWithControllabilityCheck.java @@ -0,0 +1,66 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import org.eclipse.escet.cif.common.CifEdgeUtils; +import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.metamodel.cif.automata.Edge; +import org.eclipse.escet.cif.metamodel.cif.automata.EdgeEvent; +import org.eclipse.escet.cif.metamodel.cif.automata.Location; +import org.eclipse.escet.cif.metamodel.cif.declarations.Event; +import org.eclipse.escet.cif.metamodel.cif.expressions.TauExpression; + +/** + * CIF check that allows events only if they are declared as controllable or uncontrollable. + * + * @note This check includes {@link NoTauCheck}. + */ +public class OnlyEventsWithControllabilityCheck extends CifCheck { + @Override + protected void preprocessEvent(Event event, CifCheckViolations violations) { + if (event.getControllable() == null) { + violations.add(event, "event is not declared as controllable or uncontrollable"); + } + } + + @Override + protected void preprocessTauExpression(TauExpression tauExpr, CifCheckViolations violations) { + // Explicit tau. + EdgeEvent edgeEvent = (EdgeEvent)tauExpr.eContainer(); + Edge edge = (Edge)edgeEvent.eContainer(); + Location loc = CifEdgeUtils.getSource(edge); + if (loc.getName() != null) { + violations.add(loc, "location has an edge with explicitly event \"tau\" on it, " + + "which is not controllable or uncontrollable"); + } else { + violations.add((Automaton)loc.eContainer(), "automaton has an edge with explicitly event \"tau\" on it, " + + "which is not controllable or uncontrollable"); + } + } + + @Override + protected void preprocessEdge(Edge edge, CifCheckViolations violations) { + // Implicit tau. + if (edge.getEvents().isEmpty()) { + Location loc = CifEdgeUtils.getSource(edge); + if (loc.getName() != null) { + violations.add(loc, "location has an edge with implicitly event \"tau\" on it, " + + "which is not controllable or uncontrollable"); + } else { + violations.add((Automaton)loc.eContainer(), "automaton has an edge with implicitly event \"tau\" on " + + "it, which is not controllable or uncontrollable"); + } + } + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlyReqStateInvsInCompsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlyReqStateInvsInCompsCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..a6a775a1abfd2b2d57a1a34af2ea4324d6764366 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlyReqStateInvsInCompsCheck.java @@ -0,0 +1,38 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import static org.eclipse.escet.common.java.Strings.fmt; + +import org.eclipse.escet.cif.common.CifTextUtils; +import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; +import org.eclipse.escet.cif.metamodel.cif.InvKind; +import org.eclipse.escet.cif.metamodel.cif.Invariant; +import org.eclipse.escet.cif.metamodel.cif.SupKind; + +/** CIF check that allows state invariants in components only if they are requirement invariants. */ +public class OnlyReqStateInvsInCompsCheck extends CifCheck { + @Override + protected void preprocessComplexComponent(ComplexComponent comp, CifCheckViolations violations) { + for (Invariant inv: comp.getInvariants()) { + if (inv.getInvKind() == InvKind.STATE) { + SupKind supKind = inv.getSupKind(); + if (supKind != SupKind.REQUIREMENT) { + String kindTxt = (supKind == SupKind.NONE) ? "kindless" : CifTextUtils.kindToStr(supKind); + violations.add(comp, fmt("component has a %s state invariant", kindTxt)); + } + } + } + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlySimpleAssignmentsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlySimpleAssignmentsCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..9eb11db155af1ed50696af4daceafaafec94b9b3 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlySimpleAssignmentsCheck.java @@ -0,0 +1,46 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import org.eclipse.escet.cif.metamodel.cif.automata.Assignment; +import org.eclipse.escet.cif.metamodel.cif.automata.IfUpdate; + +/** + * CIF check that allows updates on edges only if they are simple assignments, i.e., no 'if' updates, multi-assignments + * and partial variable assignments. + * + * @note This check includes {@link NoIfUpdatesOnEdgesCheck}, {@link NoMultiAssignOnEdgesCheck} and + * {@link NoPartialVarAssignOnEdgesCheck}. + */ +public class OnlySimpleAssignmentsCheck extends CifCheck { + /** No 'if' updates check. */ + private NoIfUpdatesOnEdgesCheck noIf = new NoIfUpdatesOnEdgesCheck(); + + /** No multi-assignments check. */ + private NoMultiAssignOnEdgesCheck noMulti = new NoMultiAssignOnEdgesCheck(); + + /** No partial variable assignments check. */ + private NoPartialVarAssignOnEdgesCheck noPartial = new NoPartialVarAssignOnEdgesCheck(); + + @Override + protected void preprocessIfUpdate(IfUpdate update, CifCheckViolations violations) { + noIf.preprocessIfUpdate(update, violations); + } + + @Override + protected void preprocessAssignment(Assignment asgn, CifCheckViolations violations) { + noMulti.preprocessAssignment(asgn, violations); + noPartial.preprocessAssignment(asgn, violations); + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlyStaticEvalMarkerPredsInLocsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlyStaticEvalMarkerPredsInLocsCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..39bd2155e6a9281044650b67cbd25464536fc979 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlyStaticEvalMarkerPredsInLocsCheck.java @@ -0,0 +1,57 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import static org.eclipse.escet.cif.common.CifEvalUtils.evalPreds; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.escet.cif.common.CifEvalException; +import org.eclipse.escet.cif.metamodel.cif.LocationParameter; +import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.metamodel.cif.automata.Location; +import org.eclipse.escet.common.app.framework.exceptions.UnsupportedException; + +/** CIF check that allows marker predicates in locations only if they can be evaluated statically. */ +public class OnlyStaticEvalMarkerPredsInLocsCheck extends CifCheck { + @Override + protected void preprocessLocation(Location loc, CifCheckViolations violations) { + // Skip location parameters. + EObject parent = loc.eContainer(); + if (parent instanceof LocationParameter) { + return; + } + + // Check for violation. + if (!loc.getMarkeds().isEmpty()) { + try { + evalPreds(loc.getMarkeds(), false, true); + } catch (UnsupportedException e) { + if (loc.getName() != null) { + violations.add(loc, "location has a marker predicate that can not be evaluated statically"); + } else { + violations.add((Automaton)loc.eContainer(), + "automaton has a location with a marker predicate that can not be evaluated statically"); + } + } catch (CifEvalException e) { + if (loc.getName() != null) { + violations.add(loc, + "static evaluation of a marker predicate in the location resulted in an evaluation error"); + } else { + violations.add((Automaton)loc.eContainer(), "static evaluation of a marker predicate in the " + + "location of the automaton resulted in an evaluation error"); + } + } + } + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlyVarValueMarkerPredsInCompsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlyVarValueMarkerPredsInCompsCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..022012ad1a17a76a6af76ebe758f377837481c20 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/OnlyVarValueMarkerPredsInCompsCheck.java @@ -0,0 +1,63 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers; + +import static org.eclipse.escet.common.java.Maps.map; + +import java.util.Map; + +import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; +import org.eclipse.escet.cif.metamodel.cif.declarations.DiscVariable; +import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryOperator; +import org.eclipse.escet.cif.metamodel.cif.expressions.DiscVariableExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.Expression; + +/** + * CIF check that allows marker predicates in components only if they are of the form 'discrete_variable = + * marked_value', and only at most one per discrete variable. + */ +public class OnlyVarValueMarkerPredsInCompsCheck extends CifCheck { + /** Mapping from discrete variables to their marked values. Used to detect duplicates. */ + private Map markeds = map(); + + @Override + protected void preprocessComplexComponent(ComplexComponent comp, CifCheckViolations violations) { + for (Expression marked: comp.getMarkeds()) { + // The only supported form is 'discrete_variable = marked_value'. + if (!(marked instanceof BinaryExpression)) { + violations.add(comp, "component has a marker predicate that is not of the form " + + "\"discrete_variable = marked_value\""); + continue; + } + BinaryExpression bexpr = (BinaryExpression)marked; + if (bexpr.getOperator() != BinaryOperator.EQUAL || !(bexpr.getLeft() instanceof DiscVariableExpression)) { + violations.add(comp, "component has a marker predicate that is not of the form " + + "\"discrete_variable = marked_value\""); + continue; + } + + // Add to mapping, to detect duplicates. + DiscVariableExpression vref = (DiscVariableExpression)bexpr.getLeft(); + DiscVariable var = vref.getVariable(); + Expression newValue = bexpr.getRight(); + Expression previousValue = markeds.get(var); + if (previousValue == null) { + markeds.put(var, newValue); + } else { + violations.add(var, "discrete variable has multiple predicates to specify its marked values"); + } + } + } +} diff --git a/cif/org.eclipse.escet.cif.metamodel.java/gen-cif-walker.launch b/cif/org.eclipse.escet.cif.metamodel.java/gen-cif-walker.launch index b93e088979c16140c79f0f8542674b4cbc96ebc1..dd6a35d79dbebbbf4dd216d7e065501d761f06ad 100644 --- a/cif/org.eclipse.escet.cif.metamodel.java/gen-cif-walker.launch +++ b/cif/org.eclipse.escet.cif.metamodel.java/gen-cif-walker.launch @@ -8,7 +8,7 @@ - + diff --git a/cif/org.eclipse.escet.cif.metamodel.java/src-gen/org/eclipse/escet/cif/metamodel/java/CifWithArgWalker.java b/cif/org.eclipse.escet.cif.metamodel.java/src-gen/org/eclipse/escet/cif/metamodel/java/CifWithArgWalker.java new file mode 100644 index 0000000000000000000000000000000000000000..025fbc65a0ca77fe80913ba23c9702aeca8f81d3 --- /dev/null +++ b/cif/org.eclipse.escet.cif.metamodel.java/src-gen/org/eclipse/escet/cif/metamodel/java/CifWithArgWalker.java @@ -0,0 +1,8136 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +// Generated using the "org.eclipse.escet.common.emf.ecore.codegen" project. + +// Disable Eclipse Java formatter for generated code file: +// @formatter:off + +package org.eclipse.escet.cif.metamodel.java; + +import java.util.List; + +import org.eclipse.escet.cif.metamodel.cif.AlgParameter; +import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; +import org.eclipse.escet.cif.metamodel.cif.Component; +import org.eclipse.escet.cif.metamodel.cif.ComponentDef; +import org.eclipse.escet.cif.metamodel.cif.ComponentInst; +import org.eclipse.escet.cif.metamodel.cif.ComponentParameter; +import org.eclipse.escet.cif.metamodel.cif.Equation; +import org.eclipse.escet.cif.metamodel.cif.EventParameter; +import org.eclipse.escet.cif.metamodel.cif.Group; +import org.eclipse.escet.cif.metamodel.cif.Invariant; +import org.eclipse.escet.cif.metamodel.cif.IoDecl; +import org.eclipse.escet.cif.metamodel.cif.LocationParameter; +import org.eclipse.escet.cif.metamodel.cif.Parameter; +import org.eclipse.escet.cif.metamodel.cif.Specification; +import org.eclipse.escet.cif.metamodel.cif.automata.Alphabet; +import org.eclipse.escet.cif.metamodel.cif.automata.Assignment; +import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.metamodel.cif.automata.Edge; +import org.eclipse.escet.cif.metamodel.cif.automata.EdgeEvent; +import org.eclipse.escet.cif.metamodel.cif.automata.EdgeReceive; +import org.eclipse.escet.cif.metamodel.cif.automata.EdgeSend; +import org.eclipse.escet.cif.metamodel.cif.automata.ElifUpdate; +import org.eclipse.escet.cif.metamodel.cif.automata.IfUpdate; +import org.eclipse.escet.cif.metamodel.cif.automata.Location; +import org.eclipse.escet.cif.metamodel.cif.automata.Monitors; +import org.eclipse.escet.cif.metamodel.cif.automata.Update; +import org.eclipse.escet.cif.metamodel.cif.automata.impl.EdgeEventImpl; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgCopy; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgFile; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgIn; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgInEvent; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgInEventIf; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgInEventIfEntry; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgInEventSingle; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgMove; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgOut; +import org.eclipse.escet.cif.metamodel.cif.declarations.AlgVariable; +import org.eclipse.escet.cif.metamodel.cif.declarations.Constant; +import org.eclipse.escet.cif.metamodel.cif.declarations.ContVariable; +import org.eclipse.escet.cif.metamodel.cif.declarations.Declaration; +import org.eclipse.escet.cif.metamodel.cif.declarations.DiscVariable; +import org.eclipse.escet.cif.metamodel.cif.declarations.EnumDecl; +import org.eclipse.escet.cif.metamodel.cif.declarations.EnumLiteral; +import org.eclipse.escet.cif.metamodel.cif.declarations.Event; +import org.eclipse.escet.cif.metamodel.cif.declarations.InputVariable; +import org.eclipse.escet.cif.metamodel.cif.declarations.TypeDecl; +import org.eclipse.escet.cif.metamodel.cif.declarations.VariableValue; +import org.eclipse.escet.cif.metamodel.cif.expressions.AlgVariableExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.BaseFunctionExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.BoolExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.CastExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.CompInstWrapExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.CompParamExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.CompParamWrapExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ComponentExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ConstantExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ContVariableExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.DictExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.DictPair; +import org.eclipse.escet.cif.metamodel.cif.expressions.DiscVariableExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ElifExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.EnumLiteralExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.EventExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.Expression; +import org.eclipse.escet.cif.metamodel.cif.expressions.FieldExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.FunctionCallExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.FunctionExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.IfExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.InputVariableExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.IntExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ListExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.LocationExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ProjectionExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.RealExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ReceivedExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.SelfExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.SetExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.SliceExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.StdLibFunctionExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.StringExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.SwitchCase; +import org.eclipse.escet.cif.metamodel.cif.expressions.SwitchExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.TauExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.TimeExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.TupleExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.UnaryExpression; +import org.eclipse.escet.cif.metamodel.cif.functions.AssignmentFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.BreakFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.ContinueFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.ElifFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.ExternalFunction; +import org.eclipse.escet.cif.metamodel.cif.functions.Function; +import org.eclipse.escet.cif.metamodel.cif.functions.FunctionParameter; +import org.eclipse.escet.cif.metamodel.cif.functions.FunctionStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.IfFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.InternalFunction; +import org.eclipse.escet.cif.metamodel.cif.functions.ReturnFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.WhileFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.impl.GroupImpl; +import org.eclipse.escet.cif.metamodel.cif.print.Print; +import org.eclipse.escet.cif.metamodel.cif.print.PrintFile; +import org.eclipse.escet.cif.metamodel.cif.print.PrintFor; +import org.eclipse.escet.cif.metamodel.cif.types.BoolType; +import org.eclipse.escet.cif.metamodel.cif.types.CifType; +import org.eclipse.escet.cif.metamodel.cif.types.CompInstWrapType; +import org.eclipse.escet.cif.metamodel.cif.types.CompParamWrapType; +import org.eclipse.escet.cif.metamodel.cif.types.ComponentDefType; +import org.eclipse.escet.cif.metamodel.cif.types.ComponentType; +import org.eclipse.escet.cif.metamodel.cif.types.DictType; +import org.eclipse.escet.cif.metamodel.cif.types.DistType; +import org.eclipse.escet.cif.metamodel.cif.types.EnumType; +import org.eclipse.escet.cif.metamodel.cif.types.Field; +import org.eclipse.escet.cif.metamodel.cif.types.FuncType; +import org.eclipse.escet.cif.metamodel.cif.types.IntType; +import org.eclipse.escet.cif.metamodel.cif.types.ListType; +import org.eclipse.escet.cif.metamodel.cif.types.RealType; +import org.eclipse.escet.cif.metamodel.cif.types.SetType; +import org.eclipse.escet.cif.metamodel.cif.types.StringType; +import org.eclipse.escet.cif.metamodel.cif.types.TupleType; +import org.eclipse.escet.cif.metamodel.cif.types.TypeRef; +import org.eclipse.escet.cif.metamodel.cif.types.VoidType; +import org.eclipse.escet.common.java.Assert; +import org.eclipse.escet.common.position.metamodel.position.Position; +import org.eclipse.escet.common.position.metamodel.position.PositionObject; + +/** + * A walker for "cif" models. + * + *

The walker works as follows: + *

    + *
  • Performs a top-down depth-first walk over the object tree, using the + * containment hierarchy.
  • + *
  • No particular order should be assumed for walking over the child + * features.
  • + *
  • For each object encountered, pre-processing is performed before walking + * over the children, and post-processing is performed after walking over + * the children.
  • + *
  • Pre-processing for objects is done by crawling up the inheritance + * hierarchy of the object, performing pre-processing for each of the + * types encountered in the type hierarchy. The pre-processing methods are + * invoked from most general to most specific class (super classes before + * base classes).
  • + *
  • Post-processing for objects is done by crawling up the inheritance + * hierarchy of the object, performing post-processing for each of the + * types encountered in the type hierarchy. The post-processing methods are + * invoked from most specific to most general class (base classes before + * super classes).
  • + *
+ *

+ * + *

By default, the pre-processing and post-processing methods do nothing + * (they have an empty implementation). It is up to derived classes to + * override methods and provide actual implementations. They may also override + * walk and crawl methods, if desired.

+ * + *

This abstract walker class has no public methods. It is up to the derived + * classes to add a public method as entry method. They can decide which + * classes are to be used as starting point, and they can give the public + * method a proper name, parameters, etc. They may even allow multiple public + * methods to allow starting from multiple classes.

+ * + * @param The type of the extra argument provided to the walking, crawling + * and processing methods. + */ +public abstract class CifWithArgWalker { + /** + * Walking function for the {@link AlgParameter} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkAlgParameter(AlgParameter obj, T arg) { + precrawlAlgParameter(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + AlgVariable _variable = obj.getVariable(); + walkAlgVariable(_variable, arg); + postcrawlAlgParameter(obj, arg); + } + + /** + * Pre-crawling function for the {@link AlgParameter} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlAlgParameter(AlgParameter obj, T arg) { + precrawlParameter(obj, arg); + preprocessAlgParameter(obj, arg); + } + + /** + * Post-crawling function for the {@link AlgParameter} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlAlgParameter(AlgParameter obj, T arg) { + postprocessAlgParameter(obj, arg); + postcrawlParameter(obj, arg); + } + + /** + * Pre-processing function for the {@link AlgParameter} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessAlgParameter(AlgParameter obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link AlgParameter} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessAlgParameter(AlgParameter obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link AlgVariable} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkAlgVariable(AlgVariable obj, T arg) { + precrawlAlgVariable(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + Expression _value = obj.getValue(); + if (_value != null) { + walkExpression(_value, arg); + } + postcrawlAlgVariable(obj, arg); + } + + /** + * Pre-crawling function for the {@link AlgVariable} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlAlgVariable(AlgVariable obj, T arg) { + precrawlDeclaration(obj, arg); + preprocessAlgVariable(obj, arg); + } + + /** + * Post-crawling function for the {@link AlgVariable} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlAlgVariable(AlgVariable obj, T arg) { + postprocessAlgVariable(obj, arg); + postcrawlDeclaration(obj, arg); + } + + /** + * Pre-processing function for the {@link AlgVariable} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessAlgVariable(AlgVariable obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link AlgVariable} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessAlgVariable(AlgVariable obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link AlgVariableExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkAlgVariableExpression(AlgVariableExpression obj, T arg) { + precrawlAlgVariableExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlAlgVariableExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link AlgVariableExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlAlgVariableExpression(AlgVariableExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessAlgVariableExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link AlgVariableExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlAlgVariableExpression(AlgVariableExpression obj, T arg) { + postprocessAlgVariableExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link AlgVariableExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessAlgVariableExpression(AlgVariableExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link AlgVariableExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessAlgVariableExpression(AlgVariableExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Alphabet} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkAlphabet(Alphabet obj, T arg) { + precrawlAlphabet(obj, arg); + List _events = obj.getEvents(); + for (Expression x: _events) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlAlphabet(obj, arg); + } + + /** + * Pre-crawling function for the {@link Alphabet} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlAlphabet(Alphabet obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessAlphabet(obj, arg); + } + + /** + * Post-crawling function for the {@link Alphabet} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlAlphabet(Alphabet obj, T arg) { + postprocessAlphabet(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link Alphabet} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessAlphabet(Alphabet obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Alphabet} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessAlphabet(Alphabet obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Assignment} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkAssignment(Assignment obj, T arg) { + precrawlAssignment(obj, arg); + Expression _addressable = obj.getAddressable(); + walkExpression(_addressable, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + Expression _value = obj.getValue(); + walkExpression(_value, arg); + postcrawlAssignment(obj, arg); + } + + /** + * Pre-crawling function for the {@link Assignment} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlAssignment(Assignment obj, T arg) { + precrawlUpdate(obj, arg); + preprocessAssignment(obj, arg); + } + + /** + * Post-crawling function for the {@link Assignment} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlAssignment(Assignment obj, T arg) { + postprocessAssignment(obj, arg); + postcrawlUpdate(obj, arg); + } + + /** + * Pre-processing function for the {@link Assignment} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessAssignment(Assignment obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Assignment} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessAssignment(Assignment obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link AssignmentFuncStatement} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkAssignmentFuncStatement(AssignmentFuncStatement obj, T arg) { + precrawlAssignmentFuncStatement(obj, arg); + Expression _addressable = obj.getAddressable(); + walkExpression(_addressable, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + Expression _value = obj.getValue(); + walkExpression(_value, arg); + postcrawlAssignmentFuncStatement(obj, arg); + } + + /** + * Pre-crawling function for the {@link AssignmentFuncStatement} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlAssignmentFuncStatement(AssignmentFuncStatement obj, T arg) { + precrawlFunctionStatement(obj, arg); + preprocessAssignmentFuncStatement(obj, arg); + } + + /** + * Post-crawling function for the {@link AssignmentFuncStatement} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlAssignmentFuncStatement(AssignmentFuncStatement obj, T arg) { + postprocessAssignmentFuncStatement(obj, arg); + postcrawlFunctionStatement(obj, arg); + } + + /** + * Pre-processing function for the {@link AssignmentFuncStatement} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessAssignmentFuncStatement(AssignmentFuncStatement obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link AssignmentFuncStatement} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessAssignmentFuncStatement(AssignmentFuncStatement obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Automaton} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkAutomaton(Automaton obj, T arg) { + precrawlAutomaton(obj, arg); + Alphabet _alphabet = obj.getAlphabet(); + if (_alphabet != null) { + walkAlphabet(_alphabet, arg); + } + List _declarations = obj.getDeclarations(); + for (Declaration x: _declarations) { + walkDeclaration(x, arg); + } + List _equations = obj.getEquations(); + for (Equation x: _equations) { + walkEquation(x, arg); + } + List _initials = obj.getInitials(); + for (Expression x: _initials) { + walkExpression(x, arg); + } + List _invariants = obj.getInvariants(); + for (Invariant x: _invariants) { + walkInvariant(x, arg); + } + List _ioDecls = obj.getIoDecls(); + for (IoDecl x: _ioDecls) { + walkIoDecl(x, arg); + } + List _locations = obj.getLocations(); + for (Location x: _locations) { + walkLocation(x, arg); + } + List _markeds = obj.getMarkeds(); + for (Expression x: _markeds) { + walkExpression(x, arg); + } + Monitors _monitors = obj.getMonitors(); + if (_monitors != null) { + walkMonitors(_monitors, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlAutomaton(obj, arg); + } + + /** + * Pre-crawling function for the {@link Automaton} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlAutomaton(Automaton obj, T arg) { + precrawlComplexComponent(obj, arg); + preprocessAutomaton(obj, arg); + } + + /** + * Post-crawling function for the {@link Automaton} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlAutomaton(Automaton obj, T arg) { + postprocessAutomaton(obj, arg); + postcrawlComplexComponent(obj, arg); + } + + /** + * Pre-processing function for the {@link Automaton} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessAutomaton(Automaton obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Automaton} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessAutomaton(Automaton obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link BaseFunctionExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkBaseFunctionExpression(BaseFunctionExpression obj, T arg) { + if (obj instanceof FunctionExpression) { + walkFunctionExpression((FunctionExpression)obj, arg); + return; + } + if (obj instanceof StdLibFunctionExpression) { + walkStdLibFunctionExpression((StdLibFunctionExpression)obj, arg); + return; + } + String msg = "No redirect; unexpected object type: " + obj; + throw new IllegalArgumentException(msg); + } + + /** + * Pre-crawling function for the {@link BaseFunctionExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlBaseFunctionExpression(BaseFunctionExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessBaseFunctionExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link BaseFunctionExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlBaseFunctionExpression(BaseFunctionExpression obj, T arg) { + postprocessBaseFunctionExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link BaseFunctionExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessBaseFunctionExpression(BaseFunctionExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link BaseFunctionExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessBaseFunctionExpression(BaseFunctionExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link BinaryExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkBinaryExpression(BinaryExpression obj, T arg) { + precrawlBinaryExpression(obj, arg); + Expression _left = obj.getLeft(); + walkExpression(_left, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + Expression _right = obj.getRight(); + walkExpression(_right, arg); + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlBinaryExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link BinaryExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlBinaryExpression(BinaryExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessBinaryExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link BinaryExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlBinaryExpression(BinaryExpression obj, T arg) { + postprocessBinaryExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link BinaryExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessBinaryExpression(BinaryExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link BinaryExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessBinaryExpression(BinaryExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link BoolExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkBoolExpression(BoolExpression obj, T arg) { + precrawlBoolExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlBoolExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link BoolExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlBoolExpression(BoolExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessBoolExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link BoolExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlBoolExpression(BoolExpression obj, T arg) { + postprocessBoolExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link BoolExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessBoolExpression(BoolExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link BoolExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessBoolExpression(BoolExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link BoolType} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkBoolType(BoolType obj, T arg) { + precrawlBoolType(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlBoolType(obj, arg); + } + + /** + * Pre-crawling function for the {@link BoolType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlBoolType(BoolType obj, T arg) { + precrawlCifType(obj, arg); + preprocessBoolType(obj, arg); + } + + /** + * Post-crawling function for the {@link BoolType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlBoolType(BoolType obj, T arg) { + postprocessBoolType(obj, arg); + postcrawlCifType(obj, arg); + } + + /** + * Pre-processing function for the {@link BoolType} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessBoolType(BoolType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link BoolType} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessBoolType(BoolType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link BreakFuncStatement} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkBreakFuncStatement(BreakFuncStatement obj, T arg) { + precrawlBreakFuncStatement(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlBreakFuncStatement(obj, arg); + } + + /** + * Pre-crawling function for the {@link BreakFuncStatement} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlBreakFuncStatement(BreakFuncStatement obj, T arg) { + precrawlFunctionStatement(obj, arg); + preprocessBreakFuncStatement(obj, arg); + } + + /** + * Post-crawling function for the {@link BreakFuncStatement} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlBreakFuncStatement(BreakFuncStatement obj, T arg) { + postprocessBreakFuncStatement(obj, arg); + postcrawlFunctionStatement(obj, arg); + } + + /** + * Pre-processing function for the {@link BreakFuncStatement} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessBreakFuncStatement(BreakFuncStatement obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link BreakFuncStatement} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessBreakFuncStatement(BreakFuncStatement obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link CastExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkCastExpression(CastExpression obj, T arg) { + precrawlCastExpression(obj, arg); + Expression _child = obj.getChild(); + walkExpression(_child, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlCastExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link CastExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlCastExpression(CastExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessCastExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link CastExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlCastExpression(CastExpression obj, T arg) { + postprocessCastExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link CastExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessCastExpression(CastExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link CastExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessCastExpression(CastExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link CifType} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkCifType(CifType obj, T arg) { + if (obj instanceof BoolType) { + walkBoolType((BoolType)obj, arg); + return; + } + if (obj instanceof CompInstWrapType) { + walkCompInstWrapType((CompInstWrapType)obj, arg); + return; + } + if (obj instanceof CompParamWrapType) { + walkCompParamWrapType((CompParamWrapType)obj, arg); + return; + } + if (obj instanceof ComponentDefType) { + walkComponentDefType((ComponentDefType)obj, arg); + return; + } + if (obj instanceof ComponentType) { + walkComponentType((ComponentType)obj, arg); + return; + } + if (obj instanceof DictType) { + walkDictType((DictType)obj, arg); + return; + } + if (obj instanceof DistType) { + walkDistType((DistType)obj, arg); + return; + } + if (obj instanceof EnumType) { + walkEnumType((EnumType)obj, arg); + return; + } + if (obj instanceof FuncType) { + walkFuncType((FuncType)obj, arg); + return; + } + if (obj instanceof IntType) { + walkIntType((IntType)obj, arg); + return; + } + if (obj instanceof ListType) { + walkListType((ListType)obj, arg); + return; + } + if (obj instanceof RealType) { + walkRealType((RealType)obj, arg); + return; + } + if (obj instanceof SetType) { + walkSetType((SetType)obj, arg); + return; + } + if (obj instanceof StringType) { + walkStringType((StringType)obj, arg); + return; + } + if (obj instanceof TupleType) { + walkTupleType((TupleType)obj, arg); + return; + } + if (obj instanceof TypeRef) { + walkTypeRef((TypeRef)obj, arg); + return; + } + if (obj instanceof VoidType) { + walkVoidType((VoidType)obj, arg); + return; + } + String msg = "No redirect; unexpected object type: " + obj; + throw new IllegalArgumentException(msg); + } + + /** + * Pre-crawling function for the {@link CifType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlCifType(CifType obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessCifType(obj, arg); + } + + /** + * Post-crawling function for the {@link CifType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlCifType(CifType obj, T arg) { + postprocessCifType(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link CifType} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessCifType(CifType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link CifType} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessCifType(CifType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link CompInstWrapExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkCompInstWrapExpression(CompInstWrapExpression obj, T arg) { + precrawlCompInstWrapExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + Expression _reference = obj.getReference(); + walkExpression(_reference, arg); + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlCompInstWrapExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link CompInstWrapExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlCompInstWrapExpression(CompInstWrapExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessCompInstWrapExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link CompInstWrapExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlCompInstWrapExpression(CompInstWrapExpression obj, T arg) { + postprocessCompInstWrapExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link CompInstWrapExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessCompInstWrapExpression(CompInstWrapExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link CompInstWrapExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessCompInstWrapExpression(CompInstWrapExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link CompInstWrapType} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkCompInstWrapType(CompInstWrapType obj, T arg) { + precrawlCompInstWrapType(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _reference = obj.getReference(); + walkCifType(_reference, arg); + postcrawlCompInstWrapType(obj, arg); + } + + /** + * Pre-crawling function for the {@link CompInstWrapType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlCompInstWrapType(CompInstWrapType obj, T arg) { + precrawlCifType(obj, arg); + preprocessCompInstWrapType(obj, arg); + } + + /** + * Post-crawling function for the {@link CompInstWrapType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlCompInstWrapType(CompInstWrapType obj, T arg) { + postprocessCompInstWrapType(obj, arg); + postcrawlCifType(obj, arg); + } + + /** + * Pre-processing function for the {@link CompInstWrapType} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessCompInstWrapType(CompInstWrapType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link CompInstWrapType} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessCompInstWrapType(CompInstWrapType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link CompParamExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkCompParamExpression(CompParamExpression obj, T arg) { + precrawlCompParamExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlCompParamExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link CompParamExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlCompParamExpression(CompParamExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessCompParamExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link CompParamExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlCompParamExpression(CompParamExpression obj, T arg) { + postprocessCompParamExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link CompParamExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessCompParamExpression(CompParamExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link CompParamExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessCompParamExpression(CompParamExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link CompParamWrapExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkCompParamWrapExpression(CompParamWrapExpression obj, T arg) { + precrawlCompParamWrapExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + Expression _reference = obj.getReference(); + walkExpression(_reference, arg); + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlCompParamWrapExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link CompParamWrapExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlCompParamWrapExpression(CompParamWrapExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessCompParamWrapExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link CompParamWrapExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlCompParamWrapExpression(CompParamWrapExpression obj, T arg) { + postprocessCompParamWrapExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link CompParamWrapExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessCompParamWrapExpression(CompParamWrapExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link CompParamWrapExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessCompParamWrapExpression(CompParamWrapExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link CompParamWrapType} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkCompParamWrapType(CompParamWrapType obj, T arg) { + precrawlCompParamWrapType(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _reference = obj.getReference(); + walkCifType(_reference, arg); + postcrawlCompParamWrapType(obj, arg); + } + + /** + * Pre-crawling function for the {@link CompParamWrapType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlCompParamWrapType(CompParamWrapType obj, T arg) { + precrawlCifType(obj, arg); + preprocessCompParamWrapType(obj, arg); + } + + /** + * Post-crawling function for the {@link CompParamWrapType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlCompParamWrapType(CompParamWrapType obj, T arg) { + postprocessCompParamWrapType(obj, arg); + postcrawlCifType(obj, arg); + } + + /** + * Pre-processing function for the {@link CompParamWrapType} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessCompParamWrapType(CompParamWrapType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link CompParamWrapType} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessCompParamWrapType(CompParamWrapType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ComplexComponent} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkComplexComponent(ComplexComponent obj, T arg) { + if (obj instanceof Automaton) { + walkAutomaton((Automaton)obj, arg); + return; + } + if (obj instanceof Group) { + walkGroup((Group)obj, arg); + return; + } + String msg = "No redirect; unexpected object type: " + obj; + throw new IllegalArgumentException(msg); + } + + /** + * Pre-crawling function for the {@link ComplexComponent} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlComplexComponent(ComplexComponent obj, T arg) { + precrawlComponent(obj, arg); + preprocessComplexComponent(obj, arg); + } + + /** + * Post-crawling function for the {@link ComplexComponent} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlComplexComponent(ComplexComponent obj, T arg) { + postprocessComplexComponent(obj, arg); + postcrawlComponent(obj, arg); + } + + /** + * Pre-processing function for the {@link ComplexComponent} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessComplexComponent(ComplexComponent obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ComplexComponent} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessComplexComponent(ComplexComponent obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Component} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkComponent(Component obj, T arg) { + if (obj instanceof ComplexComponent) { + walkComplexComponent((ComplexComponent)obj, arg); + return; + } + if (obj instanceof ComponentInst) { + walkComponentInst((ComponentInst)obj, arg); + return; + } + String msg = "No redirect; unexpected object type: " + obj; + throw new IllegalArgumentException(msg); + } + + /** + * Pre-crawling function for the {@link Component} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlComponent(Component obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessComponent(obj, arg); + } + + /** + * Post-crawling function for the {@link Component} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlComponent(Component obj, T arg) { + postprocessComponent(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link Component} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessComponent(Component obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Component} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessComponent(Component obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ComponentDef} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkComponentDef(ComponentDef obj, T arg) { + precrawlComponentDef(obj, arg); + ComplexComponent _body = obj.getBody(); + walkComplexComponent(_body, arg); + List _parameters = obj.getParameters(); + for (Parameter x: _parameters) { + walkParameter(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlComponentDef(obj, arg); + } + + /** + * Pre-crawling function for the {@link ComponentDef} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlComponentDef(ComponentDef obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessComponentDef(obj, arg); + } + + /** + * Post-crawling function for the {@link ComponentDef} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlComponentDef(ComponentDef obj, T arg) { + postprocessComponentDef(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link ComponentDef} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessComponentDef(ComponentDef obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ComponentDef} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessComponentDef(ComponentDef obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ComponentDefType} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkComponentDefType(ComponentDefType obj, T arg) { + precrawlComponentDefType(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlComponentDefType(obj, arg); + } + + /** + * Pre-crawling function for the {@link ComponentDefType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlComponentDefType(ComponentDefType obj, T arg) { + precrawlCifType(obj, arg); + preprocessComponentDefType(obj, arg); + } + + /** + * Post-crawling function for the {@link ComponentDefType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlComponentDefType(ComponentDefType obj, T arg) { + postprocessComponentDefType(obj, arg); + postcrawlCifType(obj, arg); + } + + /** + * Pre-processing function for the {@link ComponentDefType} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessComponentDefType(ComponentDefType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ComponentDefType} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessComponentDefType(ComponentDefType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ComponentExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkComponentExpression(ComponentExpression obj, T arg) { + precrawlComponentExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlComponentExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link ComponentExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlComponentExpression(ComponentExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessComponentExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link ComponentExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlComponentExpression(ComponentExpression obj, T arg) { + postprocessComponentExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link ComponentExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessComponentExpression(ComponentExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ComponentExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessComponentExpression(ComponentExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ComponentInst} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkComponentInst(ComponentInst obj, T arg) { + precrawlComponentInst(obj, arg); + CifType _definition = obj.getDefinition(); + walkCifType(_definition, arg); + List _parameters = obj.getParameters(); + for (Expression x: _parameters) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlComponentInst(obj, arg); + } + + /** + * Pre-crawling function for the {@link ComponentInst} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlComponentInst(ComponentInst obj, T arg) { + precrawlComponent(obj, arg); + preprocessComponentInst(obj, arg); + } + + /** + * Post-crawling function for the {@link ComponentInst} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlComponentInst(ComponentInst obj, T arg) { + postprocessComponentInst(obj, arg); + postcrawlComponent(obj, arg); + } + + /** + * Pre-processing function for the {@link ComponentInst} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessComponentInst(ComponentInst obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ComponentInst} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessComponentInst(ComponentInst obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ComponentParameter} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkComponentParameter(ComponentParameter obj, T arg) { + precrawlComponentParameter(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlComponentParameter(obj, arg); + } + + /** + * Pre-crawling function for the {@link ComponentParameter} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlComponentParameter(ComponentParameter obj, T arg) { + precrawlParameter(obj, arg); + preprocessComponentParameter(obj, arg); + } + + /** + * Post-crawling function for the {@link ComponentParameter} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlComponentParameter(ComponentParameter obj, T arg) { + postprocessComponentParameter(obj, arg); + postcrawlParameter(obj, arg); + } + + /** + * Pre-processing function for the {@link ComponentParameter} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessComponentParameter(ComponentParameter obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ComponentParameter} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessComponentParameter(ComponentParameter obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ComponentType} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkComponentType(ComponentType obj, T arg) { + precrawlComponentType(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlComponentType(obj, arg); + } + + /** + * Pre-crawling function for the {@link ComponentType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlComponentType(ComponentType obj, T arg) { + precrawlCifType(obj, arg); + preprocessComponentType(obj, arg); + } + + /** + * Post-crawling function for the {@link ComponentType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlComponentType(ComponentType obj, T arg) { + postprocessComponentType(obj, arg); + postcrawlCifType(obj, arg); + } + + /** + * Pre-processing function for the {@link ComponentType} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessComponentType(ComponentType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ComponentType} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessComponentType(ComponentType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Constant} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkConstant(Constant obj, T arg) { + precrawlConstant(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + Expression _value = obj.getValue(); + walkExpression(_value, arg); + postcrawlConstant(obj, arg); + } + + /** + * Pre-crawling function for the {@link Constant} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlConstant(Constant obj, T arg) { + precrawlDeclaration(obj, arg); + preprocessConstant(obj, arg); + } + + /** + * Post-crawling function for the {@link Constant} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlConstant(Constant obj, T arg) { + postprocessConstant(obj, arg); + postcrawlDeclaration(obj, arg); + } + + /** + * Pre-processing function for the {@link Constant} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessConstant(Constant obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Constant} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessConstant(Constant obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ConstantExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkConstantExpression(ConstantExpression obj, T arg) { + precrawlConstantExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlConstantExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link ConstantExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlConstantExpression(ConstantExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessConstantExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link ConstantExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlConstantExpression(ConstantExpression obj, T arg) { + postprocessConstantExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link ConstantExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessConstantExpression(ConstantExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ConstantExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessConstantExpression(ConstantExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ContVariable} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkContVariable(ContVariable obj, T arg) { + precrawlContVariable(obj, arg); + Expression _derivative = obj.getDerivative(); + if (_derivative != null) { + walkExpression(_derivative, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + Expression _value = obj.getValue(); + if (_value != null) { + walkExpression(_value, arg); + } + postcrawlContVariable(obj, arg); + } + + /** + * Pre-crawling function for the {@link ContVariable} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlContVariable(ContVariable obj, T arg) { + precrawlDeclaration(obj, arg); + preprocessContVariable(obj, arg); + } + + /** + * Post-crawling function for the {@link ContVariable} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlContVariable(ContVariable obj, T arg) { + postprocessContVariable(obj, arg); + postcrawlDeclaration(obj, arg); + } + + /** + * Pre-processing function for the {@link ContVariable} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessContVariable(ContVariable obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ContVariable} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessContVariable(ContVariable obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ContVariableExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkContVariableExpression(ContVariableExpression obj, T arg) { + precrawlContVariableExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlContVariableExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link ContVariableExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlContVariableExpression(ContVariableExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessContVariableExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link ContVariableExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlContVariableExpression(ContVariableExpression obj, T arg) { + postprocessContVariableExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link ContVariableExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessContVariableExpression(ContVariableExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ContVariableExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessContVariableExpression(ContVariableExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ContinueFuncStatement} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkContinueFuncStatement(ContinueFuncStatement obj, T arg) { + precrawlContinueFuncStatement(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlContinueFuncStatement(obj, arg); + } + + /** + * Pre-crawling function for the {@link ContinueFuncStatement} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlContinueFuncStatement(ContinueFuncStatement obj, T arg) { + precrawlFunctionStatement(obj, arg); + preprocessContinueFuncStatement(obj, arg); + } + + /** + * Post-crawling function for the {@link ContinueFuncStatement} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlContinueFuncStatement(ContinueFuncStatement obj, T arg) { + postprocessContinueFuncStatement(obj, arg); + postcrawlFunctionStatement(obj, arg); + } + + /** + * Pre-processing function for the {@link ContinueFuncStatement} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessContinueFuncStatement(ContinueFuncStatement obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ContinueFuncStatement} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessContinueFuncStatement(ContinueFuncStatement obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Declaration} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkDeclaration(Declaration obj, T arg) { + if (obj instanceof AlgVariable) { + walkAlgVariable((AlgVariable)obj, arg); + return; + } + if (obj instanceof Constant) { + walkConstant((Constant)obj, arg); + return; + } + if (obj instanceof ContVariable) { + walkContVariable((ContVariable)obj, arg); + return; + } + if (obj instanceof DiscVariable) { + walkDiscVariable((DiscVariable)obj, arg); + return; + } + if (obj instanceof EnumDecl) { + walkEnumDecl((EnumDecl)obj, arg); + return; + } + if (obj instanceof Event) { + walkEvent((Event)obj, arg); + return; + } + if (obj instanceof Function) { + walkFunction((Function)obj, arg); + return; + } + if (obj instanceof InputVariable) { + walkInputVariable((InputVariable)obj, arg); + return; + } + if (obj instanceof TypeDecl) { + walkTypeDecl((TypeDecl)obj, arg); + return; + } + String msg = "No redirect; unexpected object type: " + obj; + throw new IllegalArgumentException(msg); + } + + /** + * Pre-crawling function for the {@link Declaration} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlDeclaration(Declaration obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessDeclaration(obj, arg); + } + + /** + * Post-crawling function for the {@link Declaration} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlDeclaration(Declaration obj, T arg) { + postprocessDeclaration(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link Declaration} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessDeclaration(Declaration obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Declaration} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessDeclaration(Declaration obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link DictExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkDictExpression(DictExpression obj, T arg) { + precrawlDictExpression(obj, arg); + List _pairs = obj.getPairs(); + for (DictPair x: _pairs) { + walkDictPair(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlDictExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link DictExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlDictExpression(DictExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessDictExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link DictExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlDictExpression(DictExpression obj, T arg) { + postprocessDictExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link DictExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessDictExpression(DictExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link DictExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessDictExpression(DictExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link DictPair} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkDictPair(DictPair obj, T arg) { + precrawlDictPair(obj, arg); + Expression _key = obj.getKey(); + walkExpression(_key, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + Expression _value = obj.getValue(); + walkExpression(_value, arg); + postcrawlDictPair(obj, arg); + } + + /** + * Pre-crawling function for the {@link DictPair} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlDictPair(DictPair obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessDictPair(obj, arg); + } + + /** + * Post-crawling function for the {@link DictPair} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlDictPair(DictPair obj, T arg) { + postprocessDictPair(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link DictPair} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessDictPair(DictPair obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link DictPair} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessDictPair(DictPair obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link DictType} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkDictType(DictType obj, T arg) { + precrawlDictType(obj, arg); + CifType _keyType = obj.getKeyType(); + walkCifType(_keyType, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _valueType = obj.getValueType(); + walkCifType(_valueType, arg); + postcrawlDictType(obj, arg); + } + + /** + * Pre-crawling function for the {@link DictType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlDictType(DictType obj, T arg) { + precrawlCifType(obj, arg); + preprocessDictType(obj, arg); + } + + /** + * Post-crawling function for the {@link DictType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlDictType(DictType obj, T arg) { + postprocessDictType(obj, arg); + postcrawlCifType(obj, arg); + } + + /** + * Pre-processing function for the {@link DictType} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessDictType(DictType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link DictType} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessDictType(DictType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link DiscVariable} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkDiscVariable(DiscVariable obj, T arg) { + precrawlDiscVariable(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + VariableValue _value = obj.getValue(); + if (_value != null) { + walkVariableValue(_value, arg); + } + postcrawlDiscVariable(obj, arg); + } + + /** + * Pre-crawling function for the {@link DiscVariable} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlDiscVariable(DiscVariable obj, T arg) { + precrawlDeclaration(obj, arg); + preprocessDiscVariable(obj, arg); + } + + /** + * Post-crawling function for the {@link DiscVariable} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlDiscVariable(DiscVariable obj, T arg) { + postprocessDiscVariable(obj, arg); + postcrawlDeclaration(obj, arg); + } + + /** + * Pre-processing function for the {@link DiscVariable} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessDiscVariable(DiscVariable obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link DiscVariable} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessDiscVariable(DiscVariable obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link DiscVariableExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkDiscVariableExpression(DiscVariableExpression obj, T arg) { + precrawlDiscVariableExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlDiscVariableExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link DiscVariableExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlDiscVariableExpression(DiscVariableExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessDiscVariableExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link DiscVariableExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlDiscVariableExpression(DiscVariableExpression obj, T arg) { + postprocessDiscVariableExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link DiscVariableExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessDiscVariableExpression(DiscVariableExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link DiscVariableExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessDiscVariableExpression(DiscVariableExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link DistType} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkDistType(DistType obj, T arg) { + precrawlDistType(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _sampleType = obj.getSampleType(); + walkCifType(_sampleType, arg); + postcrawlDistType(obj, arg); + } + + /** + * Pre-crawling function for the {@link DistType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlDistType(DistType obj, T arg) { + precrawlCifType(obj, arg); + preprocessDistType(obj, arg); + } + + /** + * Post-crawling function for the {@link DistType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlDistType(DistType obj, T arg) { + postprocessDistType(obj, arg); + postcrawlCifType(obj, arg); + } + + /** + * Pre-processing function for the {@link DistType} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessDistType(DistType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link DistType} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessDistType(DistType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Edge} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkEdge(Edge obj, T arg) { + precrawlEdge(obj, arg); + List _events = obj.getEvents(); + for (EdgeEvent x: _events) { + walkEdgeEvent(x, arg); + } + List _guards = obj.getGuards(); + for (Expression x: _guards) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + List _updates = obj.getUpdates(); + for (Update x: _updates) { + walkUpdate(x, arg); + } + postcrawlEdge(obj, arg); + } + + /** + * Pre-crawling function for the {@link Edge} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlEdge(Edge obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessEdge(obj, arg); + } + + /** + * Post-crawling function for the {@link Edge} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlEdge(Edge obj, T arg) { + postprocessEdge(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link Edge} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessEdge(Edge obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Edge} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessEdge(Edge obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link EdgeEvent} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkEdgeEvent(EdgeEvent obj, T arg) { + if (obj instanceof EdgeReceive) { + walkEdgeReceive((EdgeReceive)obj, arg); + return; + } + if (obj instanceof EdgeSend) { + walkEdgeSend((EdgeSend)obj, arg); + return; + } + Assert.check(obj.getClass() == EdgeEventImpl.class); + precrawlEdgeEvent(obj, arg); + Expression _event = obj.getEvent(); + walkExpression(_event, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlEdgeEvent(obj, arg); + } + + /** + * Pre-crawling function for the {@link EdgeEvent} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlEdgeEvent(EdgeEvent obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessEdgeEvent(obj, arg); + } + + /** + * Post-crawling function for the {@link EdgeEvent} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlEdgeEvent(EdgeEvent obj, T arg) { + postprocessEdgeEvent(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link EdgeEvent} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessEdgeEvent(EdgeEvent obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link EdgeEvent} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessEdgeEvent(EdgeEvent obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link EdgeReceive} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkEdgeReceive(EdgeReceive obj, T arg) { + precrawlEdgeReceive(obj, arg); + Expression _event = obj.getEvent(); + walkExpression(_event, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlEdgeReceive(obj, arg); + } + + /** + * Pre-crawling function for the {@link EdgeReceive} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlEdgeReceive(EdgeReceive obj, T arg) { + precrawlEdgeEvent(obj, arg); + preprocessEdgeReceive(obj, arg); + } + + /** + * Post-crawling function for the {@link EdgeReceive} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlEdgeReceive(EdgeReceive obj, T arg) { + postprocessEdgeReceive(obj, arg); + postcrawlEdgeEvent(obj, arg); + } + + /** + * Pre-processing function for the {@link EdgeReceive} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessEdgeReceive(EdgeReceive obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link EdgeReceive} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessEdgeReceive(EdgeReceive obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link EdgeSend} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkEdgeSend(EdgeSend obj, T arg) { + precrawlEdgeSend(obj, arg); + Expression _event = obj.getEvent(); + walkExpression(_event, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + Expression _value = obj.getValue(); + if (_value != null) { + walkExpression(_value, arg); + } + postcrawlEdgeSend(obj, arg); + } + + /** + * Pre-crawling function for the {@link EdgeSend} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlEdgeSend(EdgeSend obj, T arg) { + precrawlEdgeEvent(obj, arg); + preprocessEdgeSend(obj, arg); + } + + /** + * Post-crawling function for the {@link EdgeSend} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlEdgeSend(EdgeSend obj, T arg) { + postprocessEdgeSend(obj, arg); + postcrawlEdgeEvent(obj, arg); + } + + /** + * Pre-processing function for the {@link EdgeSend} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessEdgeSend(EdgeSend obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link EdgeSend} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessEdgeSend(EdgeSend obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ElifExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkElifExpression(ElifExpression obj, T arg) { + precrawlElifExpression(obj, arg); + List _guards = obj.getGuards(); + for (Expression x: _guards) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + Expression _then = obj.getThen(); + walkExpression(_then, arg); + postcrawlElifExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link ElifExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlElifExpression(ElifExpression obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessElifExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link ElifExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlElifExpression(ElifExpression obj, T arg) { + postprocessElifExpression(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link ElifExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessElifExpression(ElifExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ElifExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessElifExpression(ElifExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ElifFuncStatement} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkElifFuncStatement(ElifFuncStatement obj, T arg) { + precrawlElifFuncStatement(obj, arg); + List _guards = obj.getGuards(); + for (Expression x: _guards) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + List _thens = obj.getThens(); + for (FunctionStatement x: _thens) { + walkFunctionStatement(x, arg); + } + postcrawlElifFuncStatement(obj, arg); + } + + /** + * Pre-crawling function for the {@link ElifFuncStatement} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlElifFuncStatement(ElifFuncStatement obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessElifFuncStatement(obj, arg); + } + + /** + * Post-crawling function for the {@link ElifFuncStatement} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlElifFuncStatement(ElifFuncStatement obj, T arg) { + postprocessElifFuncStatement(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link ElifFuncStatement} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessElifFuncStatement(ElifFuncStatement obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ElifFuncStatement} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessElifFuncStatement(ElifFuncStatement obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ElifUpdate} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkElifUpdate(ElifUpdate obj, T arg) { + precrawlElifUpdate(obj, arg); + List _guards = obj.getGuards(); + for (Expression x: _guards) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + List _thens = obj.getThens(); + for (Update x: _thens) { + walkUpdate(x, arg); + } + postcrawlElifUpdate(obj, arg); + } + + /** + * Pre-crawling function for the {@link ElifUpdate} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlElifUpdate(ElifUpdate obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessElifUpdate(obj, arg); + } + + /** + * Post-crawling function for the {@link ElifUpdate} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlElifUpdate(ElifUpdate obj, T arg) { + postprocessElifUpdate(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link ElifUpdate} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessElifUpdate(ElifUpdate obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ElifUpdate} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessElifUpdate(ElifUpdate obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link EnumDecl} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkEnumDecl(EnumDecl obj, T arg) { + precrawlEnumDecl(obj, arg); + List _literals = obj.getLiterals(); + for (EnumLiteral x: _literals) { + walkEnumLiteral(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlEnumDecl(obj, arg); + } + + /** + * Pre-crawling function for the {@link EnumDecl} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlEnumDecl(EnumDecl obj, T arg) { + precrawlDeclaration(obj, arg); + preprocessEnumDecl(obj, arg); + } + + /** + * Post-crawling function for the {@link EnumDecl} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlEnumDecl(EnumDecl obj, T arg) { + postprocessEnumDecl(obj, arg); + postcrawlDeclaration(obj, arg); + } + + /** + * Pre-processing function for the {@link EnumDecl} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessEnumDecl(EnumDecl obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link EnumDecl} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessEnumDecl(EnumDecl obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link EnumLiteral} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkEnumLiteral(EnumLiteral obj, T arg) { + precrawlEnumLiteral(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlEnumLiteral(obj, arg); + } + + /** + * Pre-crawling function for the {@link EnumLiteral} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlEnumLiteral(EnumLiteral obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessEnumLiteral(obj, arg); + } + + /** + * Post-crawling function for the {@link EnumLiteral} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlEnumLiteral(EnumLiteral obj, T arg) { + postprocessEnumLiteral(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link EnumLiteral} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessEnumLiteral(EnumLiteral obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link EnumLiteral} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessEnumLiteral(EnumLiteral obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link EnumLiteralExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkEnumLiteralExpression(EnumLiteralExpression obj, T arg) { + precrawlEnumLiteralExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlEnumLiteralExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link EnumLiteralExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlEnumLiteralExpression(EnumLiteralExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessEnumLiteralExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link EnumLiteralExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlEnumLiteralExpression(EnumLiteralExpression obj, T arg) { + postprocessEnumLiteralExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link EnumLiteralExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessEnumLiteralExpression(EnumLiteralExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link EnumLiteralExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessEnumLiteralExpression(EnumLiteralExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link EnumType} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkEnumType(EnumType obj, T arg) { + precrawlEnumType(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlEnumType(obj, arg); + } + + /** + * Pre-crawling function for the {@link EnumType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlEnumType(EnumType obj, T arg) { + precrawlCifType(obj, arg); + preprocessEnumType(obj, arg); + } + + /** + * Post-crawling function for the {@link EnumType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlEnumType(EnumType obj, T arg) { + postprocessEnumType(obj, arg); + postcrawlCifType(obj, arg); + } + + /** + * Pre-processing function for the {@link EnumType} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessEnumType(EnumType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link EnumType} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessEnumType(EnumType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Equation} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkEquation(Equation obj, T arg) { + precrawlEquation(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + Expression _value = obj.getValue(); + walkExpression(_value, arg); + postcrawlEquation(obj, arg); + } + + /** + * Pre-crawling function for the {@link Equation} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlEquation(Equation obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessEquation(obj, arg); + } + + /** + * Post-crawling function for the {@link Equation} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlEquation(Equation obj, T arg) { + postprocessEquation(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link Equation} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessEquation(Equation obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Equation} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessEquation(Equation obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Event} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkEvent(Event obj, T arg) { + precrawlEvent(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + if (_type != null) { + walkCifType(_type, arg); + } + postcrawlEvent(obj, arg); + } + + /** + * Pre-crawling function for the {@link Event} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlEvent(Event obj, T arg) { + precrawlDeclaration(obj, arg); + preprocessEvent(obj, arg); + } + + /** + * Post-crawling function for the {@link Event} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlEvent(Event obj, T arg) { + postprocessEvent(obj, arg); + postcrawlDeclaration(obj, arg); + } + + /** + * Pre-processing function for the {@link Event} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessEvent(Event obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Event} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessEvent(Event obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link EventExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkEventExpression(EventExpression obj, T arg) { + precrawlEventExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlEventExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link EventExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlEventExpression(EventExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessEventExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link EventExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlEventExpression(EventExpression obj, T arg) { + postprocessEventExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link EventExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessEventExpression(EventExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link EventExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessEventExpression(EventExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link EventParameter} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkEventParameter(EventParameter obj, T arg) { + precrawlEventParameter(obj, arg); + Event _event = obj.getEvent(); + walkEvent(_event, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlEventParameter(obj, arg); + } + + /** + * Pre-crawling function for the {@link EventParameter} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlEventParameter(EventParameter obj, T arg) { + precrawlParameter(obj, arg); + preprocessEventParameter(obj, arg); + } + + /** + * Post-crawling function for the {@link EventParameter} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlEventParameter(EventParameter obj, T arg) { + postprocessEventParameter(obj, arg); + postcrawlParameter(obj, arg); + } + + /** + * Pre-processing function for the {@link EventParameter} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessEventParameter(EventParameter obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link EventParameter} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessEventParameter(EventParameter obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Expression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkExpression(Expression obj, T arg) { + if (obj instanceof AlgVariableExpression) { + walkAlgVariableExpression((AlgVariableExpression)obj, arg); + return; + } + if (obj instanceof BaseFunctionExpression) { + walkBaseFunctionExpression((BaseFunctionExpression)obj, arg); + return; + } + if (obj instanceof BinaryExpression) { + walkBinaryExpression((BinaryExpression)obj, arg); + return; + } + if (obj instanceof BoolExpression) { + walkBoolExpression((BoolExpression)obj, arg); + return; + } + if (obj instanceof CastExpression) { + walkCastExpression((CastExpression)obj, arg); + return; + } + if (obj instanceof CompInstWrapExpression) { + walkCompInstWrapExpression((CompInstWrapExpression)obj, arg); + return; + } + if (obj instanceof CompParamExpression) { + walkCompParamExpression((CompParamExpression)obj, arg); + return; + } + if (obj instanceof CompParamWrapExpression) { + walkCompParamWrapExpression((CompParamWrapExpression)obj, arg); + return; + } + if (obj instanceof ComponentExpression) { + walkComponentExpression((ComponentExpression)obj, arg); + return; + } + if (obj instanceof ConstantExpression) { + walkConstantExpression((ConstantExpression)obj, arg); + return; + } + if (obj instanceof ContVariableExpression) { + walkContVariableExpression((ContVariableExpression)obj, arg); + return; + } + if (obj instanceof DictExpression) { + walkDictExpression((DictExpression)obj, arg); + return; + } + if (obj instanceof DiscVariableExpression) { + walkDiscVariableExpression((DiscVariableExpression)obj, arg); + return; + } + if (obj instanceof EnumLiteralExpression) { + walkEnumLiteralExpression((EnumLiteralExpression)obj, arg); + return; + } + if (obj instanceof EventExpression) { + walkEventExpression((EventExpression)obj, arg); + return; + } + if (obj instanceof FieldExpression) { + walkFieldExpression((FieldExpression)obj, arg); + return; + } + if (obj instanceof FunctionCallExpression) { + walkFunctionCallExpression((FunctionCallExpression)obj, arg); + return; + } + if (obj instanceof IfExpression) { + walkIfExpression((IfExpression)obj, arg); + return; + } + if (obj instanceof InputVariableExpression) { + walkInputVariableExpression((InputVariableExpression)obj, arg); + return; + } + if (obj instanceof IntExpression) { + walkIntExpression((IntExpression)obj, arg); + return; + } + if (obj instanceof ListExpression) { + walkListExpression((ListExpression)obj, arg); + return; + } + if (obj instanceof LocationExpression) { + walkLocationExpression((LocationExpression)obj, arg); + return; + } + if (obj instanceof ProjectionExpression) { + walkProjectionExpression((ProjectionExpression)obj, arg); + return; + } + if (obj instanceof RealExpression) { + walkRealExpression((RealExpression)obj, arg); + return; + } + if (obj instanceof ReceivedExpression) { + walkReceivedExpression((ReceivedExpression)obj, arg); + return; + } + if (obj instanceof SelfExpression) { + walkSelfExpression((SelfExpression)obj, arg); + return; + } + if (obj instanceof SetExpression) { + walkSetExpression((SetExpression)obj, arg); + return; + } + if (obj instanceof SliceExpression) { + walkSliceExpression((SliceExpression)obj, arg); + return; + } + if (obj instanceof StringExpression) { + walkStringExpression((StringExpression)obj, arg); + return; + } + if (obj instanceof SwitchExpression) { + walkSwitchExpression((SwitchExpression)obj, arg); + return; + } + if (obj instanceof TauExpression) { + walkTauExpression((TauExpression)obj, arg); + return; + } + if (obj instanceof TimeExpression) { + walkTimeExpression((TimeExpression)obj, arg); + return; + } + if (obj instanceof TupleExpression) { + walkTupleExpression((TupleExpression)obj, arg); + return; + } + if (obj instanceof UnaryExpression) { + walkUnaryExpression((UnaryExpression)obj, arg); + return; + } + String msg = "No redirect; unexpected object type: " + obj; + throw new IllegalArgumentException(msg); + } + + /** + * Pre-crawling function for the {@link Expression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlExpression(Expression obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link Expression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlExpression(Expression obj, T arg) { + postprocessExpression(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link Expression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessExpression(Expression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Expression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessExpression(Expression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ExternalFunction} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkExternalFunction(ExternalFunction obj, T arg) { + precrawlExternalFunction(obj, arg); + List _parameters = obj.getParameters(); + for (FunctionParameter x: _parameters) { + walkFunctionParameter(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + List _returnTypes = obj.getReturnTypes(); + for (CifType x: _returnTypes) { + walkCifType(x, arg); + } + postcrawlExternalFunction(obj, arg); + } + + /** + * Pre-crawling function for the {@link ExternalFunction} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlExternalFunction(ExternalFunction obj, T arg) { + precrawlFunction(obj, arg); + preprocessExternalFunction(obj, arg); + } + + /** + * Post-crawling function for the {@link ExternalFunction} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlExternalFunction(ExternalFunction obj, T arg) { + postprocessExternalFunction(obj, arg); + postcrawlFunction(obj, arg); + } + + /** + * Pre-processing function for the {@link ExternalFunction} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessExternalFunction(ExternalFunction obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ExternalFunction} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessExternalFunction(ExternalFunction obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Field} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkField(Field obj, T arg) { + precrawlField(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlField(obj, arg); + } + + /** + * Pre-crawling function for the {@link Field} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlField(Field obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessField(obj, arg); + } + + /** + * Post-crawling function for the {@link Field} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlField(Field obj, T arg) { + postprocessField(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link Field} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessField(Field obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Field} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessField(Field obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link FieldExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkFieldExpression(FieldExpression obj, T arg) { + precrawlFieldExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlFieldExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link FieldExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlFieldExpression(FieldExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessFieldExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link FieldExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlFieldExpression(FieldExpression obj, T arg) { + postprocessFieldExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link FieldExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessFieldExpression(FieldExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link FieldExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessFieldExpression(FieldExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link FuncType} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkFuncType(FuncType obj, T arg) { + precrawlFuncType(obj, arg); + List _paramTypes = obj.getParamTypes(); + for (CifType x: _paramTypes) { + walkCifType(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _returnType = obj.getReturnType(); + walkCifType(_returnType, arg); + postcrawlFuncType(obj, arg); + } + + /** + * Pre-crawling function for the {@link FuncType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlFuncType(FuncType obj, T arg) { + precrawlCifType(obj, arg); + preprocessFuncType(obj, arg); + } + + /** + * Post-crawling function for the {@link FuncType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlFuncType(FuncType obj, T arg) { + postprocessFuncType(obj, arg); + postcrawlCifType(obj, arg); + } + + /** + * Pre-processing function for the {@link FuncType} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessFuncType(FuncType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link FuncType} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessFuncType(FuncType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Function} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkFunction(Function obj, T arg) { + if (obj instanceof ExternalFunction) { + walkExternalFunction((ExternalFunction)obj, arg); + return; + } + if (obj instanceof InternalFunction) { + walkInternalFunction((InternalFunction)obj, arg); + return; + } + String msg = "No redirect; unexpected object type: " + obj; + throw new IllegalArgumentException(msg); + } + + /** + * Pre-crawling function for the {@link Function} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlFunction(Function obj, T arg) { + precrawlDeclaration(obj, arg); + preprocessFunction(obj, arg); + } + + /** + * Post-crawling function for the {@link Function} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlFunction(Function obj, T arg) { + postprocessFunction(obj, arg); + postcrawlDeclaration(obj, arg); + } + + /** + * Pre-processing function for the {@link Function} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessFunction(Function obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Function} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessFunction(Function obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link FunctionCallExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkFunctionCallExpression(FunctionCallExpression obj, T arg) { + precrawlFunctionCallExpression(obj, arg); + Expression _function = obj.getFunction(); + walkExpression(_function, arg); + List _params = obj.getParams(); + for (Expression x: _params) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlFunctionCallExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link FunctionCallExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlFunctionCallExpression(FunctionCallExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessFunctionCallExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link FunctionCallExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlFunctionCallExpression(FunctionCallExpression obj, T arg) { + postprocessFunctionCallExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link FunctionCallExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessFunctionCallExpression(FunctionCallExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link FunctionCallExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessFunctionCallExpression(FunctionCallExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link FunctionExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkFunctionExpression(FunctionExpression obj, T arg) { + precrawlFunctionExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlFunctionExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link FunctionExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlFunctionExpression(FunctionExpression obj, T arg) { + precrawlBaseFunctionExpression(obj, arg); + preprocessFunctionExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link FunctionExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlFunctionExpression(FunctionExpression obj, T arg) { + postprocessFunctionExpression(obj, arg); + postcrawlBaseFunctionExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link FunctionExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessFunctionExpression(FunctionExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link FunctionExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessFunctionExpression(FunctionExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link FunctionParameter} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkFunctionParameter(FunctionParameter obj, T arg) { + precrawlFunctionParameter(obj, arg); + DiscVariable _parameter = obj.getParameter(); + walkDiscVariable(_parameter, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlFunctionParameter(obj, arg); + } + + /** + * Pre-crawling function for the {@link FunctionParameter} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlFunctionParameter(FunctionParameter obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessFunctionParameter(obj, arg); + } + + /** + * Post-crawling function for the {@link FunctionParameter} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlFunctionParameter(FunctionParameter obj, T arg) { + postprocessFunctionParameter(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link FunctionParameter} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessFunctionParameter(FunctionParameter obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link FunctionParameter} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessFunctionParameter(FunctionParameter obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link FunctionStatement} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkFunctionStatement(FunctionStatement obj, T arg) { + if (obj instanceof AssignmentFuncStatement) { + walkAssignmentFuncStatement((AssignmentFuncStatement)obj, arg); + return; + } + if (obj instanceof BreakFuncStatement) { + walkBreakFuncStatement((BreakFuncStatement)obj, arg); + return; + } + if (obj instanceof ContinueFuncStatement) { + walkContinueFuncStatement((ContinueFuncStatement)obj, arg); + return; + } + if (obj instanceof IfFuncStatement) { + walkIfFuncStatement((IfFuncStatement)obj, arg); + return; + } + if (obj instanceof ReturnFuncStatement) { + walkReturnFuncStatement((ReturnFuncStatement)obj, arg); + return; + } + if (obj instanceof WhileFuncStatement) { + walkWhileFuncStatement((WhileFuncStatement)obj, arg); + return; + } + String msg = "No redirect; unexpected object type: " + obj; + throw new IllegalArgumentException(msg); + } + + /** + * Pre-crawling function for the {@link FunctionStatement} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlFunctionStatement(FunctionStatement obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessFunctionStatement(obj, arg); + } + + /** + * Post-crawling function for the {@link FunctionStatement} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlFunctionStatement(FunctionStatement obj, T arg) { + postprocessFunctionStatement(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link FunctionStatement} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessFunctionStatement(FunctionStatement obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link FunctionStatement} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessFunctionStatement(FunctionStatement obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Group} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkGroup(Group obj, T arg) { + if (obj instanceof Specification) { + walkSpecification((Specification)obj, arg); + return; + } + Assert.check(obj.getClass() == GroupImpl.class); + precrawlGroup(obj, arg); + List _components = obj.getComponents(); + for (Component x: _components) { + walkComponent(x, arg); + } + List _declarations = obj.getDeclarations(); + for (Declaration x: _declarations) { + walkDeclaration(x, arg); + } + List _definitions = obj.getDefinitions(); + for (ComponentDef x: _definitions) { + walkComponentDef(x, arg); + } + List _equations = obj.getEquations(); + for (Equation x: _equations) { + walkEquation(x, arg); + } + List _initials = obj.getInitials(); + for (Expression x: _initials) { + walkExpression(x, arg); + } + List _invariants = obj.getInvariants(); + for (Invariant x: _invariants) { + walkInvariant(x, arg); + } + List _ioDecls = obj.getIoDecls(); + for (IoDecl x: _ioDecls) { + walkIoDecl(x, arg); + } + List _markeds = obj.getMarkeds(); + for (Expression x: _markeds) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlGroup(obj, arg); + } + + /** + * Pre-crawling function for the {@link Group} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlGroup(Group obj, T arg) { + precrawlComplexComponent(obj, arg); + preprocessGroup(obj, arg); + } + + /** + * Post-crawling function for the {@link Group} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlGroup(Group obj, T arg) { + postprocessGroup(obj, arg); + postcrawlComplexComponent(obj, arg); + } + + /** + * Pre-processing function for the {@link Group} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessGroup(Group obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Group} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessGroup(Group obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link IfExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkIfExpression(IfExpression obj, T arg) { + precrawlIfExpression(obj, arg); + List _elifs = obj.getElifs(); + for (ElifExpression x: _elifs) { + walkElifExpression(x, arg); + } + Expression _else = obj.getElse(); + walkExpression(_else, arg); + List _guards = obj.getGuards(); + for (Expression x: _guards) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + Expression _then = obj.getThen(); + walkExpression(_then, arg); + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlIfExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link IfExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlIfExpression(IfExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessIfExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link IfExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlIfExpression(IfExpression obj, T arg) { + postprocessIfExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link IfExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessIfExpression(IfExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link IfExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessIfExpression(IfExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link IfFuncStatement} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkIfFuncStatement(IfFuncStatement obj, T arg) { + precrawlIfFuncStatement(obj, arg); + List _elifs = obj.getElifs(); + for (ElifFuncStatement x: _elifs) { + walkElifFuncStatement(x, arg); + } + List _elses = obj.getElses(); + for (FunctionStatement x: _elses) { + walkFunctionStatement(x, arg); + } + List _guards = obj.getGuards(); + for (Expression x: _guards) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + List _thens = obj.getThens(); + for (FunctionStatement x: _thens) { + walkFunctionStatement(x, arg); + } + postcrawlIfFuncStatement(obj, arg); + } + + /** + * Pre-crawling function for the {@link IfFuncStatement} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlIfFuncStatement(IfFuncStatement obj, T arg) { + precrawlFunctionStatement(obj, arg); + preprocessIfFuncStatement(obj, arg); + } + + /** + * Post-crawling function for the {@link IfFuncStatement} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlIfFuncStatement(IfFuncStatement obj, T arg) { + postprocessIfFuncStatement(obj, arg); + postcrawlFunctionStatement(obj, arg); + } + + /** + * Pre-processing function for the {@link IfFuncStatement} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessIfFuncStatement(IfFuncStatement obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link IfFuncStatement} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessIfFuncStatement(IfFuncStatement obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link IfUpdate} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkIfUpdate(IfUpdate obj, T arg) { + precrawlIfUpdate(obj, arg); + List _elifs = obj.getElifs(); + for (ElifUpdate x: _elifs) { + walkElifUpdate(x, arg); + } + List _elses = obj.getElses(); + for (Update x: _elses) { + walkUpdate(x, arg); + } + List _guards = obj.getGuards(); + for (Expression x: _guards) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + List _thens = obj.getThens(); + for (Update x: _thens) { + walkUpdate(x, arg); + } + postcrawlIfUpdate(obj, arg); + } + + /** + * Pre-crawling function for the {@link IfUpdate} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlIfUpdate(IfUpdate obj, T arg) { + precrawlUpdate(obj, arg); + preprocessIfUpdate(obj, arg); + } + + /** + * Post-crawling function for the {@link IfUpdate} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlIfUpdate(IfUpdate obj, T arg) { + postprocessIfUpdate(obj, arg); + postcrawlUpdate(obj, arg); + } + + /** + * Pre-processing function for the {@link IfUpdate} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessIfUpdate(IfUpdate obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link IfUpdate} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessIfUpdate(IfUpdate obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link InputVariable} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkInputVariable(InputVariable obj, T arg) { + precrawlInputVariable(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlInputVariable(obj, arg); + } + + /** + * Pre-crawling function for the {@link InputVariable} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlInputVariable(InputVariable obj, T arg) { + precrawlDeclaration(obj, arg); + preprocessInputVariable(obj, arg); + } + + /** + * Post-crawling function for the {@link InputVariable} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlInputVariable(InputVariable obj, T arg) { + postprocessInputVariable(obj, arg); + postcrawlDeclaration(obj, arg); + } + + /** + * Pre-processing function for the {@link InputVariable} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessInputVariable(InputVariable obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link InputVariable} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessInputVariable(InputVariable obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link InputVariableExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkInputVariableExpression(InputVariableExpression obj, T arg) { + precrawlInputVariableExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlInputVariableExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link InputVariableExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlInputVariableExpression(InputVariableExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessInputVariableExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link InputVariableExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlInputVariableExpression(InputVariableExpression obj, T arg) { + postprocessInputVariableExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link InputVariableExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessInputVariableExpression(InputVariableExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link InputVariableExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessInputVariableExpression(InputVariableExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link IntExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkIntExpression(IntExpression obj, T arg) { + precrawlIntExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlIntExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link IntExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlIntExpression(IntExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessIntExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link IntExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlIntExpression(IntExpression obj, T arg) { + postprocessIntExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link IntExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessIntExpression(IntExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link IntExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessIntExpression(IntExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link IntType} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkIntType(IntType obj, T arg) { + precrawlIntType(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlIntType(obj, arg); + } + + /** + * Pre-crawling function for the {@link IntType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlIntType(IntType obj, T arg) { + precrawlCifType(obj, arg); + preprocessIntType(obj, arg); + } + + /** + * Post-crawling function for the {@link IntType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlIntType(IntType obj, T arg) { + postprocessIntType(obj, arg); + postcrawlCifType(obj, arg); + } + + /** + * Pre-processing function for the {@link IntType} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessIntType(IntType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link IntType} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessIntType(IntType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link InternalFunction} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkInternalFunction(InternalFunction obj, T arg) { + precrawlInternalFunction(obj, arg); + List _parameters = obj.getParameters(); + for (FunctionParameter x: _parameters) { + walkFunctionParameter(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + List _returnTypes = obj.getReturnTypes(); + for (CifType x: _returnTypes) { + walkCifType(x, arg); + } + List _statements = obj.getStatements(); + for (FunctionStatement x: _statements) { + walkFunctionStatement(x, arg); + } + List _variables = obj.getVariables(); + for (DiscVariable x: _variables) { + walkDiscVariable(x, arg); + } + postcrawlInternalFunction(obj, arg); + } + + /** + * Pre-crawling function for the {@link InternalFunction} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlInternalFunction(InternalFunction obj, T arg) { + precrawlFunction(obj, arg); + preprocessInternalFunction(obj, arg); + } + + /** + * Post-crawling function for the {@link InternalFunction} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlInternalFunction(InternalFunction obj, T arg) { + postprocessInternalFunction(obj, arg); + postcrawlFunction(obj, arg); + } + + /** + * Pre-processing function for the {@link InternalFunction} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessInternalFunction(InternalFunction obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link InternalFunction} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessInternalFunction(InternalFunction obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Invariant} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkInvariant(Invariant obj, T arg) { + precrawlInvariant(obj, arg); + Expression _event = obj.getEvent(); + if (_event != null) { + walkExpression(_event, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + Expression _predicate = obj.getPredicate(); + walkExpression(_predicate, arg); + postcrawlInvariant(obj, arg); + } + + /** + * Pre-crawling function for the {@link Invariant} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlInvariant(Invariant obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessInvariant(obj, arg); + } + + /** + * Post-crawling function for the {@link Invariant} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlInvariant(Invariant obj, T arg) { + postprocessInvariant(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link Invariant} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessInvariant(Invariant obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Invariant} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessInvariant(Invariant obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link IoDecl} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkIoDecl(IoDecl obj, T arg) { + if (obj instanceof Print) { + walkPrint((Print)obj, arg); + return; + } + if (obj instanceof PrintFile) { + walkPrintFile((PrintFile)obj, arg); + return; + } + if (obj instanceof SvgCopy) { + walkSvgCopy((SvgCopy)obj, arg); + return; + } + if (obj instanceof SvgFile) { + walkSvgFile((SvgFile)obj, arg); + return; + } + if (obj instanceof SvgIn) { + walkSvgIn((SvgIn)obj, arg); + return; + } + if (obj instanceof SvgMove) { + walkSvgMove((SvgMove)obj, arg); + return; + } + if (obj instanceof SvgOut) { + walkSvgOut((SvgOut)obj, arg); + return; + } + String msg = "No redirect; unexpected object type: " + obj; + throw new IllegalArgumentException(msg); + } + + /** + * Pre-crawling function for the {@link IoDecl} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlIoDecl(IoDecl obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessIoDecl(obj, arg); + } + + /** + * Post-crawling function for the {@link IoDecl} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlIoDecl(IoDecl obj, T arg) { + postprocessIoDecl(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link IoDecl} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessIoDecl(IoDecl obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link IoDecl} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessIoDecl(IoDecl obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ListExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkListExpression(ListExpression obj, T arg) { + precrawlListExpression(obj, arg); + List _elements = obj.getElements(); + for (Expression x: _elements) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlListExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link ListExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlListExpression(ListExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessListExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link ListExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlListExpression(ListExpression obj, T arg) { + postprocessListExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link ListExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessListExpression(ListExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ListExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessListExpression(ListExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ListType} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkListType(ListType obj, T arg) { + precrawlListType(obj, arg); + CifType _elementType = obj.getElementType(); + walkCifType(_elementType, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlListType(obj, arg); + } + + /** + * Pre-crawling function for the {@link ListType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlListType(ListType obj, T arg) { + precrawlCifType(obj, arg); + preprocessListType(obj, arg); + } + + /** + * Post-crawling function for the {@link ListType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlListType(ListType obj, T arg) { + postprocessListType(obj, arg); + postcrawlCifType(obj, arg); + } + + /** + * Pre-processing function for the {@link ListType} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessListType(ListType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ListType} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessListType(ListType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Location} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkLocation(Location obj, T arg) { + precrawlLocation(obj, arg); + List _edges = obj.getEdges(); + for (Edge x: _edges) { + walkEdge(x, arg); + } + List _equations = obj.getEquations(); + for (Equation x: _equations) { + walkEquation(x, arg); + } + List _initials = obj.getInitials(); + for (Expression x: _initials) { + walkExpression(x, arg); + } + List _invariants = obj.getInvariants(); + for (Invariant x: _invariants) { + walkInvariant(x, arg); + } + List _markeds = obj.getMarkeds(); + for (Expression x: _markeds) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlLocation(obj, arg); + } + + /** + * Pre-crawling function for the {@link Location} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlLocation(Location obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessLocation(obj, arg); + } + + /** + * Post-crawling function for the {@link Location} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlLocation(Location obj, T arg) { + postprocessLocation(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link Location} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessLocation(Location obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Location} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessLocation(Location obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link LocationExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkLocationExpression(LocationExpression obj, T arg) { + precrawlLocationExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlLocationExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link LocationExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlLocationExpression(LocationExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessLocationExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link LocationExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlLocationExpression(LocationExpression obj, T arg) { + postprocessLocationExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link LocationExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessLocationExpression(LocationExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link LocationExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessLocationExpression(LocationExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link LocationParameter} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkLocationParameter(LocationParameter obj, T arg) { + precrawlLocationParameter(obj, arg); + Location _location = obj.getLocation(); + walkLocation(_location, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlLocationParameter(obj, arg); + } + + /** + * Pre-crawling function for the {@link LocationParameter} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlLocationParameter(LocationParameter obj, T arg) { + precrawlParameter(obj, arg); + preprocessLocationParameter(obj, arg); + } + + /** + * Post-crawling function for the {@link LocationParameter} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlLocationParameter(LocationParameter obj, T arg) { + postprocessLocationParameter(obj, arg); + postcrawlParameter(obj, arg); + } + + /** + * Pre-processing function for the {@link LocationParameter} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessLocationParameter(LocationParameter obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link LocationParameter} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessLocationParameter(LocationParameter obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Monitors} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkMonitors(Monitors obj, T arg) { + precrawlMonitors(obj, arg); + List _events = obj.getEvents(); + for (Expression x: _events) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlMonitors(obj, arg); + } + + /** + * Pre-crawling function for the {@link Monitors} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlMonitors(Monitors obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessMonitors(obj, arg); + } + + /** + * Post-crawling function for the {@link Monitors} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlMonitors(Monitors obj, T arg) { + postprocessMonitors(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link Monitors} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessMonitors(Monitors obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Monitors} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessMonitors(Monitors obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Parameter} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkParameter(Parameter obj, T arg) { + if (obj instanceof AlgParameter) { + walkAlgParameter((AlgParameter)obj, arg); + return; + } + if (obj instanceof ComponentParameter) { + walkComponentParameter((ComponentParameter)obj, arg); + return; + } + if (obj instanceof EventParameter) { + walkEventParameter((EventParameter)obj, arg); + return; + } + if (obj instanceof LocationParameter) { + walkLocationParameter((LocationParameter)obj, arg); + return; + } + String msg = "No redirect; unexpected object type: " + obj; + throw new IllegalArgumentException(msg); + } + + /** + * Pre-crawling function for the {@link Parameter} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlParameter(Parameter obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessParameter(obj, arg); + } + + /** + * Post-crawling function for the {@link Parameter} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlParameter(Parameter obj, T arg) { + postprocessParameter(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link Parameter} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessParameter(Parameter obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Parameter} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessParameter(Parameter obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Position} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkPosition(Position obj, T arg) { + precrawlPosition(obj, arg); + postcrawlPosition(obj, arg); + } + + /** + * Pre-crawling function for the {@link Position} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlPosition(Position obj, T arg) { + preprocessPosition(obj, arg); + } + + /** + * Post-crawling function for the {@link Position} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlPosition(Position obj, T arg) { + postprocessPosition(obj, arg); + } + + /** + * Pre-processing function for the {@link Position} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessPosition(Position obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Position} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessPosition(Position obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link PositionObject} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkPositionObject(PositionObject obj, T arg) { + if (obj instanceof Alphabet) { + walkAlphabet((Alphabet)obj, arg); + return; + } + if (obj instanceof CifType) { + walkCifType((CifType)obj, arg); + return; + } + if (obj instanceof Component) { + walkComponent((Component)obj, arg); + return; + } + if (obj instanceof ComponentDef) { + walkComponentDef((ComponentDef)obj, arg); + return; + } + if (obj instanceof Declaration) { + walkDeclaration((Declaration)obj, arg); + return; + } + if (obj instanceof DictPair) { + walkDictPair((DictPair)obj, arg); + return; + } + if (obj instanceof Edge) { + walkEdge((Edge)obj, arg); + return; + } + if (obj instanceof EdgeEvent) { + walkEdgeEvent((EdgeEvent)obj, arg); + return; + } + if (obj instanceof ElifExpression) { + walkElifExpression((ElifExpression)obj, arg); + return; + } + if (obj instanceof ElifFuncStatement) { + walkElifFuncStatement((ElifFuncStatement)obj, arg); + return; + } + if (obj instanceof ElifUpdate) { + walkElifUpdate((ElifUpdate)obj, arg); + return; + } + if (obj instanceof EnumLiteral) { + walkEnumLiteral((EnumLiteral)obj, arg); + return; + } + if (obj instanceof Equation) { + walkEquation((Equation)obj, arg); + return; + } + if (obj instanceof Expression) { + walkExpression((Expression)obj, arg); + return; + } + if (obj instanceof Field) { + walkField((Field)obj, arg); + return; + } + if (obj instanceof FunctionParameter) { + walkFunctionParameter((FunctionParameter)obj, arg); + return; + } + if (obj instanceof FunctionStatement) { + walkFunctionStatement((FunctionStatement)obj, arg); + return; + } + if (obj instanceof Invariant) { + walkInvariant((Invariant)obj, arg); + return; + } + if (obj instanceof IoDecl) { + walkIoDecl((IoDecl)obj, arg); + return; + } + if (obj instanceof Location) { + walkLocation((Location)obj, arg); + return; + } + if (obj instanceof Monitors) { + walkMonitors((Monitors)obj, arg); + return; + } + if (obj instanceof Parameter) { + walkParameter((Parameter)obj, arg); + return; + } + if (obj instanceof PrintFor) { + walkPrintFor((PrintFor)obj, arg); + return; + } + if (obj instanceof SvgInEvent) { + walkSvgInEvent((SvgInEvent)obj, arg); + return; + } + if (obj instanceof SvgInEventIfEntry) { + walkSvgInEventIfEntry((SvgInEventIfEntry)obj, arg); + return; + } + if (obj instanceof SwitchCase) { + walkSwitchCase((SwitchCase)obj, arg); + return; + } + if (obj instanceof Update) { + walkUpdate((Update)obj, arg); + return; + } + if (obj instanceof VariableValue) { + walkVariableValue((VariableValue)obj, arg); + return; + } + String msg = "No redirect; unexpected object type: " + obj; + throw new IllegalArgumentException(msg); + } + + /** + * Pre-crawling function for the {@link PositionObject} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlPositionObject(PositionObject obj, T arg) { + preprocessPositionObject(obj, arg); + } + + /** + * Post-crawling function for the {@link PositionObject} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlPositionObject(PositionObject obj, T arg) { + postprocessPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link PositionObject} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessPositionObject(PositionObject obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link PositionObject} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessPositionObject(PositionObject obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Print} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkPrint(Print obj, T arg) { + precrawlPrint(obj, arg); + PrintFile _file = obj.getFile(); + if (_file != null) { + walkPrintFile(_file, arg); + } + List _fors = obj.getFors(); + for (PrintFor x: _fors) { + walkPrintFor(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + Expression _txtPost = obj.getTxtPost(); + if (_txtPost != null) { + walkExpression(_txtPost, arg); + } + Expression _txtPre = obj.getTxtPre(); + if (_txtPre != null) { + walkExpression(_txtPre, arg); + } + Expression _whenPost = obj.getWhenPost(); + if (_whenPost != null) { + walkExpression(_whenPost, arg); + } + Expression _whenPre = obj.getWhenPre(); + if (_whenPre != null) { + walkExpression(_whenPre, arg); + } + postcrawlPrint(obj, arg); + } + + /** + * Pre-crawling function for the {@link Print} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlPrint(Print obj, T arg) { + precrawlIoDecl(obj, arg); + preprocessPrint(obj, arg); + } + + /** + * Post-crawling function for the {@link Print} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlPrint(Print obj, T arg) { + postprocessPrint(obj, arg); + postcrawlIoDecl(obj, arg); + } + + /** + * Pre-processing function for the {@link Print} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessPrint(Print obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Print} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessPrint(Print obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link PrintFile} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkPrintFile(PrintFile obj, T arg) { + precrawlPrintFile(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlPrintFile(obj, arg); + } + + /** + * Pre-crawling function for the {@link PrintFile} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlPrintFile(PrintFile obj, T arg) { + precrawlIoDecl(obj, arg); + preprocessPrintFile(obj, arg); + } + + /** + * Post-crawling function for the {@link PrintFile} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlPrintFile(PrintFile obj, T arg) { + postprocessPrintFile(obj, arg); + postcrawlIoDecl(obj, arg); + } + + /** + * Pre-processing function for the {@link PrintFile} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessPrintFile(PrintFile obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link PrintFile} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessPrintFile(PrintFile obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link PrintFor} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkPrintFor(PrintFor obj, T arg) { + precrawlPrintFor(obj, arg); + Expression _event = obj.getEvent(); + if (_event != null) { + walkExpression(_event, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlPrintFor(obj, arg); + } + + /** + * Pre-crawling function for the {@link PrintFor} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlPrintFor(PrintFor obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessPrintFor(obj, arg); + } + + /** + * Post-crawling function for the {@link PrintFor} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlPrintFor(PrintFor obj, T arg) { + postprocessPrintFor(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link PrintFor} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessPrintFor(PrintFor obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link PrintFor} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessPrintFor(PrintFor obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ProjectionExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkProjectionExpression(ProjectionExpression obj, T arg) { + precrawlProjectionExpression(obj, arg); + Expression _child = obj.getChild(); + walkExpression(_child, arg); + Expression _index = obj.getIndex(); + walkExpression(_index, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlProjectionExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link ProjectionExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlProjectionExpression(ProjectionExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessProjectionExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link ProjectionExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlProjectionExpression(ProjectionExpression obj, T arg) { + postprocessProjectionExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link ProjectionExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessProjectionExpression(ProjectionExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ProjectionExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessProjectionExpression(ProjectionExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link RealExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkRealExpression(RealExpression obj, T arg) { + precrawlRealExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlRealExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link RealExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlRealExpression(RealExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessRealExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link RealExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlRealExpression(RealExpression obj, T arg) { + postprocessRealExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link RealExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessRealExpression(RealExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link RealExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessRealExpression(RealExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link RealType} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkRealType(RealType obj, T arg) { + precrawlRealType(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlRealType(obj, arg); + } + + /** + * Pre-crawling function for the {@link RealType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlRealType(RealType obj, T arg) { + precrawlCifType(obj, arg); + preprocessRealType(obj, arg); + } + + /** + * Post-crawling function for the {@link RealType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlRealType(RealType obj, T arg) { + postprocessRealType(obj, arg); + postcrawlCifType(obj, arg); + } + + /** + * Pre-processing function for the {@link RealType} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessRealType(RealType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link RealType} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessRealType(RealType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ReceivedExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkReceivedExpression(ReceivedExpression obj, T arg) { + precrawlReceivedExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlReceivedExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link ReceivedExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlReceivedExpression(ReceivedExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessReceivedExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link ReceivedExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlReceivedExpression(ReceivedExpression obj, T arg) { + postprocessReceivedExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link ReceivedExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessReceivedExpression(ReceivedExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ReceivedExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessReceivedExpression(ReceivedExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link ReturnFuncStatement} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkReturnFuncStatement(ReturnFuncStatement obj, T arg) { + precrawlReturnFuncStatement(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + List _values = obj.getValues(); + for (Expression x: _values) { + walkExpression(x, arg); + } + postcrawlReturnFuncStatement(obj, arg); + } + + /** + * Pre-crawling function for the {@link ReturnFuncStatement} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlReturnFuncStatement(ReturnFuncStatement obj, T arg) { + precrawlFunctionStatement(obj, arg); + preprocessReturnFuncStatement(obj, arg); + } + + /** + * Post-crawling function for the {@link ReturnFuncStatement} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlReturnFuncStatement(ReturnFuncStatement obj, T arg) { + postprocessReturnFuncStatement(obj, arg); + postcrawlFunctionStatement(obj, arg); + } + + /** + * Pre-processing function for the {@link ReturnFuncStatement} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessReturnFuncStatement(ReturnFuncStatement obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link ReturnFuncStatement} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessReturnFuncStatement(ReturnFuncStatement obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link SelfExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkSelfExpression(SelfExpression obj, T arg) { + precrawlSelfExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlSelfExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link SelfExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlSelfExpression(SelfExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessSelfExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link SelfExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlSelfExpression(SelfExpression obj, T arg) { + postprocessSelfExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link SelfExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessSelfExpression(SelfExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link SelfExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessSelfExpression(SelfExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link SetExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkSetExpression(SetExpression obj, T arg) { + precrawlSetExpression(obj, arg); + List _elements = obj.getElements(); + for (Expression x: _elements) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlSetExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link SetExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlSetExpression(SetExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessSetExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link SetExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlSetExpression(SetExpression obj, T arg) { + postprocessSetExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link SetExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessSetExpression(SetExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link SetExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessSetExpression(SetExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link SetType} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkSetType(SetType obj, T arg) { + precrawlSetType(obj, arg); + CifType _elementType = obj.getElementType(); + walkCifType(_elementType, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlSetType(obj, arg); + } + + /** + * Pre-crawling function for the {@link SetType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlSetType(SetType obj, T arg) { + precrawlCifType(obj, arg); + preprocessSetType(obj, arg); + } + + /** + * Post-crawling function for the {@link SetType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlSetType(SetType obj, T arg) { + postprocessSetType(obj, arg); + postcrawlCifType(obj, arg); + } + + /** + * Pre-processing function for the {@link SetType} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessSetType(SetType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link SetType} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessSetType(SetType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link SliceExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkSliceExpression(SliceExpression obj, T arg) { + precrawlSliceExpression(obj, arg); + Expression _begin = obj.getBegin(); + if (_begin != null) { + walkExpression(_begin, arg); + } + Expression _child = obj.getChild(); + walkExpression(_child, arg); + Expression _end = obj.getEnd(); + if (_end != null) { + walkExpression(_end, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlSliceExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link SliceExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlSliceExpression(SliceExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessSliceExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link SliceExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlSliceExpression(SliceExpression obj, T arg) { + postprocessSliceExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link SliceExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessSliceExpression(SliceExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link SliceExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessSliceExpression(SliceExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Specification} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkSpecification(Specification obj, T arg) { + precrawlSpecification(obj, arg); + List _components = obj.getComponents(); + for (Component x: _components) { + walkComponent(x, arg); + } + List _declarations = obj.getDeclarations(); + for (Declaration x: _declarations) { + walkDeclaration(x, arg); + } + List _definitions = obj.getDefinitions(); + for (ComponentDef x: _definitions) { + walkComponentDef(x, arg); + } + List _equations = obj.getEquations(); + for (Equation x: _equations) { + walkEquation(x, arg); + } + List _initials = obj.getInitials(); + for (Expression x: _initials) { + walkExpression(x, arg); + } + List _invariants = obj.getInvariants(); + for (Invariant x: _invariants) { + walkInvariant(x, arg); + } + List _ioDecls = obj.getIoDecls(); + for (IoDecl x: _ioDecls) { + walkIoDecl(x, arg); + } + List _markeds = obj.getMarkeds(); + for (Expression x: _markeds) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlSpecification(obj, arg); + } + + /** + * Pre-crawling function for the {@link Specification} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlSpecification(Specification obj, T arg) { + precrawlGroup(obj, arg); + preprocessSpecification(obj, arg); + } + + /** + * Post-crawling function for the {@link Specification} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlSpecification(Specification obj, T arg) { + postprocessSpecification(obj, arg); + postcrawlGroup(obj, arg); + } + + /** + * Pre-processing function for the {@link Specification} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessSpecification(Specification obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Specification} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessSpecification(Specification obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link StdLibFunctionExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkStdLibFunctionExpression(StdLibFunctionExpression obj, T arg) { + precrawlStdLibFunctionExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlStdLibFunctionExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link StdLibFunctionExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlStdLibFunctionExpression(StdLibFunctionExpression obj, T arg) { + precrawlBaseFunctionExpression(obj, arg); + preprocessStdLibFunctionExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link StdLibFunctionExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlStdLibFunctionExpression(StdLibFunctionExpression obj, T arg) { + postprocessStdLibFunctionExpression(obj, arg); + postcrawlBaseFunctionExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link StdLibFunctionExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessStdLibFunctionExpression(StdLibFunctionExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link StdLibFunctionExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessStdLibFunctionExpression(StdLibFunctionExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link StringExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkStringExpression(StringExpression obj, T arg) { + precrawlStringExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlStringExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link StringExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlStringExpression(StringExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessStringExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link StringExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlStringExpression(StringExpression obj, T arg) { + postprocessStringExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link StringExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessStringExpression(StringExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link StringExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessStringExpression(StringExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link StringType} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkStringType(StringType obj, T arg) { + precrawlStringType(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlStringType(obj, arg); + } + + /** + * Pre-crawling function for the {@link StringType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlStringType(StringType obj, T arg) { + precrawlCifType(obj, arg); + preprocessStringType(obj, arg); + } + + /** + * Post-crawling function for the {@link StringType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlStringType(StringType obj, T arg) { + postprocessStringType(obj, arg); + postcrawlCifType(obj, arg); + } + + /** + * Pre-processing function for the {@link StringType} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessStringType(StringType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link StringType} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessStringType(StringType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link SvgCopy} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkSvgCopy(SvgCopy obj, T arg) { + precrawlSvgCopy(obj, arg); + Expression _id = obj.getId(); + walkExpression(_id, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + Expression _post = obj.getPost(); + if (_post != null) { + walkExpression(_post, arg); + } + Expression _pre = obj.getPre(); + if (_pre != null) { + walkExpression(_pre, arg); + } + SvgFile _svgFile = obj.getSvgFile(); + if (_svgFile != null) { + walkSvgFile(_svgFile, arg); + } + postcrawlSvgCopy(obj, arg); + } + + /** + * Pre-crawling function for the {@link SvgCopy} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlSvgCopy(SvgCopy obj, T arg) { + precrawlIoDecl(obj, arg); + preprocessSvgCopy(obj, arg); + } + + /** + * Post-crawling function for the {@link SvgCopy} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlSvgCopy(SvgCopy obj, T arg) { + postprocessSvgCopy(obj, arg); + postcrawlIoDecl(obj, arg); + } + + /** + * Pre-processing function for the {@link SvgCopy} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessSvgCopy(SvgCopy obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link SvgCopy} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessSvgCopy(SvgCopy obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link SvgFile} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkSvgFile(SvgFile obj, T arg) { + precrawlSvgFile(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlSvgFile(obj, arg); + } + + /** + * Pre-crawling function for the {@link SvgFile} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlSvgFile(SvgFile obj, T arg) { + precrawlIoDecl(obj, arg); + preprocessSvgFile(obj, arg); + } + + /** + * Post-crawling function for the {@link SvgFile} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlSvgFile(SvgFile obj, T arg) { + postprocessSvgFile(obj, arg); + postcrawlIoDecl(obj, arg); + } + + /** + * Pre-processing function for the {@link SvgFile} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessSvgFile(SvgFile obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link SvgFile} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessSvgFile(SvgFile obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link SvgIn} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkSvgIn(SvgIn obj, T arg) { + precrawlSvgIn(obj, arg); + SvgInEvent _event = obj.getEvent(); + walkSvgInEvent(_event, arg); + Expression _id = obj.getId(); + walkExpression(_id, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + SvgFile _svgFile = obj.getSvgFile(); + if (_svgFile != null) { + walkSvgFile(_svgFile, arg); + } + postcrawlSvgIn(obj, arg); + } + + /** + * Pre-crawling function for the {@link SvgIn} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlSvgIn(SvgIn obj, T arg) { + precrawlIoDecl(obj, arg); + preprocessSvgIn(obj, arg); + } + + /** + * Post-crawling function for the {@link SvgIn} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlSvgIn(SvgIn obj, T arg) { + postprocessSvgIn(obj, arg); + postcrawlIoDecl(obj, arg); + } + + /** + * Pre-processing function for the {@link SvgIn} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessSvgIn(SvgIn obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link SvgIn} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessSvgIn(SvgIn obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link SvgInEvent} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkSvgInEvent(SvgInEvent obj, T arg) { + if (obj instanceof SvgInEventIf) { + walkSvgInEventIf((SvgInEventIf)obj, arg); + return; + } + if (obj instanceof SvgInEventSingle) { + walkSvgInEventSingle((SvgInEventSingle)obj, arg); + return; + } + String msg = "No redirect; unexpected object type: " + obj; + throw new IllegalArgumentException(msg); + } + + /** + * Pre-crawling function for the {@link SvgInEvent} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlSvgInEvent(SvgInEvent obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessSvgInEvent(obj, arg); + } + + /** + * Post-crawling function for the {@link SvgInEvent} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlSvgInEvent(SvgInEvent obj, T arg) { + postprocessSvgInEvent(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link SvgInEvent} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessSvgInEvent(SvgInEvent obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link SvgInEvent} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessSvgInEvent(SvgInEvent obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link SvgInEventIf} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkSvgInEventIf(SvgInEventIf obj, T arg) { + precrawlSvgInEventIf(obj, arg); + List _entries = obj.getEntries(); + for (SvgInEventIfEntry x: _entries) { + walkSvgInEventIfEntry(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlSvgInEventIf(obj, arg); + } + + /** + * Pre-crawling function for the {@link SvgInEventIf} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlSvgInEventIf(SvgInEventIf obj, T arg) { + precrawlSvgInEvent(obj, arg); + preprocessSvgInEventIf(obj, arg); + } + + /** + * Post-crawling function for the {@link SvgInEventIf} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlSvgInEventIf(SvgInEventIf obj, T arg) { + postprocessSvgInEventIf(obj, arg); + postcrawlSvgInEvent(obj, arg); + } + + /** + * Pre-processing function for the {@link SvgInEventIf} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessSvgInEventIf(SvgInEventIf obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link SvgInEventIf} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessSvgInEventIf(SvgInEventIf obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link SvgInEventIfEntry} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkSvgInEventIfEntry(SvgInEventIfEntry obj, T arg) { + precrawlSvgInEventIfEntry(obj, arg); + Expression _event = obj.getEvent(); + walkExpression(_event, arg); + Expression _guard = obj.getGuard(); + if (_guard != null) { + walkExpression(_guard, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlSvgInEventIfEntry(obj, arg); + } + + /** + * Pre-crawling function for the {@link SvgInEventIfEntry} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlSvgInEventIfEntry(SvgInEventIfEntry obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessSvgInEventIfEntry(obj, arg); + } + + /** + * Post-crawling function for the {@link SvgInEventIfEntry} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlSvgInEventIfEntry(SvgInEventIfEntry obj, T arg) { + postprocessSvgInEventIfEntry(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link SvgInEventIfEntry} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessSvgInEventIfEntry(SvgInEventIfEntry obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link SvgInEventIfEntry} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessSvgInEventIfEntry(SvgInEventIfEntry obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link SvgInEventSingle} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkSvgInEventSingle(SvgInEventSingle obj, T arg) { + precrawlSvgInEventSingle(obj, arg); + Expression _event = obj.getEvent(); + walkExpression(_event, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlSvgInEventSingle(obj, arg); + } + + /** + * Pre-crawling function for the {@link SvgInEventSingle} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlSvgInEventSingle(SvgInEventSingle obj, T arg) { + precrawlSvgInEvent(obj, arg); + preprocessSvgInEventSingle(obj, arg); + } + + /** + * Post-crawling function for the {@link SvgInEventSingle} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlSvgInEventSingle(SvgInEventSingle obj, T arg) { + postprocessSvgInEventSingle(obj, arg); + postcrawlSvgInEvent(obj, arg); + } + + /** + * Pre-processing function for the {@link SvgInEventSingle} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessSvgInEventSingle(SvgInEventSingle obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link SvgInEventSingle} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessSvgInEventSingle(SvgInEventSingle obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link SvgMove} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkSvgMove(SvgMove obj, T arg) { + precrawlSvgMove(obj, arg); + Expression _id = obj.getId(); + walkExpression(_id, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + SvgFile _svgFile = obj.getSvgFile(); + if (_svgFile != null) { + walkSvgFile(_svgFile, arg); + } + Expression _x = obj.getX(); + walkExpression(_x, arg); + Expression _y = obj.getY(); + walkExpression(_y, arg); + postcrawlSvgMove(obj, arg); + } + + /** + * Pre-crawling function for the {@link SvgMove} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlSvgMove(SvgMove obj, T arg) { + precrawlIoDecl(obj, arg); + preprocessSvgMove(obj, arg); + } + + /** + * Post-crawling function for the {@link SvgMove} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlSvgMove(SvgMove obj, T arg) { + postprocessSvgMove(obj, arg); + postcrawlIoDecl(obj, arg); + } + + /** + * Pre-processing function for the {@link SvgMove} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessSvgMove(SvgMove obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link SvgMove} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessSvgMove(SvgMove obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link SvgOut} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkSvgOut(SvgOut obj, T arg) { + precrawlSvgOut(obj, arg); + Position _attrTextPos = obj.getAttrTextPos(); + walkPosition(_attrTextPos, arg); + Expression _id = obj.getId(); + walkExpression(_id, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + SvgFile _svgFile = obj.getSvgFile(); + if (_svgFile != null) { + walkSvgFile(_svgFile, arg); + } + Expression _value = obj.getValue(); + walkExpression(_value, arg); + postcrawlSvgOut(obj, arg); + } + + /** + * Pre-crawling function for the {@link SvgOut} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlSvgOut(SvgOut obj, T arg) { + precrawlIoDecl(obj, arg); + preprocessSvgOut(obj, arg); + } + + /** + * Post-crawling function for the {@link SvgOut} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlSvgOut(SvgOut obj, T arg) { + postprocessSvgOut(obj, arg); + postcrawlIoDecl(obj, arg); + } + + /** + * Pre-processing function for the {@link SvgOut} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessSvgOut(SvgOut obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link SvgOut} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessSvgOut(SvgOut obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link SwitchCase} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkSwitchCase(SwitchCase obj, T arg) { + precrawlSwitchCase(obj, arg); + Expression _key = obj.getKey(); + if (_key != null) { + walkExpression(_key, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + Expression _value = obj.getValue(); + walkExpression(_value, arg); + postcrawlSwitchCase(obj, arg); + } + + /** + * Pre-crawling function for the {@link SwitchCase} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlSwitchCase(SwitchCase obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessSwitchCase(obj, arg); + } + + /** + * Post-crawling function for the {@link SwitchCase} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlSwitchCase(SwitchCase obj, T arg) { + postprocessSwitchCase(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link SwitchCase} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessSwitchCase(SwitchCase obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link SwitchCase} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessSwitchCase(SwitchCase obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link SwitchExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkSwitchExpression(SwitchExpression obj, T arg) { + precrawlSwitchExpression(obj, arg); + List _cases = obj.getCases(); + for (SwitchCase x: _cases) { + walkSwitchCase(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + Expression _value = obj.getValue(); + walkExpression(_value, arg); + postcrawlSwitchExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link SwitchExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlSwitchExpression(SwitchExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessSwitchExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link SwitchExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlSwitchExpression(SwitchExpression obj, T arg) { + postprocessSwitchExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link SwitchExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessSwitchExpression(SwitchExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link SwitchExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessSwitchExpression(SwitchExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link TauExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkTauExpression(TauExpression obj, T arg) { + precrawlTauExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlTauExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link TauExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlTauExpression(TauExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessTauExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link TauExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlTauExpression(TauExpression obj, T arg) { + postprocessTauExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link TauExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessTauExpression(TauExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link TauExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessTauExpression(TauExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link TimeExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkTimeExpression(TimeExpression obj, T arg) { + precrawlTimeExpression(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlTimeExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link TimeExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlTimeExpression(TimeExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessTimeExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link TimeExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlTimeExpression(TimeExpression obj, T arg) { + postprocessTimeExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link TimeExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessTimeExpression(TimeExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link TimeExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessTimeExpression(TimeExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link TupleExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkTupleExpression(TupleExpression obj, T arg) { + precrawlTupleExpression(obj, arg); + List _fields = obj.getFields(); + for (Expression x: _fields) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlTupleExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link TupleExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlTupleExpression(TupleExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessTupleExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link TupleExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlTupleExpression(TupleExpression obj, T arg) { + postprocessTupleExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link TupleExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessTupleExpression(TupleExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link TupleExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessTupleExpression(TupleExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link TupleType} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkTupleType(TupleType obj, T arg) { + precrawlTupleType(obj, arg); + List _fields = obj.getFields(); + for (Field x: _fields) { + walkField(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlTupleType(obj, arg); + } + + /** + * Pre-crawling function for the {@link TupleType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlTupleType(TupleType obj, T arg) { + precrawlCifType(obj, arg); + preprocessTupleType(obj, arg); + } + + /** + * Post-crawling function for the {@link TupleType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlTupleType(TupleType obj, T arg) { + postprocessTupleType(obj, arg); + postcrawlCifType(obj, arg); + } + + /** + * Pre-processing function for the {@link TupleType} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessTupleType(TupleType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link TupleType} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessTupleType(TupleType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link TypeDecl} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkTypeDecl(TypeDecl obj, T arg) { + precrawlTypeDecl(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlTypeDecl(obj, arg); + } + + /** + * Pre-crawling function for the {@link TypeDecl} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlTypeDecl(TypeDecl obj, T arg) { + precrawlDeclaration(obj, arg); + preprocessTypeDecl(obj, arg); + } + + /** + * Post-crawling function for the {@link TypeDecl} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlTypeDecl(TypeDecl obj, T arg) { + postprocessTypeDecl(obj, arg); + postcrawlDeclaration(obj, arg); + } + + /** + * Pre-processing function for the {@link TypeDecl} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessTypeDecl(TypeDecl obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link TypeDecl} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessTypeDecl(TypeDecl obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link TypeRef} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkTypeRef(TypeRef obj, T arg) { + precrawlTypeRef(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlTypeRef(obj, arg); + } + + /** + * Pre-crawling function for the {@link TypeRef} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlTypeRef(TypeRef obj, T arg) { + precrawlCifType(obj, arg); + preprocessTypeRef(obj, arg); + } + + /** + * Post-crawling function for the {@link TypeRef} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlTypeRef(TypeRef obj, T arg) { + postprocessTypeRef(obj, arg); + postcrawlCifType(obj, arg); + } + + /** + * Pre-processing function for the {@link TypeRef} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessTypeRef(TypeRef obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link TypeRef} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessTypeRef(TypeRef obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link UnaryExpression} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkUnaryExpression(UnaryExpression obj, T arg) { + precrawlUnaryExpression(obj, arg); + Expression _child = obj.getChild(); + walkExpression(_child, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + CifType _type = obj.getType(); + walkCifType(_type, arg); + postcrawlUnaryExpression(obj, arg); + } + + /** + * Pre-crawling function for the {@link UnaryExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlUnaryExpression(UnaryExpression obj, T arg) { + precrawlExpression(obj, arg); + preprocessUnaryExpression(obj, arg); + } + + /** + * Post-crawling function for the {@link UnaryExpression} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlUnaryExpression(UnaryExpression obj, T arg) { + postprocessUnaryExpression(obj, arg); + postcrawlExpression(obj, arg); + } + + /** + * Pre-processing function for the {@link UnaryExpression} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessUnaryExpression(UnaryExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link UnaryExpression} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessUnaryExpression(UnaryExpression obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link Update} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkUpdate(Update obj, T arg) { + if (obj instanceof Assignment) { + walkAssignment((Assignment)obj, arg); + return; + } + if (obj instanceof IfUpdate) { + walkIfUpdate((IfUpdate)obj, arg); + return; + } + String msg = "No redirect; unexpected object type: " + obj; + throw new IllegalArgumentException(msg); + } + + /** + * Pre-crawling function for the {@link Update} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlUpdate(Update obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessUpdate(obj, arg); + } + + /** + * Post-crawling function for the {@link Update} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlUpdate(Update obj, T arg) { + postprocessUpdate(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link Update} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessUpdate(Update obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link Update} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessUpdate(Update obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link VariableValue} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkVariableValue(VariableValue obj, T arg) { + precrawlVariableValue(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + List _values = obj.getValues(); + for (Expression x: _values) { + walkExpression(x, arg); + } + postcrawlVariableValue(obj, arg); + } + + /** + * Pre-crawling function for the {@link VariableValue} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlVariableValue(VariableValue obj, T arg) { + precrawlPositionObject(obj, arg); + preprocessVariableValue(obj, arg); + } + + /** + * Post-crawling function for the {@link VariableValue} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlVariableValue(VariableValue obj, T arg) { + postprocessVariableValue(obj, arg); + postcrawlPositionObject(obj, arg); + } + + /** + * Pre-processing function for the {@link VariableValue} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessVariableValue(VariableValue obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link VariableValue} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessVariableValue(VariableValue obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link VoidType} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkVoidType(VoidType obj, T arg) { + precrawlVoidType(obj, arg); + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + postcrawlVoidType(obj, arg); + } + + /** + * Pre-crawling function for the {@link VoidType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlVoidType(VoidType obj, T arg) { + precrawlCifType(obj, arg); + preprocessVoidType(obj, arg); + } + + /** + * Post-crawling function for the {@link VoidType} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlVoidType(VoidType obj, T arg) { + postprocessVoidType(obj, arg); + postcrawlCifType(obj, arg); + } + + /** + * Pre-processing function for the {@link VoidType} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessVoidType(VoidType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link VoidType} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessVoidType(VoidType obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Walking function for the {@link WhileFuncStatement} class. + * + * @param obj The object to walk over. + * @param arg The extra argument provided to the walking method. + */ + protected void walkWhileFuncStatement(WhileFuncStatement obj, T arg) { + precrawlWhileFuncStatement(obj, arg); + List _guards = obj.getGuards(); + for (Expression x: _guards) { + walkExpression(x, arg); + } + Position _position = obj.getPosition(); + if (_position != null) { + walkPosition(_position, arg); + } + List _statements = obj.getStatements(); + for (FunctionStatement x: _statements) { + walkFunctionStatement(x, arg); + } + postcrawlWhileFuncStatement(obj, arg); + } + + /** + * Pre-crawling function for the {@link WhileFuncStatement} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the pre-crawling method. + */ + protected void precrawlWhileFuncStatement(WhileFuncStatement obj, T arg) { + precrawlFunctionStatement(obj, arg); + preprocessWhileFuncStatement(obj, arg); + } + + /** + * Post-crawling function for the {@link WhileFuncStatement} class. + * + * @param obj The object to crawl over. + * @param arg The extra argument provided to the post-crawling method. + */ + protected void postcrawlWhileFuncStatement(WhileFuncStatement obj, T arg) { + postprocessWhileFuncStatement(obj, arg); + postcrawlFunctionStatement(obj, arg); + } + + /** + * Pre-processing function for the {@link WhileFuncStatement} class. + * + * @param obj The object to pre-process. + * @param arg The extra argument provided to the pre-processing method. + */ + protected void preprocessWhileFuncStatement(WhileFuncStatement obj, T arg) { + // Derived classes may override this method to do actual processing. + } + + /** + * Post-processing function for the {@link WhileFuncStatement} class. + * + * @param obj The object to post-process. + * @param arg The extra argument provided to the post-processing method. + */ + protected void postprocessWhileFuncStatement(WhileFuncStatement obj, T arg) { + // Derived classes may override this method to do actual processing. + } +} diff --git a/cif/org.eclipse.escet.cif.metamodel.java/src-gen/org/eclipse/escet/cif/metamodel/java/CompositeCifWalker.java b/cif/org.eclipse.escet.cif.metamodel.java/src-gen/org/eclipse/escet/cif/metamodel/java/CompositeCifWalker.java new file mode 100644 index 0000000000000000000000000000000000000000..8ac6d468a66dcc0b9aceb17160c486eba6df85af --- /dev/null +++ b/cif/org.eclipse.escet.cif.metamodel.java/src-gen/org/eclipse/escet/cif/metamodel/java/CompositeCifWalker.java @@ -0,0 +1,1903 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +// Generated using the "org.eclipse.escet.common.emf.ecore.codegen" project. + +// Disable Eclipse Java formatter for generated code file: +// @formatter:off + +package org.eclipse.escet.cif.metamodel.java; + +import org.eclipse.escet.cif.metamodel.cif.AlgParameter; +import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; +import org.eclipse.escet.cif.metamodel.cif.Component; +import org.eclipse.escet.cif.metamodel.cif.ComponentDef; +import org.eclipse.escet.cif.metamodel.cif.ComponentInst; +import org.eclipse.escet.cif.metamodel.cif.ComponentParameter; +import org.eclipse.escet.cif.metamodel.cif.Equation; +import org.eclipse.escet.cif.metamodel.cif.EventParameter; +import org.eclipse.escet.cif.metamodel.cif.Group; +import org.eclipse.escet.cif.metamodel.cif.Invariant; +import org.eclipse.escet.cif.metamodel.cif.IoDecl; +import org.eclipse.escet.cif.metamodel.cif.LocationParameter; +import org.eclipse.escet.cif.metamodel.cif.Parameter; +import org.eclipse.escet.cif.metamodel.cif.Specification; +import org.eclipse.escet.cif.metamodel.cif.automata.Alphabet; +import org.eclipse.escet.cif.metamodel.cif.automata.Assignment; +import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.metamodel.cif.automata.Edge; +import org.eclipse.escet.cif.metamodel.cif.automata.EdgeEvent; +import org.eclipse.escet.cif.metamodel.cif.automata.EdgeReceive; +import org.eclipse.escet.cif.metamodel.cif.automata.EdgeSend; +import org.eclipse.escet.cif.metamodel.cif.automata.ElifUpdate; +import org.eclipse.escet.cif.metamodel.cif.automata.IfUpdate; +import org.eclipse.escet.cif.metamodel.cif.automata.Location; +import org.eclipse.escet.cif.metamodel.cif.automata.Monitors; +import org.eclipse.escet.cif.metamodel.cif.automata.Update; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgCopy; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgFile; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgIn; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgInEvent; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgInEventIf; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgInEventIfEntry; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgInEventSingle; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgMove; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgOut; +import org.eclipse.escet.cif.metamodel.cif.declarations.AlgVariable; +import org.eclipse.escet.cif.metamodel.cif.declarations.Constant; +import org.eclipse.escet.cif.metamodel.cif.declarations.ContVariable; +import org.eclipse.escet.cif.metamodel.cif.declarations.Declaration; +import org.eclipse.escet.cif.metamodel.cif.declarations.DiscVariable; +import org.eclipse.escet.cif.metamodel.cif.declarations.EnumDecl; +import org.eclipse.escet.cif.metamodel.cif.declarations.EnumLiteral; +import org.eclipse.escet.cif.metamodel.cif.declarations.Event; +import org.eclipse.escet.cif.metamodel.cif.declarations.InputVariable; +import org.eclipse.escet.cif.metamodel.cif.declarations.TypeDecl; +import org.eclipse.escet.cif.metamodel.cif.declarations.VariableValue; +import org.eclipse.escet.cif.metamodel.cif.expressions.AlgVariableExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.BaseFunctionExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.BoolExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.CastExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.CompInstWrapExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.CompParamExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.CompParamWrapExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ComponentExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ConstantExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ContVariableExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.DictExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.DictPair; +import org.eclipse.escet.cif.metamodel.cif.expressions.DiscVariableExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ElifExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.EnumLiteralExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.EventExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.Expression; +import org.eclipse.escet.cif.metamodel.cif.expressions.FieldExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.FunctionCallExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.FunctionExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.IfExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.InputVariableExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.IntExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ListExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.LocationExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ProjectionExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.RealExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ReceivedExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.SelfExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.SetExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.SliceExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.StdLibFunctionExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.StringExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.SwitchCase; +import org.eclipse.escet.cif.metamodel.cif.expressions.SwitchExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.TauExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.TimeExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.TupleExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.UnaryExpression; +import org.eclipse.escet.cif.metamodel.cif.functions.AssignmentFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.BreakFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.ContinueFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.ElifFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.ExternalFunction; +import org.eclipse.escet.cif.metamodel.cif.functions.Function; +import org.eclipse.escet.cif.metamodel.cif.functions.FunctionParameter; +import org.eclipse.escet.cif.metamodel.cif.functions.FunctionStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.IfFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.InternalFunction; +import org.eclipse.escet.cif.metamodel.cif.functions.ReturnFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.WhileFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.print.Print; +import org.eclipse.escet.cif.metamodel.cif.print.PrintFile; +import org.eclipse.escet.cif.metamodel.cif.print.PrintFor; +import org.eclipse.escet.cif.metamodel.cif.types.BoolType; +import org.eclipse.escet.cif.metamodel.cif.types.CifType; +import org.eclipse.escet.cif.metamodel.cif.types.CompInstWrapType; +import org.eclipse.escet.cif.metamodel.cif.types.CompParamWrapType; +import org.eclipse.escet.cif.metamodel.cif.types.ComponentDefType; +import org.eclipse.escet.cif.metamodel.cif.types.ComponentType; +import org.eclipse.escet.cif.metamodel.cif.types.DictType; +import org.eclipse.escet.cif.metamodel.cif.types.DistType; +import org.eclipse.escet.cif.metamodel.cif.types.EnumType; +import org.eclipse.escet.cif.metamodel.cif.types.Field; +import org.eclipse.escet.cif.metamodel.cif.types.FuncType; +import org.eclipse.escet.cif.metamodel.cif.types.IntType; +import org.eclipse.escet.cif.metamodel.cif.types.ListType; +import org.eclipse.escet.cif.metamodel.cif.types.RealType; +import org.eclipse.escet.cif.metamodel.cif.types.SetType; +import org.eclipse.escet.cif.metamodel.cif.types.StringType; +import org.eclipse.escet.cif.metamodel.cif.types.TupleType; +import org.eclipse.escet.cif.metamodel.cif.types.TypeRef; +import org.eclipse.escet.cif.metamodel.cif.types.VoidType; +import org.eclipse.escet.common.position.metamodel.position.Position; +import org.eclipse.escet.common.position.metamodel.position.PositionObject; + +/** + * A composite walker for "cif" models. + * + *

The composite walker works as follows: + *

    + *
  • Performs a top-down depth-first walk over the object tree, using the + * containment hierarchy.
  • + *
  • No particular order should be assumed for walking over the child + * features.
  • + *
  • For each object encountered, pre-processing is performed before walking + * over the children, and post-processing is performed after walking over + * the children.
  • + *
  • Pre-processing for objects is done by crawling up the inheritance + * hierarchy of the object, performing pre-processing for each of the + * types encountered in the type hierarchy. The pre-processing methods are + * invoked from most general to most specific class (super classes before + * base classes).
  • + *
  • Post-processing for objects is done by crawling up the inheritance + * hierarchy of the object, performing post-processing for each of the + * types encountered in the type hierarchy. The post-processing methods are + * invoked from most specific to most general class (base classes before + * super classes).
  • + *
+ *

+ * + *

A composite walking does not perform any pre-processing or post-processing + * by itself. It can be configured with any number of other (composite or + * non-composite) model walkers. As pre-processing and post-processing the + * composite model walker invokes pre-processing and post-processing on each + * 'other' model walker, in the order they are supplied. The walking and + * crawling methods of the non-composite of the 'other' model walkers are not + * used.

+ * + *

This abstract walker class has no public methods. It is up to the derived + * classes to add a public method as entry method. They can decide which + * classes are to be used as starting point, and they can give the public + * method a proper name, parameters, etc. They may even allow multiple public + * methods to allow starting from multiple classes.

+ */ +public abstract class CompositeCifWalker extends CifWalker { + /** The walkers to be composed by this composite walker. */ + private final CifWalker[] walkers; + + /** + * Constructor of the {@link CompositeCifWalker} class. + * + * @param walkers The walkers to be composed by this composite walker. + */ + public CompositeCifWalker(CifWalker[] walkers) { + this.walkers = walkers; + } + + @Override + protected void preprocessAlgParameter(AlgParameter obj) { + for (CifWalker walker: walkers) { + walker.preprocessAlgParameter(obj); + } + } + + @Override + protected void postprocessAlgParameter(AlgParameter obj) { + for (CifWalker walker: walkers) { + walker.postprocessAlgParameter(obj); + } + } + + @Override + protected void preprocessAlgVariable(AlgVariable obj) { + for (CifWalker walker: walkers) { + walker.preprocessAlgVariable(obj); + } + } + + @Override + protected void postprocessAlgVariable(AlgVariable obj) { + for (CifWalker walker: walkers) { + walker.postprocessAlgVariable(obj); + } + } + + @Override + protected void preprocessAlgVariableExpression(AlgVariableExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessAlgVariableExpression(obj); + } + } + + @Override + protected void postprocessAlgVariableExpression(AlgVariableExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessAlgVariableExpression(obj); + } + } + + @Override + protected void preprocessAlphabet(Alphabet obj) { + for (CifWalker walker: walkers) { + walker.preprocessAlphabet(obj); + } + } + + @Override + protected void postprocessAlphabet(Alphabet obj) { + for (CifWalker walker: walkers) { + walker.postprocessAlphabet(obj); + } + } + + @Override + protected void preprocessAssignment(Assignment obj) { + for (CifWalker walker: walkers) { + walker.preprocessAssignment(obj); + } + } + + @Override + protected void postprocessAssignment(Assignment obj) { + for (CifWalker walker: walkers) { + walker.postprocessAssignment(obj); + } + } + + @Override + protected void preprocessAssignmentFuncStatement(AssignmentFuncStatement obj) { + for (CifWalker walker: walkers) { + walker.preprocessAssignmentFuncStatement(obj); + } + } + + @Override + protected void postprocessAssignmentFuncStatement(AssignmentFuncStatement obj) { + for (CifWalker walker: walkers) { + walker.postprocessAssignmentFuncStatement(obj); + } + } + + @Override + protected void preprocessAutomaton(Automaton obj) { + for (CifWalker walker: walkers) { + walker.preprocessAutomaton(obj); + } + } + + @Override + protected void postprocessAutomaton(Automaton obj) { + for (CifWalker walker: walkers) { + walker.postprocessAutomaton(obj); + } + } + + @Override + protected void preprocessBaseFunctionExpression(BaseFunctionExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessBaseFunctionExpression(obj); + } + } + + @Override + protected void postprocessBaseFunctionExpression(BaseFunctionExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessBaseFunctionExpression(obj); + } + } + + @Override + protected void preprocessBinaryExpression(BinaryExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessBinaryExpression(obj); + } + } + + @Override + protected void postprocessBinaryExpression(BinaryExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessBinaryExpression(obj); + } + } + + @Override + protected void preprocessBoolExpression(BoolExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessBoolExpression(obj); + } + } + + @Override + protected void postprocessBoolExpression(BoolExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessBoolExpression(obj); + } + } + + @Override + protected void preprocessBoolType(BoolType obj) { + for (CifWalker walker: walkers) { + walker.preprocessBoolType(obj); + } + } + + @Override + protected void postprocessBoolType(BoolType obj) { + for (CifWalker walker: walkers) { + walker.postprocessBoolType(obj); + } + } + + @Override + protected void preprocessBreakFuncStatement(BreakFuncStatement obj) { + for (CifWalker walker: walkers) { + walker.preprocessBreakFuncStatement(obj); + } + } + + @Override + protected void postprocessBreakFuncStatement(BreakFuncStatement obj) { + for (CifWalker walker: walkers) { + walker.postprocessBreakFuncStatement(obj); + } + } + + @Override + protected void preprocessCastExpression(CastExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessCastExpression(obj); + } + } + + @Override + protected void postprocessCastExpression(CastExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessCastExpression(obj); + } + } + + @Override + protected void preprocessCifType(CifType obj) { + for (CifWalker walker: walkers) { + walker.preprocessCifType(obj); + } + } + + @Override + protected void postprocessCifType(CifType obj) { + for (CifWalker walker: walkers) { + walker.postprocessCifType(obj); + } + } + + @Override + protected void preprocessCompInstWrapExpression(CompInstWrapExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessCompInstWrapExpression(obj); + } + } + + @Override + protected void postprocessCompInstWrapExpression(CompInstWrapExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessCompInstWrapExpression(obj); + } + } + + @Override + protected void preprocessCompInstWrapType(CompInstWrapType obj) { + for (CifWalker walker: walkers) { + walker.preprocessCompInstWrapType(obj); + } + } + + @Override + protected void postprocessCompInstWrapType(CompInstWrapType obj) { + for (CifWalker walker: walkers) { + walker.postprocessCompInstWrapType(obj); + } + } + + @Override + protected void preprocessCompParamExpression(CompParamExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessCompParamExpression(obj); + } + } + + @Override + protected void postprocessCompParamExpression(CompParamExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessCompParamExpression(obj); + } + } + + @Override + protected void preprocessCompParamWrapExpression(CompParamWrapExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessCompParamWrapExpression(obj); + } + } + + @Override + protected void postprocessCompParamWrapExpression(CompParamWrapExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessCompParamWrapExpression(obj); + } + } + + @Override + protected void preprocessCompParamWrapType(CompParamWrapType obj) { + for (CifWalker walker: walkers) { + walker.preprocessCompParamWrapType(obj); + } + } + + @Override + protected void postprocessCompParamWrapType(CompParamWrapType obj) { + for (CifWalker walker: walkers) { + walker.postprocessCompParamWrapType(obj); + } + } + + @Override + protected void preprocessComplexComponent(ComplexComponent obj) { + for (CifWalker walker: walkers) { + walker.preprocessComplexComponent(obj); + } + } + + @Override + protected void postprocessComplexComponent(ComplexComponent obj) { + for (CifWalker walker: walkers) { + walker.postprocessComplexComponent(obj); + } + } + + @Override + protected void preprocessComponent(Component obj) { + for (CifWalker walker: walkers) { + walker.preprocessComponent(obj); + } + } + + @Override + protected void postprocessComponent(Component obj) { + for (CifWalker walker: walkers) { + walker.postprocessComponent(obj); + } + } + + @Override + protected void preprocessComponentDef(ComponentDef obj) { + for (CifWalker walker: walkers) { + walker.preprocessComponentDef(obj); + } + } + + @Override + protected void postprocessComponentDef(ComponentDef obj) { + for (CifWalker walker: walkers) { + walker.postprocessComponentDef(obj); + } + } + + @Override + protected void preprocessComponentDefType(ComponentDefType obj) { + for (CifWalker walker: walkers) { + walker.preprocessComponentDefType(obj); + } + } + + @Override + protected void postprocessComponentDefType(ComponentDefType obj) { + for (CifWalker walker: walkers) { + walker.postprocessComponentDefType(obj); + } + } + + @Override + protected void preprocessComponentExpression(ComponentExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessComponentExpression(obj); + } + } + + @Override + protected void postprocessComponentExpression(ComponentExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessComponentExpression(obj); + } + } + + @Override + protected void preprocessComponentInst(ComponentInst obj) { + for (CifWalker walker: walkers) { + walker.preprocessComponentInst(obj); + } + } + + @Override + protected void postprocessComponentInst(ComponentInst obj) { + for (CifWalker walker: walkers) { + walker.postprocessComponentInst(obj); + } + } + + @Override + protected void preprocessComponentParameter(ComponentParameter obj) { + for (CifWalker walker: walkers) { + walker.preprocessComponentParameter(obj); + } + } + + @Override + protected void postprocessComponentParameter(ComponentParameter obj) { + for (CifWalker walker: walkers) { + walker.postprocessComponentParameter(obj); + } + } + + @Override + protected void preprocessComponentType(ComponentType obj) { + for (CifWalker walker: walkers) { + walker.preprocessComponentType(obj); + } + } + + @Override + protected void postprocessComponentType(ComponentType obj) { + for (CifWalker walker: walkers) { + walker.postprocessComponentType(obj); + } + } + + @Override + protected void preprocessConstant(Constant obj) { + for (CifWalker walker: walkers) { + walker.preprocessConstant(obj); + } + } + + @Override + protected void postprocessConstant(Constant obj) { + for (CifWalker walker: walkers) { + walker.postprocessConstant(obj); + } + } + + @Override + protected void preprocessConstantExpression(ConstantExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessConstantExpression(obj); + } + } + + @Override + protected void postprocessConstantExpression(ConstantExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessConstantExpression(obj); + } + } + + @Override + protected void preprocessContVariable(ContVariable obj) { + for (CifWalker walker: walkers) { + walker.preprocessContVariable(obj); + } + } + + @Override + protected void postprocessContVariable(ContVariable obj) { + for (CifWalker walker: walkers) { + walker.postprocessContVariable(obj); + } + } + + @Override + protected void preprocessContVariableExpression(ContVariableExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessContVariableExpression(obj); + } + } + + @Override + protected void postprocessContVariableExpression(ContVariableExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessContVariableExpression(obj); + } + } + + @Override + protected void preprocessContinueFuncStatement(ContinueFuncStatement obj) { + for (CifWalker walker: walkers) { + walker.preprocessContinueFuncStatement(obj); + } + } + + @Override + protected void postprocessContinueFuncStatement(ContinueFuncStatement obj) { + for (CifWalker walker: walkers) { + walker.postprocessContinueFuncStatement(obj); + } + } + + @Override + protected void preprocessDeclaration(Declaration obj) { + for (CifWalker walker: walkers) { + walker.preprocessDeclaration(obj); + } + } + + @Override + protected void postprocessDeclaration(Declaration obj) { + for (CifWalker walker: walkers) { + walker.postprocessDeclaration(obj); + } + } + + @Override + protected void preprocessDictExpression(DictExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessDictExpression(obj); + } + } + + @Override + protected void postprocessDictExpression(DictExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessDictExpression(obj); + } + } + + @Override + protected void preprocessDictPair(DictPair obj) { + for (CifWalker walker: walkers) { + walker.preprocessDictPair(obj); + } + } + + @Override + protected void postprocessDictPair(DictPair obj) { + for (CifWalker walker: walkers) { + walker.postprocessDictPair(obj); + } + } + + @Override + protected void preprocessDictType(DictType obj) { + for (CifWalker walker: walkers) { + walker.preprocessDictType(obj); + } + } + + @Override + protected void postprocessDictType(DictType obj) { + for (CifWalker walker: walkers) { + walker.postprocessDictType(obj); + } + } + + @Override + protected void preprocessDiscVariable(DiscVariable obj) { + for (CifWalker walker: walkers) { + walker.preprocessDiscVariable(obj); + } + } + + @Override + protected void postprocessDiscVariable(DiscVariable obj) { + for (CifWalker walker: walkers) { + walker.postprocessDiscVariable(obj); + } + } + + @Override + protected void preprocessDiscVariableExpression(DiscVariableExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessDiscVariableExpression(obj); + } + } + + @Override + protected void postprocessDiscVariableExpression(DiscVariableExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessDiscVariableExpression(obj); + } + } + + @Override + protected void preprocessDistType(DistType obj) { + for (CifWalker walker: walkers) { + walker.preprocessDistType(obj); + } + } + + @Override + protected void postprocessDistType(DistType obj) { + for (CifWalker walker: walkers) { + walker.postprocessDistType(obj); + } + } + + @Override + protected void preprocessEdge(Edge obj) { + for (CifWalker walker: walkers) { + walker.preprocessEdge(obj); + } + } + + @Override + protected void postprocessEdge(Edge obj) { + for (CifWalker walker: walkers) { + walker.postprocessEdge(obj); + } + } + + @Override + protected void preprocessEdgeEvent(EdgeEvent obj) { + for (CifWalker walker: walkers) { + walker.preprocessEdgeEvent(obj); + } + } + + @Override + protected void postprocessEdgeEvent(EdgeEvent obj) { + for (CifWalker walker: walkers) { + walker.postprocessEdgeEvent(obj); + } + } + + @Override + protected void preprocessEdgeReceive(EdgeReceive obj) { + for (CifWalker walker: walkers) { + walker.preprocessEdgeReceive(obj); + } + } + + @Override + protected void postprocessEdgeReceive(EdgeReceive obj) { + for (CifWalker walker: walkers) { + walker.postprocessEdgeReceive(obj); + } + } + + @Override + protected void preprocessEdgeSend(EdgeSend obj) { + for (CifWalker walker: walkers) { + walker.preprocessEdgeSend(obj); + } + } + + @Override + protected void postprocessEdgeSend(EdgeSend obj) { + for (CifWalker walker: walkers) { + walker.postprocessEdgeSend(obj); + } + } + + @Override + protected void preprocessElifExpression(ElifExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessElifExpression(obj); + } + } + + @Override + protected void postprocessElifExpression(ElifExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessElifExpression(obj); + } + } + + @Override + protected void preprocessElifFuncStatement(ElifFuncStatement obj) { + for (CifWalker walker: walkers) { + walker.preprocessElifFuncStatement(obj); + } + } + + @Override + protected void postprocessElifFuncStatement(ElifFuncStatement obj) { + for (CifWalker walker: walkers) { + walker.postprocessElifFuncStatement(obj); + } + } + + @Override + protected void preprocessElifUpdate(ElifUpdate obj) { + for (CifWalker walker: walkers) { + walker.preprocessElifUpdate(obj); + } + } + + @Override + protected void postprocessElifUpdate(ElifUpdate obj) { + for (CifWalker walker: walkers) { + walker.postprocessElifUpdate(obj); + } + } + + @Override + protected void preprocessEnumDecl(EnumDecl obj) { + for (CifWalker walker: walkers) { + walker.preprocessEnumDecl(obj); + } + } + + @Override + protected void postprocessEnumDecl(EnumDecl obj) { + for (CifWalker walker: walkers) { + walker.postprocessEnumDecl(obj); + } + } + + @Override + protected void preprocessEnumLiteral(EnumLiteral obj) { + for (CifWalker walker: walkers) { + walker.preprocessEnumLiteral(obj); + } + } + + @Override + protected void postprocessEnumLiteral(EnumLiteral obj) { + for (CifWalker walker: walkers) { + walker.postprocessEnumLiteral(obj); + } + } + + @Override + protected void preprocessEnumLiteralExpression(EnumLiteralExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessEnumLiteralExpression(obj); + } + } + + @Override + protected void postprocessEnumLiteralExpression(EnumLiteralExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessEnumLiteralExpression(obj); + } + } + + @Override + protected void preprocessEnumType(EnumType obj) { + for (CifWalker walker: walkers) { + walker.preprocessEnumType(obj); + } + } + + @Override + protected void postprocessEnumType(EnumType obj) { + for (CifWalker walker: walkers) { + walker.postprocessEnumType(obj); + } + } + + @Override + protected void preprocessEquation(Equation obj) { + for (CifWalker walker: walkers) { + walker.preprocessEquation(obj); + } + } + + @Override + protected void postprocessEquation(Equation obj) { + for (CifWalker walker: walkers) { + walker.postprocessEquation(obj); + } + } + + @Override + protected void preprocessEvent(Event obj) { + for (CifWalker walker: walkers) { + walker.preprocessEvent(obj); + } + } + + @Override + protected void postprocessEvent(Event obj) { + for (CifWalker walker: walkers) { + walker.postprocessEvent(obj); + } + } + + @Override + protected void preprocessEventExpression(EventExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessEventExpression(obj); + } + } + + @Override + protected void postprocessEventExpression(EventExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessEventExpression(obj); + } + } + + @Override + protected void preprocessEventParameter(EventParameter obj) { + for (CifWalker walker: walkers) { + walker.preprocessEventParameter(obj); + } + } + + @Override + protected void postprocessEventParameter(EventParameter obj) { + for (CifWalker walker: walkers) { + walker.postprocessEventParameter(obj); + } + } + + @Override + protected void preprocessExpression(Expression obj) { + for (CifWalker walker: walkers) { + walker.preprocessExpression(obj); + } + } + + @Override + protected void postprocessExpression(Expression obj) { + for (CifWalker walker: walkers) { + walker.postprocessExpression(obj); + } + } + + @Override + protected void preprocessExternalFunction(ExternalFunction obj) { + for (CifWalker walker: walkers) { + walker.preprocessExternalFunction(obj); + } + } + + @Override + protected void postprocessExternalFunction(ExternalFunction obj) { + for (CifWalker walker: walkers) { + walker.postprocessExternalFunction(obj); + } + } + + @Override + protected void preprocessField(Field obj) { + for (CifWalker walker: walkers) { + walker.preprocessField(obj); + } + } + + @Override + protected void postprocessField(Field obj) { + for (CifWalker walker: walkers) { + walker.postprocessField(obj); + } + } + + @Override + protected void preprocessFieldExpression(FieldExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessFieldExpression(obj); + } + } + + @Override + protected void postprocessFieldExpression(FieldExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessFieldExpression(obj); + } + } + + @Override + protected void preprocessFuncType(FuncType obj) { + for (CifWalker walker: walkers) { + walker.preprocessFuncType(obj); + } + } + + @Override + protected void postprocessFuncType(FuncType obj) { + for (CifWalker walker: walkers) { + walker.postprocessFuncType(obj); + } + } + + @Override + protected void preprocessFunction(Function obj) { + for (CifWalker walker: walkers) { + walker.preprocessFunction(obj); + } + } + + @Override + protected void postprocessFunction(Function obj) { + for (CifWalker walker: walkers) { + walker.postprocessFunction(obj); + } + } + + @Override + protected void preprocessFunctionCallExpression(FunctionCallExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessFunctionCallExpression(obj); + } + } + + @Override + protected void postprocessFunctionCallExpression(FunctionCallExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessFunctionCallExpression(obj); + } + } + + @Override + protected void preprocessFunctionExpression(FunctionExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessFunctionExpression(obj); + } + } + + @Override + protected void postprocessFunctionExpression(FunctionExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessFunctionExpression(obj); + } + } + + @Override + protected void preprocessFunctionParameter(FunctionParameter obj) { + for (CifWalker walker: walkers) { + walker.preprocessFunctionParameter(obj); + } + } + + @Override + protected void postprocessFunctionParameter(FunctionParameter obj) { + for (CifWalker walker: walkers) { + walker.postprocessFunctionParameter(obj); + } + } + + @Override + protected void preprocessFunctionStatement(FunctionStatement obj) { + for (CifWalker walker: walkers) { + walker.preprocessFunctionStatement(obj); + } + } + + @Override + protected void postprocessFunctionStatement(FunctionStatement obj) { + for (CifWalker walker: walkers) { + walker.postprocessFunctionStatement(obj); + } + } + + @Override + protected void preprocessGroup(Group obj) { + for (CifWalker walker: walkers) { + walker.preprocessGroup(obj); + } + } + + @Override + protected void postprocessGroup(Group obj) { + for (CifWalker walker: walkers) { + walker.postprocessGroup(obj); + } + } + + @Override + protected void preprocessIfExpression(IfExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessIfExpression(obj); + } + } + + @Override + protected void postprocessIfExpression(IfExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessIfExpression(obj); + } + } + + @Override + protected void preprocessIfFuncStatement(IfFuncStatement obj) { + for (CifWalker walker: walkers) { + walker.preprocessIfFuncStatement(obj); + } + } + + @Override + protected void postprocessIfFuncStatement(IfFuncStatement obj) { + for (CifWalker walker: walkers) { + walker.postprocessIfFuncStatement(obj); + } + } + + @Override + protected void preprocessIfUpdate(IfUpdate obj) { + for (CifWalker walker: walkers) { + walker.preprocessIfUpdate(obj); + } + } + + @Override + protected void postprocessIfUpdate(IfUpdate obj) { + for (CifWalker walker: walkers) { + walker.postprocessIfUpdate(obj); + } + } + + @Override + protected void preprocessInputVariable(InputVariable obj) { + for (CifWalker walker: walkers) { + walker.preprocessInputVariable(obj); + } + } + + @Override + protected void postprocessInputVariable(InputVariable obj) { + for (CifWalker walker: walkers) { + walker.postprocessInputVariable(obj); + } + } + + @Override + protected void preprocessInputVariableExpression(InputVariableExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessInputVariableExpression(obj); + } + } + + @Override + protected void postprocessInputVariableExpression(InputVariableExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessInputVariableExpression(obj); + } + } + + @Override + protected void preprocessIntExpression(IntExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessIntExpression(obj); + } + } + + @Override + protected void postprocessIntExpression(IntExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessIntExpression(obj); + } + } + + @Override + protected void preprocessIntType(IntType obj) { + for (CifWalker walker: walkers) { + walker.preprocessIntType(obj); + } + } + + @Override + protected void postprocessIntType(IntType obj) { + for (CifWalker walker: walkers) { + walker.postprocessIntType(obj); + } + } + + @Override + protected void preprocessInternalFunction(InternalFunction obj) { + for (CifWalker walker: walkers) { + walker.preprocessInternalFunction(obj); + } + } + + @Override + protected void postprocessInternalFunction(InternalFunction obj) { + for (CifWalker walker: walkers) { + walker.postprocessInternalFunction(obj); + } + } + + @Override + protected void preprocessInvariant(Invariant obj) { + for (CifWalker walker: walkers) { + walker.preprocessInvariant(obj); + } + } + + @Override + protected void postprocessInvariant(Invariant obj) { + for (CifWalker walker: walkers) { + walker.postprocessInvariant(obj); + } + } + + @Override + protected void preprocessIoDecl(IoDecl obj) { + for (CifWalker walker: walkers) { + walker.preprocessIoDecl(obj); + } + } + + @Override + protected void postprocessIoDecl(IoDecl obj) { + for (CifWalker walker: walkers) { + walker.postprocessIoDecl(obj); + } + } + + @Override + protected void preprocessListExpression(ListExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessListExpression(obj); + } + } + + @Override + protected void postprocessListExpression(ListExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessListExpression(obj); + } + } + + @Override + protected void preprocessListType(ListType obj) { + for (CifWalker walker: walkers) { + walker.preprocessListType(obj); + } + } + + @Override + protected void postprocessListType(ListType obj) { + for (CifWalker walker: walkers) { + walker.postprocessListType(obj); + } + } + + @Override + protected void preprocessLocation(Location obj) { + for (CifWalker walker: walkers) { + walker.preprocessLocation(obj); + } + } + + @Override + protected void postprocessLocation(Location obj) { + for (CifWalker walker: walkers) { + walker.postprocessLocation(obj); + } + } + + @Override + protected void preprocessLocationExpression(LocationExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessLocationExpression(obj); + } + } + + @Override + protected void postprocessLocationExpression(LocationExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessLocationExpression(obj); + } + } + + @Override + protected void preprocessLocationParameter(LocationParameter obj) { + for (CifWalker walker: walkers) { + walker.preprocessLocationParameter(obj); + } + } + + @Override + protected void postprocessLocationParameter(LocationParameter obj) { + for (CifWalker walker: walkers) { + walker.postprocessLocationParameter(obj); + } + } + + @Override + protected void preprocessMonitors(Monitors obj) { + for (CifWalker walker: walkers) { + walker.preprocessMonitors(obj); + } + } + + @Override + protected void postprocessMonitors(Monitors obj) { + for (CifWalker walker: walkers) { + walker.postprocessMonitors(obj); + } + } + + @Override + protected void preprocessParameter(Parameter obj) { + for (CifWalker walker: walkers) { + walker.preprocessParameter(obj); + } + } + + @Override + protected void postprocessParameter(Parameter obj) { + for (CifWalker walker: walkers) { + walker.postprocessParameter(obj); + } + } + + @Override + protected void preprocessPosition(Position obj) { + for (CifWalker walker: walkers) { + walker.preprocessPosition(obj); + } + } + + @Override + protected void postprocessPosition(Position obj) { + for (CifWalker walker: walkers) { + walker.postprocessPosition(obj); + } + } + + @Override + protected void preprocessPositionObject(PositionObject obj) { + for (CifWalker walker: walkers) { + walker.preprocessPositionObject(obj); + } + } + + @Override + protected void postprocessPositionObject(PositionObject obj) { + for (CifWalker walker: walkers) { + walker.postprocessPositionObject(obj); + } + } + + @Override + protected void preprocessPrint(Print obj) { + for (CifWalker walker: walkers) { + walker.preprocessPrint(obj); + } + } + + @Override + protected void postprocessPrint(Print obj) { + for (CifWalker walker: walkers) { + walker.postprocessPrint(obj); + } + } + + @Override + protected void preprocessPrintFile(PrintFile obj) { + for (CifWalker walker: walkers) { + walker.preprocessPrintFile(obj); + } + } + + @Override + protected void postprocessPrintFile(PrintFile obj) { + for (CifWalker walker: walkers) { + walker.postprocessPrintFile(obj); + } + } + + @Override + protected void preprocessPrintFor(PrintFor obj) { + for (CifWalker walker: walkers) { + walker.preprocessPrintFor(obj); + } + } + + @Override + protected void postprocessPrintFor(PrintFor obj) { + for (CifWalker walker: walkers) { + walker.postprocessPrintFor(obj); + } + } + + @Override + protected void preprocessProjectionExpression(ProjectionExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessProjectionExpression(obj); + } + } + + @Override + protected void postprocessProjectionExpression(ProjectionExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessProjectionExpression(obj); + } + } + + @Override + protected void preprocessRealExpression(RealExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessRealExpression(obj); + } + } + + @Override + protected void postprocessRealExpression(RealExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessRealExpression(obj); + } + } + + @Override + protected void preprocessRealType(RealType obj) { + for (CifWalker walker: walkers) { + walker.preprocessRealType(obj); + } + } + + @Override + protected void postprocessRealType(RealType obj) { + for (CifWalker walker: walkers) { + walker.postprocessRealType(obj); + } + } + + @Override + protected void preprocessReceivedExpression(ReceivedExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessReceivedExpression(obj); + } + } + + @Override + protected void postprocessReceivedExpression(ReceivedExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessReceivedExpression(obj); + } + } + + @Override + protected void preprocessReturnFuncStatement(ReturnFuncStatement obj) { + for (CifWalker walker: walkers) { + walker.preprocessReturnFuncStatement(obj); + } + } + + @Override + protected void postprocessReturnFuncStatement(ReturnFuncStatement obj) { + for (CifWalker walker: walkers) { + walker.postprocessReturnFuncStatement(obj); + } + } + + @Override + protected void preprocessSelfExpression(SelfExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessSelfExpression(obj); + } + } + + @Override + protected void postprocessSelfExpression(SelfExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessSelfExpression(obj); + } + } + + @Override + protected void preprocessSetExpression(SetExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessSetExpression(obj); + } + } + + @Override + protected void postprocessSetExpression(SetExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessSetExpression(obj); + } + } + + @Override + protected void preprocessSetType(SetType obj) { + for (CifWalker walker: walkers) { + walker.preprocessSetType(obj); + } + } + + @Override + protected void postprocessSetType(SetType obj) { + for (CifWalker walker: walkers) { + walker.postprocessSetType(obj); + } + } + + @Override + protected void preprocessSliceExpression(SliceExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessSliceExpression(obj); + } + } + + @Override + protected void postprocessSliceExpression(SliceExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessSliceExpression(obj); + } + } + + @Override + protected void preprocessSpecification(Specification obj) { + for (CifWalker walker: walkers) { + walker.preprocessSpecification(obj); + } + } + + @Override + protected void postprocessSpecification(Specification obj) { + for (CifWalker walker: walkers) { + walker.postprocessSpecification(obj); + } + } + + @Override + protected void preprocessStdLibFunctionExpression(StdLibFunctionExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessStdLibFunctionExpression(obj); + } + } + + @Override + protected void postprocessStdLibFunctionExpression(StdLibFunctionExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessStdLibFunctionExpression(obj); + } + } + + @Override + protected void preprocessStringExpression(StringExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessStringExpression(obj); + } + } + + @Override + protected void postprocessStringExpression(StringExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessStringExpression(obj); + } + } + + @Override + protected void preprocessStringType(StringType obj) { + for (CifWalker walker: walkers) { + walker.preprocessStringType(obj); + } + } + + @Override + protected void postprocessStringType(StringType obj) { + for (CifWalker walker: walkers) { + walker.postprocessStringType(obj); + } + } + + @Override + protected void preprocessSvgCopy(SvgCopy obj) { + for (CifWalker walker: walkers) { + walker.preprocessSvgCopy(obj); + } + } + + @Override + protected void postprocessSvgCopy(SvgCopy obj) { + for (CifWalker walker: walkers) { + walker.postprocessSvgCopy(obj); + } + } + + @Override + protected void preprocessSvgFile(SvgFile obj) { + for (CifWalker walker: walkers) { + walker.preprocessSvgFile(obj); + } + } + + @Override + protected void postprocessSvgFile(SvgFile obj) { + for (CifWalker walker: walkers) { + walker.postprocessSvgFile(obj); + } + } + + @Override + protected void preprocessSvgIn(SvgIn obj) { + for (CifWalker walker: walkers) { + walker.preprocessSvgIn(obj); + } + } + + @Override + protected void postprocessSvgIn(SvgIn obj) { + for (CifWalker walker: walkers) { + walker.postprocessSvgIn(obj); + } + } + + @Override + protected void preprocessSvgInEvent(SvgInEvent obj) { + for (CifWalker walker: walkers) { + walker.preprocessSvgInEvent(obj); + } + } + + @Override + protected void postprocessSvgInEvent(SvgInEvent obj) { + for (CifWalker walker: walkers) { + walker.postprocessSvgInEvent(obj); + } + } + + @Override + protected void preprocessSvgInEventIf(SvgInEventIf obj) { + for (CifWalker walker: walkers) { + walker.preprocessSvgInEventIf(obj); + } + } + + @Override + protected void postprocessSvgInEventIf(SvgInEventIf obj) { + for (CifWalker walker: walkers) { + walker.postprocessSvgInEventIf(obj); + } + } + + @Override + protected void preprocessSvgInEventIfEntry(SvgInEventIfEntry obj) { + for (CifWalker walker: walkers) { + walker.preprocessSvgInEventIfEntry(obj); + } + } + + @Override + protected void postprocessSvgInEventIfEntry(SvgInEventIfEntry obj) { + for (CifWalker walker: walkers) { + walker.postprocessSvgInEventIfEntry(obj); + } + } + + @Override + protected void preprocessSvgInEventSingle(SvgInEventSingle obj) { + for (CifWalker walker: walkers) { + walker.preprocessSvgInEventSingle(obj); + } + } + + @Override + protected void postprocessSvgInEventSingle(SvgInEventSingle obj) { + for (CifWalker walker: walkers) { + walker.postprocessSvgInEventSingle(obj); + } + } + + @Override + protected void preprocessSvgMove(SvgMove obj) { + for (CifWalker walker: walkers) { + walker.preprocessSvgMove(obj); + } + } + + @Override + protected void postprocessSvgMove(SvgMove obj) { + for (CifWalker walker: walkers) { + walker.postprocessSvgMove(obj); + } + } + + @Override + protected void preprocessSvgOut(SvgOut obj) { + for (CifWalker walker: walkers) { + walker.preprocessSvgOut(obj); + } + } + + @Override + protected void postprocessSvgOut(SvgOut obj) { + for (CifWalker walker: walkers) { + walker.postprocessSvgOut(obj); + } + } + + @Override + protected void preprocessSwitchCase(SwitchCase obj) { + for (CifWalker walker: walkers) { + walker.preprocessSwitchCase(obj); + } + } + + @Override + protected void postprocessSwitchCase(SwitchCase obj) { + for (CifWalker walker: walkers) { + walker.postprocessSwitchCase(obj); + } + } + + @Override + protected void preprocessSwitchExpression(SwitchExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessSwitchExpression(obj); + } + } + + @Override + protected void postprocessSwitchExpression(SwitchExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessSwitchExpression(obj); + } + } + + @Override + protected void preprocessTauExpression(TauExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessTauExpression(obj); + } + } + + @Override + protected void postprocessTauExpression(TauExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessTauExpression(obj); + } + } + + @Override + protected void preprocessTimeExpression(TimeExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessTimeExpression(obj); + } + } + + @Override + protected void postprocessTimeExpression(TimeExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessTimeExpression(obj); + } + } + + @Override + protected void preprocessTupleExpression(TupleExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessTupleExpression(obj); + } + } + + @Override + protected void postprocessTupleExpression(TupleExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessTupleExpression(obj); + } + } + + @Override + protected void preprocessTupleType(TupleType obj) { + for (CifWalker walker: walkers) { + walker.preprocessTupleType(obj); + } + } + + @Override + protected void postprocessTupleType(TupleType obj) { + for (CifWalker walker: walkers) { + walker.postprocessTupleType(obj); + } + } + + @Override + protected void preprocessTypeDecl(TypeDecl obj) { + for (CifWalker walker: walkers) { + walker.preprocessTypeDecl(obj); + } + } + + @Override + protected void postprocessTypeDecl(TypeDecl obj) { + for (CifWalker walker: walkers) { + walker.postprocessTypeDecl(obj); + } + } + + @Override + protected void preprocessTypeRef(TypeRef obj) { + for (CifWalker walker: walkers) { + walker.preprocessTypeRef(obj); + } + } + + @Override + protected void postprocessTypeRef(TypeRef obj) { + for (CifWalker walker: walkers) { + walker.postprocessTypeRef(obj); + } + } + + @Override + protected void preprocessUnaryExpression(UnaryExpression obj) { + for (CifWalker walker: walkers) { + walker.preprocessUnaryExpression(obj); + } + } + + @Override + protected void postprocessUnaryExpression(UnaryExpression obj) { + for (CifWalker walker: walkers) { + walker.postprocessUnaryExpression(obj); + } + } + + @Override + protected void preprocessUpdate(Update obj) { + for (CifWalker walker: walkers) { + walker.preprocessUpdate(obj); + } + } + + @Override + protected void postprocessUpdate(Update obj) { + for (CifWalker walker: walkers) { + walker.postprocessUpdate(obj); + } + } + + @Override + protected void preprocessVariableValue(VariableValue obj) { + for (CifWalker walker: walkers) { + walker.preprocessVariableValue(obj); + } + } + + @Override + protected void postprocessVariableValue(VariableValue obj) { + for (CifWalker walker: walkers) { + walker.postprocessVariableValue(obj); + } + } + + @Override + protected void preprocessVoidType(VoidType obj) { + for (CifWalker walker: walkers) { + walker.preprocessVoidType(obj); + } + } + + @Override + protected void postprocessVoidType(VoidType obj) { + for (CifWalker walker: walkers) { + walker.postprocessVoidType(obj); + } + } + + @Override + protected void preprocessWhileFuncStatement(WhileFuncStatement obj) { + for (CifWalker walker: walkers) { + walker.preprocessWhileFuncStatement(obj); + } + } + + @Override + protected void postprocessWhileFuncStatement(WhileFuncStatement obj) { + for (CifWalker walker: walkers) { + walker.postprocessWhileFuncStatement(obj); + } + } +} diff --git a/cif/org.eclipse.escet.cif.metamodel.java/src-gen/org/eclipse/escet/cif/metamodel/java/CompositeCifWithArgWalker.java b/cif/org.eclipse.escet.cif.metamodel.java/src-gen/org/eclipse/escet/cif/metamodel/java/CompositeCifWithArgWalker.java new file mode 100644 index 0000000000000000000000000000000000000000..b8c8ffbba0a5d4b4593d33b6a426223182e5fa0e --- /dev/null +++ b/cif/org.eclipse.escet.cif.metamodel.java/src-gen/org/eclipse/escet/cif/metamodel/java/CompositeCifWithArgWalker.java @@ -0,0 +1,1906 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +// Generated using the "org.eclipse.escet.common.emf.ecore.codegen" project. + +// Disable Eclipse Java formatter for generated code file: +// @formatter:off + +package org.eclipse.escet.cif.metamodel.java; + +import org.eclipse.escet.cif.metamodel.cif.AlgParameter; +import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; +import org.eclipse.escet.cif.metamodel.cif.Component; +import org.eclipse.escet.cif.metamodel.cif.ComponentDef; +import org.eclipse.escet.cif.metamodel.cif.ComponentInst; +import org.eclipse.escet.cif.metamodel.cif.ComponentParameter; +import org.eclipse.escet.cif.metamodel.cif.Equation; +import org.eclipse.escet.cif.metamodel.cif.EventParameter; +import org.eclipse.escet.cif.metamodel.cif.Group; +import org.eclipse.escet.cif.metamodel.cif.Invariant; +import org.eclipse.escet.cif.metamodel.cif.IoDecl; +import org.eclipse.escet.cif.metamodel.cif.LocationParameter; +import org.eclipse.escet.cif.metamodel.cif.Parameter; +import org.eclipse.escet.cif.metamodel.cif.Specification; +import org.eclipse.escet.cif.metamodel.cif.automata.Alphabet; +import org.eclipse.escet.cif.metamodel.cif.automata.Assignment; +import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.metamodel.cif.automata.Edge; +import org.eclipse.escet.cif.metamodel.cif.automata.EdgeEvent; +import org.eclipse.escet.cif.metamodel.cif.automata.EdgeReceive; +import org.eclipse.escet.cif.metamodel.cif.automata.EdgeSend; +import org.eclipse.escet.cif.metamodel.cif.automata.ElifUpdate; +import org.eclipse.escet.cif.metamodel.cif.automata.IfUpdate; +import org.eclipse.escet.cif.metamodel.cif.automata.Location; +import org.eclipse.escet.cif.metamodel.cif.automata.Monitors; +import org.eclipse.escet.cif.metamodel.cif.automata.Update; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgCopy; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgFile; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgIn; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgInEvent; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgInEventIf; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgInEventIfEntry; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgInEventSingle; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgMove; +import org.eclipse.escet.cif.metamodel.cif.cifsvg.SvgOut; +import org.eclipse.escet.cif.metamodel.cif.declarations.AlgVariable; +import org.eclipse.escet.cif.metamodel.cif.declarations.Constant; +import org.eclipse.escet.cif.metamodel.cif.declarations.ContVariable; +import org.eclipse.escet.cif.metamodel.cif.declarations.Declaration; +import org.eclipse.escet.cif.metamodel.cif.declarations.DiscVariable; +import org.eclipse.escet.cif.metamodel.cif.declarations.EnumDecl; +import org.eclipse.escet.cif.metamodel.cif.declarations.EnumLiteral; +import org.eclipse.escet.cif.metamodel.cif.declarations.Event; +import org.eclipse.escet.cif.metamodel.cif.declarations.InputVariable; +import org.eclipse.escet.cif.metamodel.cif.declarations.TypeDecl; +import org.eclipse.escet.cif.metamodel.cif.declarations.VariableValue; +import org.eclipse.escet.cif.metamodel.cif.expressions.AlgVariableExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.BaseFunctionExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.BoolExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.CastExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.CompInstWrapExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.CompParamExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.CompParamWrapExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ComponentExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ConstantExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ContVariableExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.DictExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.DictPair; +import org.eclipse.escet.cif.metamodel.cif.expressions.DiscVariableExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ElifExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.EnumLiteralExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.EventExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.Expression; +import org.eclipse.escet.cif.metamodel.cif.expressions.FieldExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.FunctionCallExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.FunctionExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.IfExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.InputVariableExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.IntExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ListExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.LocationExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ProjectionExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.RealExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.ReceivedExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.SelfExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.SetExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.SliceExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.StdLibFunctionExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.StringExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.SwitchCase; +import org.eclipse.escet.cif.metamodel.cif.expressions.SwitchExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.TauExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.TimeExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.TupleExpression; +import org.eclipse.escet.cif.metamodel.cif.expressions.UnaryExpression; +import org.eclipse.escet.cif.metamodel.cif.functions.AssignmentFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.BreakFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.ContinueFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.ElifFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.ExternalFunction; +import org.eclipse.escet.cif.metamodel.cif.functions.Function; +import org.eclipse.escet.cif.metamodel.cif.functions.FunctionParameter; +import org.eclipse.escet.cif.metamodel.cif.functions.FunctionStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.IfFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.InternalFunction; +import org.eclipse.escet.cif.metamodel.cif.functions.ReturnFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.functions.WhileFuncStatement; +import org.eclipse.escet.cif.metamodel.cif.print.Print; +import org.eclipse.escet.cif.metamodel.cif.print.PrintFile; +import org.eclipse.escet.cif.metamodel.cif.print.PrintFor; +import org.eclipse.escet.cif.metamodel.cif.types.BoolType; +import org.eclipse.escet.cif.metamodel.cif.types.CifType; +import org.eclipse.escet.cif.metamodel.cif.types.CompInstWrapType; +import org.eclipse.escet.cif.metamodel.cif.types.CompParamWrapType; +import org.eclipse.escet.cif.metamodel.cif.types.ComponentDefType; +import org.eclipse.escet.cif.metamodel.cif.types.ComponentType; +import org.eclipse.escet.cif.metamodel.cif.types.DictType; +import org.eclipse.escet.cif.metamodel.cif.types.DistType; +import org.eclipse.escet.cif.metamodel.cif.types.EnumType; +import org.eclipse.escet.cif.metamodel.cif.types.Field; +import org.eclipse.escet.cif.metamodel.cif.types.FuncType; +import org.eclipse.escet.cif.metamodel.cif.types.IntType; +import org.eclipse.escet.cif.metamodel.cif.types.ListType; +import org.eclipse.escet.cif.metamodel.cif.types.RealType; +import org.eclipse.escet.cif.metamodel.cif.types.SetType; +import org.eclipse.escet.cif.metamodel.cif.types.StringType; +import org.eclipse.escet.cif.metamodel.cif.types.TupleType; +import org.eclipse.escet.cif.metamodel.cif.types.TypeRef; +import org.eclipse.escet.cif.metamodel.cif.types.VoidType; +import org.eclipse.escet.common.position.metamodel.position.Position; +import org.eclipse.escet.common.position.metamodel.position.PositionObject; + +/** + * A composite walker for "cif" models. + * + *

The composite walker works as follows: + *

    + *
  • Performs a top-down depth-first walk over the object tree, using the + * containment hierarchy.
  • + *
  • No particular order should be assumed for walking over the child + * features.
  • + *
  • For each object encountered, pre-processing is performed before walking + * over the children, and post-processing is performed after walking over + * the children.
  • + *
  • Pre-processing for objects is done by crawling up the inheritance + * hierarchy of the object, performing pre-processing for each of the + * types encountered in the type hierarchy. The pre-processing methods are + * invoked from most general to most specific class (super classes before + * base classes).
  • + *
  • Post-processing for objects is done by crawling up the inheritance + * hierarchy of the object, performing post-processing for each of the + * types encountered in the type hierarchy. The post-processing methods are + * invoked from most specific to most general class (base classes before + * super classes).
  • + *
+ *

+ * + *

A composite walking does not perform any pre-processing or post-processing + * by itself. It can be configured with any number of other (composite or + * non-composite) model walkers. As pre-processing and post-processing the + * composite model walker invokes pre-processing and post-processing on each + * 'other' model walker, in the order they are supplied. The walking and + * crawling methods of the non-composite of the 'other' model walkers are not + * used.

+ * + *

This abstract walker class has no public methods. It is up to the derived + * classes to add a public method as entry method. They can decide which + * classes are to be used as starting point, and they can give the public + * method a proper name, parameters, etc. They may even allow multiple public + * methods to allow starting from multiple classes.

+ * + * @param The type of the extra argument provided to the walking, crawling + * and processing methods. + */ +public abstract class CompositeCifWithArgWalker extends CifWithArgWalker { + /** The walkers to be composed by this composite walker. */ + private final CifWithArgWalker[] walkers; + + /** + * Constructor of the {@link CompositeCifWithArgWalker} class. + * + * @param walkers The walkers to be composed by this composite walker. + */ + public CompositeCifWithArgWalker(CifWithArgWalker[] walkers) { + this.walkers = walkers; + } + + @Override + protected void preprocessAlgParameter(AlgParameter obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessAlgParameter(obj, arg); + } + } + + @Override + protected void postprocessAlgParameter(AlgParameter obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessAlgParameter(obj, arg); + } + } + + @Override + protected void preprocessAlgVariable(AlgVariable obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessAlgVariable(obj, arg); + } + } + + @Override + protected void postprocessAlgVariable(AlgVariable obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessAlgVariable(obj, arg); + } + } + + @Override + protected void preprocessAlgVariableExpression(AlgVariableExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessAlgVariableExpression(obj, arg); + } + } + + @Override + protected void postprocessAlgVariableExpression(AlgVariableExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessAlgVariableExpression(obj, arg); + } + } + + @Override + protected void preprocessAlphabet(Alphabet obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessAlphabet(obj, arg); + } + } + + @Override + protected void postprocessAlphabet(Alphabet obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessAlphabet(obj, arg); + } + } + + @Override + protected void preprocessAssignment(Assignment obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessAssignment(obj, arg); + } + } + + @Override + protected void postprocessAssignment(Assignment obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessAssignment(obj, arg); + } + } + + @Override + protected void preprocessAssignmentFuncStatement(AssignmentFuncStatement obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessAssignmentFuncStatement(obj, arg); + } + } + + @Override + protected void postprocessAssignmentFuncStatement(AssignmentFuncStatement obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessAssignmentFuncStatement(obj, arg); + } + } + + @Override + protected void preprocessAutomaton(Automaton obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessAutomaton(obj, arg); + } + } + + @Override + protected void postprocessAutomaton(Automaton obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessAutomaton(obj, arg); + } + } + + @Override + protected void preprocessBaseFunctionExpression(BaseFunctionExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessBaseFunctionExpression(obj, arg); + } + } + + @Override + protected void postprocessBaseFunctionExpression(BaseFunctionExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessBaseFunctionExpression(obj, arg); + } + } + + @Override + protected void preprocessBinaryExpression(BinaryExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessBinaryExpression(obj, arg); + } + } + + @Override + protected void postprocessBinaryExpression(BinaryExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessBinaryExpression(obj, arg); + } + } + + @Override + protected void preprocessBoolExpression(BoolExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessBoolExpression(obj, arg); + } + } + + @Override + protected void postprocessBoolExpression(BoolExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessBoolExpression(obj, arg); + } + } + + @Override + protected void preprocessBoolType(BoolType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessBoolType(obj, arg); + } + } + + @Override + protected void postprocessBoolType(BoolType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessBoolType(obj, arg); + } + } + + @Override + protected void preprocessBreakFuncStatement(BreakFuncStatement obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessBreakFuncStatement(obj, arg); + } + } + + @Override + protected void postprocessBreakFuncStatement(BreakFuncStatement obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessBreakFuncStatement(obj, arg); + } + } + + @Override + protected void preprocessCastExpression(CastExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessCastExpression(obj, arg); + } + } + + @Override + protected void postprocessCastExpression(CastExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessCastExpression(obj, arg); + } + } + + @Override + protected void preprocessCifType(CifType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessCifType(obj, arg); + } + } + + @Override + protected void postprocessCifType(CifType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessCifType(obj, arg); + } + } + + @Override + protected void preprocessCompInstWrapExpression(CompInstWrapExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessCompInstWrapExpression(obj, arg); + } + } + + @Override + protected void postprocessCompInstWrapExpression(CompInstWrapExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessCompInstWrapExpression(obj, arg); + } + } + + @Override + protected void preprocessCompInstWrapType(CompInstWrapType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessCompInstWrapType(obj, arg); + } + } + + @Override + protected void postprocessCompInstWrapType(CompInstWrapType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessCompInstWrapType(obj, arg); + } + } + + @Override + protected void preprocessCompParamExpression(CompParamExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessCompParamExpression(obj, arg); + } + } + + @Override + protected void postprocessCompParamExpression(CompParamExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessCompParamExpression(obj, arg); + } + } + + @Override + protected void preprocessCompParamWrapExpression(CompParamWrapExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessCompParamWrapExpression(obj, arg); + } + } + + @Override + protected void postprocessCompParamWrapExpression(CompParamWrapExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessCompParamWrapExpression(obj, arg); + } + } + + @Override + protected void preprocessCompParamWrapType(CompParamWrapType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessCompParamWrapType(obj, arg); + } + } + + @Override + protected void postprocessCompParamWrapType(CompParamWrapType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessCompParamWrapType(obj, arg); + } + } + + @Override + protected void preprocessComplexComponent(ComplexComponent obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessComplexComponent(obj, arg); + } + } + + @Override + protected void postprocessComplexComponent(ComplexComponent obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessComplexComponent(obj, arg); + } + } + + @Override + protected void preprocessComponent(Component obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessComponent(obj, arg); + } + } + + @Override + protected void postprocessComponent(Component obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessComponent(obj, arg); + } + } + + @Override + protected void preprocessComponentDef(ComponentDef obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessComponentDef(obj, arg); + } + } + + @Override + protected void postprocessComponentDef(ComponentDef obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessComponentDef(obj, arg); + } + } + + @Override + protected void preprocessComponentDefType(ComponentDefType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessComponentDefType(obj, arg); + } + } + + @Override + protected void postprocessComponentDefType(ComponentDefType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessComponentDefType(obj, arg); + } + } + + @Override + protected void preprocessComponentExpression(ComponentExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessComponentExpression(obj, arg); + } + } + + @Override + protected void postprocessComponentExpression(ComponentExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessComponentExpression(obj, arg); + } + } + + @Override + protected void preprocessComponentInst(ComponentInst obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessComponentInst(obj, arg); + } + } + + @Override + protected void postprocessComponentInst(ComponentInst obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessComponentInst(obj, arg); + } + } + + @Override + protected void preprocessComponentParameter(ComponentParameter obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessComponentParameter(obj, arg); + } + } + + @Override + protected void postprocessComponentParameter(ComponentParameter obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessComponentParameter(obj, arg); + } + } + + @Override + protected void preprocessComponentType(ComponentType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessComponentType(obj, arg); + } + } + + @Override + protected void postprocessComponentType(ComponentType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessComponentType(obj, arg); + } + } + + @Override + protected void preprocessConstant(Constant obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessConstant(obj, arg); + } + } + + @Override + protected void postprocessConstant(Constant obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessConstant(obj, arg); + } + } + + @Override + protected void preprocessConstantExpression(ConstantExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessConstantExpression(obj, arg); + } + } + + @Override + protected void postprocessConstantExpression(ConstantExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessConstantExpression(obj, arg); + } + } + + @Override + protected void preprocessContVariable(ContVariable obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessContVariable(obj, arg); + } + } + + @Override + protected void postprocessContVariable(ContVariable obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessContVariable(obj, arg); + } + } + + @Override + protected void preprocessContVariableExpression(ContVariableExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessContVariableExpression(obj, arg); + } + } + + @Override + protected void postprocessContVariableExpression(ContVariableExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessContVariableExpression(obj, arg); + } + } + + @Override + protected void preprocessContinueFuncStatement(ContinueFuncStatement obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessContinueFuncStatement(obj, arg); + } + } + + @Override + protected void postprocessContinueFuncStatement(ContinueFuncStatement obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessContinueFuncStatement(obj, arg); + } + } + + @Override + protected void preprocessDeclaration(Declaration obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessDeclaration(obj, arg); + } + } + + @Override + protected void postprocessDeclaration(Declaration obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessDeclaration(obj, arg); + } + } + + @Override + protected void preprocessDictExpression(DictExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessDictExpression(obj, arg); + } + } + + @Override + protected void postprocessDictExpression(DictExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessDictExpression(obj, arg); + } + } + + @Override + protected void preprocessDictPair(DictPair obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessDictPair(obj, arg); + } + } + + @Override + protected void postprocessDictPair(DictPair obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessDictPair(obj, arg); + } + } + + @Override + protected void preprocessDictType(DictType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessDictType(obj, arg); + } + } + + @Override + protected void postprocessDictType(DictType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessDictType(obj, arg); + } + } + + @Override + protected void preprocessDiscVariable(DiscVariable obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessDiscVariable(obj, arg); + } + } + + @Override + protected void postprocessDiscVariable(DiscVariable obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessDiscVariable(obj, arg); + } + } + + @Override + protected void preprocessDiscVariableExpression(DiscVariableExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessDiscVariableExpression(obj, arg); + } + } + + @Override + protected void postprocessDiscVariableExpression(DiscVariableExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessDiscVariableExpression(obj, arg); + } + } + + @Override + protected void preprocessDistType(DistType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessDistType(obj, arg); + } + } + + @Override + protected void postprocessDistType(DistType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessDistType(obj, arg); + } + } + + @Override + protected void preprocessEdge(Edge obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessEdge(obj, arg); + } + } + + @Override + protected void postprocessEdge(Edge obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessEdge(obj, arg); + } + } + + @Override + protected void preprocessEdgeEvent(EdgeEvent obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessEdgeEvent(obj, arg); + } + } + + @Override + protected void postprocessEdgeEvent(EdgeEvent obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessEdgeEvent(obj, arg); + } + } + + @Override + protected void preprocessEdgeReceive(EdgeReceive obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessEdgeReceive(obj, arg); + } + } + + @Override + protected void postprocessEdgeReceive(EdgeReceive obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessEdgeReceive(obj, arg); + } + } + + @Override + protected void preprocessEdgeSend(EdgeSend obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessEdgeSend(obj, arg); + } + } + + @Override + protected void postprocessEdgeSend(EdgeSend obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessEdgeSend(obj, arg); + } + } + + @Override + protected void preprocessElifExpression(ElifExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessElifExpression(obj, arg); + } + } + + @Override + protected void postprocessElifExpression(ElifExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessElifExpression(obj, arg); + } + } + + @Override + protected void preprocessElifFuncStatement(ElifFuncStatement obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessElifFuncStatement(obj, arg); + } + } + + @Override + protected void postprocessElifFuncStatement(ElifFuncStatement obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessElifFuncStatement(obj, arg); + } + } + + @Override + protected void preprocessElifUpdate(ElifUpdate obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessElifUpdate(obj, arg); + } + } + + @Override + protected void postprocessElifUpdate(ElifUpdate obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessElifUpdate(obj, arg); + } + } + + @Override + protected void preprocessEnumDecl(EnumDecl obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessEnumDecl(obj, arg); + } + } + + @Override + protected void postprocessEnumDecl(EnumDecl obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessEnumDecl(obj, arg); + } + } + + @Override + protected void preprocessEnumLiteral(EnumLiteral obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessEnumLiteral(obj, arg); + } + } + + @Override + protected void postprocessEnumLiteral(EnumLiteral obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessEnumLiteral(obj, arg); + } + } + + @Override + protected void preprocessEnumLiteralExpression(EnumLiteralExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessEnumLiteralExpression(obj, arg); + } + } + + @Override + protected void postprocessEnumLiteralExpression(EnumLiteralExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessEnumLiteralExpression(obj, arg); + } + } + + @Override + protected void preprocessEnumType(EnumType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessEnumType(obj, arg); + } + } + + @Override + protected void postprocessEnumType(EnumType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessEnumType(obj, arg); + } + } + + @Override + protected void preprocessEquation(Equation obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessEquation(obj, arg); + } + } + + @Override + protected void postprocessEquation(Equation obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessEquation(obj, arg); + } + } + + @Override + protected void preprocessEvent(Event obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessEvent(obj, arg); + } + } + + @Override + protected void postprocessEvent(Event obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessEvent(obj, arg); + } + } + + @Override + protected void preprocessEventExpression(EventExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessEventExpression(obj, arg); + } + } + + @Override + protected void postprocessEventExpression(EventExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessEventExpression(obj, arg); + } + } + + @Override + protected void preprocessEventParameter(EventParameter obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessEventParameter(obj, arg); + } + } + + @Override + protected void postprocessEventParameter(EventParameter obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessEventParameter(obj, arg); + } + } + + @Override + protected void preprocessExpression(Expression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessExpression(obj, arg); + } + } + + @Override + protected void postprocessExpression(Expression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessExpression(obj, arg); + } + } + + @Override + protected void preprocessExternalFunction(ExternalFunction obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessExternalFunction(obj, arg); + } + } + + @Override + protected void postprocessExternalFunction(ExternalFunction obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessExternalFunction(obj, arg); + } + } + + @Override + protected void preprocessField(Field obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessField(obj, arg); + } + } + + @Override + protected void postprocessField(Field obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessField(obj, arg); + } + } + + @Override + protected void preprocessFieldExpression(FieldExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessFieldExpression(obj, arg); + } + } + + @Override + protected void postprocessFieldExpression(FieldExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessFieldExpression(obj, arg); + } + } + + @Override + protected void preprocessFuncType(FuncType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessFuncType(obj, arg); + } + } + + @Override + protected void postprocessFuncType(FuncType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessFuncType(obj, arg); + } + } + + @Override + protected void preprocessFunction(Function obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessFunction(obj, arg); + } + } + + @Override + protected void postprocessFunction(Function obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessFunction(obj, arg); + } + } + + @Override + protected void preprocessFunctionCallExpression(FunctionCallExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessFunctionCallExpression(obj, arg); + } + } + + @Override + protected void postprocessFunctionCallExpression(FunctionCallExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessFunctionCallExpression(obj, arg); + } + } + + @Override + protected void preprocessFunctionExpression(FunctionExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessFunctionExpression(obj, arg); + } + } + + @Override + protected void postprocessFunctionExpression(FunctionExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessFunctionExpression(obj, arg); + } + } + + @Override + protected void preprocessFunctionParameter(FunctionParameter obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessFunctionParameter(obj, arg); + } + } + + @Override + protected void postprocessFunctionParameter(FunctionParameter obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessFunctionParameter(obj, arg); + } + } + + @Override + protected void preprocessFunctionStatement(FunctionStatement obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessFunctionStatement(obj, arg); + } + } + + @Override + protected void postprocessFunctionStatement(FunctionStatement obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessFunctionStatement(obj, arg); + } + } + + @Override + protected void preprocessGroup(Group obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessGroup(obj, arg); + } + } + + @Override + protected void postprocessGroup(Group obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessGroup(obj, arg); + } + } + + @Override + protected void preprocessIfExpression(IfExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessIfExpression(obj, arg); + } + } + + @Override + protected void postprocessIfExpression(IfExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessIfExpression(obj, arg); + } + } + + @Override + protected void preprocessIfFuncStatement(IfFuncStatement obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessIfFuncStatement(obj, arg); + } + } + + @Override + protected void postprocessIfFuncStatement(IfFuncStatement obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessIfFuncStatement(obj, arg); + } + } + + @Override + protected void preprocessIfUpdate(IfUpdate obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessIfUpdate(obj, arg); + } + } + + @Override + protected void postprocessIfUpdate(IfUpdate obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessIfUpdate(obj, arg); + } + } + + @Override + protected void preprocessInputVariable(InputVariable obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessInputVariable(obj, arg); + } + } + + @Override + protected void postprocessInputVariable(InputVariable obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessInputVariable(obj, arg); + } + } + + @Override + protected void preprocessInputVariableExpression(InputVariableExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessInputVariableExpression(obj, arg); + } + } + + @Override + protected void postprocessInputVariableExpression(InputVariableExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessInputVariableExpression(obj, arg); + } + } + + @Override + protected void preprocessIntExpression(IntExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessIntExpression(obj, arg); + } + } + + @Override + protected void postprocessIntExpression(IntExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessIntExpression(obj, arg); + } + } + + @Override + protected void preprocessIntType(IntType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessIntType(obj, arg); + } + } + + @Override + protected void postprocessIntType(IntType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessIntType(obj, arg); + } + } + + @Override + protected void preprocessInternalFunction(InternalFunction obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessInternalFunction(obj, arg); + } + } + + @Override + protected void postprocessInternalFunction(InternalFunction obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessInternalFunction(obj, arg); + } + } + + @Override + protected void preprocessInvariant(Invariant obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessInvariant(obj, arg); + } + } + + @Override + protected void postprocessInvariant(Invariant obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessInvariant(obj, arg); + } + } + + @Override + protected void preprocessIoDecl(IoDecl obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessIoDecl(obj, arg); + } + } + + @Override + protected void postprocessIoDecl(IoDecl obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessIoDecl(obj, arg); + } + } + + @Override + protected void preprocessListExpression(ListExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessListExpression(obj, arg); + } + } + + @Override + protected void postprocessListExpression(ListExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessListExpression(obj, arg); + } + } + + @Override + protected void preprocessListType(ListType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessListType(obj, arg); + } + } + + @Override + protected void postprocessListType(ListType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessListType(obj, arg); + } + } + + @Override + protected void preprocessLocation(Location obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessLocation(obj, arg); + } + } + + @Override + protected void postprocessLocation(Location obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessLocation(obj, arg); + } + } + + @Override + protected void preprocessLocationExpression(LocationExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessLocationExpression(obj, arg); + } + } + + @Override + protected void postprocessLocationExpression(LocationExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessLocationExpression(obj, arg); + } + } + + @Override + protected void preprocessLocationParameter(LocationParameter obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessLocationParameter(obj, arg); + } + } + + @Override + protected void postprocessLocationParameter(LocationParameter obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessLocationParameter(obj, arg); + } + } + + @Override + protected void preprocessMonitors(Monitors obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessMonitors(obj, arg); + } + } + + @Override + protected void postprocessMonitors(Monitors obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessMonitors(obj, arg); + } + } + + @Override + protected void preprocessParameter(Parameter obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessParameter(obj, arg); + } + } + + @Override + protected void postprocessParameter(Parameter obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessParameter(obj, arg); + } + } + + @Override + protected void preprocessPosition(Position obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessPosition(obj, arg); + } + } + + @Override + protected void postprocessPosition(Position obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessPosition(obj, arg); + } + } + + @Override + protected void preprocessPositionObject(PositionObject obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessPositionObject(obj, arg); + } + } + + @Override + protected void postprocessPositionObject(PositionObject obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessPositionObject(obj, arg); + } + } + + @Override + protected void preprocessPrint(Print obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessPrint(obj, arg); + } + } + + @Override + protected void postprocessPrint(Print obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessPrint(obj, arg); + } + } + + @Override + protected void preprocessPrintFile(PrintFile obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessPrintFile(obj, arg); + } + } + + @Override + protected void postprocessPrintFile(PrintFile obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessPrintFile(obj, arg); + } + } + + @Override + protected void preprocessPrintFor(PrintFor obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessPrintFor(obj, arg); + } + } + + @Override + protected void postprocessPrintFor(PrintFor obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessPrintFor(obj, arg); + } + } + + @Override + protected void preprocessProjectionExpression(ProjectionExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessProjectionExpression(obj, arg); + } + } + + @Override + protected void postprocessProjectionExpression(ProjectionExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessProjectionExpression(obj, arg); + } + } + + @Override + protected void preprocessRealExpression(RealExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessRealExpression(obj, arg); + } + } + + @Override + protected void postprocessRealExpression(RealExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessRealExpression(obj, arg); + } + } + + @Override + protected void preprocessRealType(RealType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessRealType(obj, arg); + } + } + + @Override + protected void postprocessRealType(RealType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessRealType(obj, arg); + } + } + + @Override + protected void preprocessReceivedExpression(ReceivedExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessReceivedExpression(obj, arg); + } + } + + @Override + protected void postprocessReceivedExpression(ReceivedExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessReceivedExpression(obj, arg); + } + } + + @Override + protected void preprocessReturnFuncStatement(ReturnFuncStatement obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessReturnFuncStatement(obj, arg); + } + } + + @Override + protected void postprocessReturnFuncStatement(ReturnFuncStatement obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessReturnFuncStatement(obj, arg); + } + } + + @Override + protected void preprocessSelfExpression(SelfExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessSelfExpression(obj, arg); + } + } + + @Override + protected void postprocessSelfExpression(SelfExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessSelfExpression(obj, arg); + } + } + + @Override + protected void preprocessSetExpression(SetExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessSetExpression(obj, arg); + } + } + + @Override + protected void postprocessSetExpression(SetExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessSetExpression(obj, arg); + } + } + + @Override + protected void preprocessSetType(SetType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessSetType(obj, arg); + } + } + + @Override + protected void postprocessSetType(SetType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessSetType(obj, arg); + } + } + + @Override + protected void preprocessSliceExpression(SliceExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessSliceExpression(obj, arg); + } + } + + @Override + protected void postprocessSliceExpression(SliceExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessSliceExpression(obj, arg); + } + } + + @Override + protected void preprocessSpecification(Specification obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessSpecification(obj, arg); + } + } + + @Override + protected void postprocessSpecification(Specification obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessSpecification(obj, arg); + } + } + + @Override + protected void preprocessStdLibFunctionExpression(StdLibFunctionExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessStdLibFunctionExpression(obj, arg); + } + } + + @Override + protected void postprocessStdLibFunctionExpression(StdLibFunctionExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessStdLibFunctionExpression(obj, arg); + } + } + + @Override + protected void preprocessStringExpression(StringExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessStringExpression(obj, arg); + } + } + + @Override + protected void postprocessStringExpression(StringExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessStringExpression(obj, arg); + } + } + + @Override + protected void preprocessStringType(StringType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessStringType(obj, arg); + } + } + + @Override + protected void postprocessStringType(StringType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessStringType(obj, arg); + } + } + + @Override + protected void preprocessSvgCopy(SvgCopy obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessSvgCopy(obj, arg); + } + } + + @Override + protected void postprocessSvgCopy(SvgCopy obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessSvgCopy(obj, arg); + } + } + + @Override + protected void preprocessSvgFile(SvgFile obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessSvgFile(obj, arg); + } + } + + @Override + protected void postprocessSvgFile(SvgFile obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessSvgFile(obj, arg); + } + } + + @Override + protected void preprocessSvgIn(SvgIn obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessSvgIn(obj, arg); + } + } + + @Override + protected void postprocessSvgIn(SvgIn obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessSvgIn(obj, arg); + } + } + + @Override + protected void preprocessSvgInEvent(SvgInEvent obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessSvgInEvent(obj, arg); + } + } + + @Override + protected void postprocessSvgInEvent(SvgInEvent obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessSvgInEvent(obj, arg); + } + } + + @Override + protected void preprocessSvgInEventIf(SvgInEventIf obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessSvgInEventIf(obj, arg); + } + } + + @Override + protected void postprocessSvgInEventIf(SvgInEventIf obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessSvgInEventIf(obj, arg); + } + } + + @Override + protected void preprocessSvgInEventIfEntry(SvgInEventIfEntry obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessSvgInEventIfEntry(obj, arg); + } + } + + @Override + protected void postprocessSvgInEventIfEntry(SvgInEventIfEntry obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessSvgInEventIfEntry(obj, arg); + } + } + + @Override + protected void preprocessSvgInEventSingle(SvgInEventSingle obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessSvgInEventSingle(obj, arg); + } + } + + @Override + protected void postprocessSvgInEventSingle(SvgInEventSingle obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessSvgInEventSingle(obj, arg); + } + } + + @Override + protected void preprocessSvgMove(SvgMove obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessSvgMove(obj, arg); + } + } + + @Override + protected void postprocessSvgMove(SvgMove obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessSvgMove(obj, arg); + } + } + + @Override + protected void preprocessSvgOut(SvgOut obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessSvgOut(obj, arg); + } + } + + @Override + protected void postprocessSvgOut(SvgOut obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessSvgOut(obj, arg); + } + } + + @Override + protected void preprocessSwitchCase(SwitchCase obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessSwitchCase(obj, arg); + } + } + + @Override + protected void postprocessSwitchCase(SwitchCase obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessSwitchCase(obj, arg); + } + } + + @Override + protected void preprocessSwitchExpression(SwitchExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessSwitchExpression(obj, arg); + } + } + + @Override + protected void postprocessSwitchExpression(SwitchExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessSwitchExpression(obj, arg); + } + } + + @Override + protected void preprocessTauExpression(TauExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessTauExpression(obj, arg); + } + } + + @Override + protected void postprocessTauExpression(TauExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessTauExpression(obj, arg); + } + } + + @Override + protected void preprocessTimeExpression(TimeExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessTimeExpression(obj, arg); + } + } + + @Override + protected void postprocessTimeExpression(TimeExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessTimeExpression(obj, arg); + } + } + + @Override + protected void preprocessTupleExpression(TupleExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessTupleExpression(obj, arg); + } + } + + @Override + protected void postprocessTupleExpression(TupleExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessTupleExpression(obj, arg); + } + } + + @Override + protected void preprocessTupleType(TupleType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessTupleType(obj, arg); + } + } + + @Override + protected void postprocessTupleType(TupleType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessTupleType(obj, arg); + } + } + + @Override + protected void preprocessTypeDecl(TypeDecl obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessTypeDecl(obj, arg); + } + } + + @Override + protected void postprocessTypeDecl(TypeDecl obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessTypeDecl(obj, arg); + } + } + + @Override + protected void preprocessTypeRef(TypeRef obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessTypeRef(obj, arg); + } + } + + @Override + protected void postprocessTypeRef(TypeRef obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessTypeRef(obj, arg); + } + } + + @Override + protected void preprocessUnaryExpression(UnaryExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessUnaryExpression(obj, arg); + } + } + + @Override + protected void postprocessUnaryExpression(UnaryExpression obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessUnaryExpression(obj, arg); + } + } + + @Override + protected void preprocessUpdate(Update obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessUpdate(obj, arg); + } + } + + @Override + protected void postprocessUpdate(Update obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessUpdate(obj, arg); + } + } + + @Override + protected void preprocessVariableValue(VariableValue obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessVariableValue(obj, arg); + } + } + + @Override + protected void postprocessVariableValue(VariableValue obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessVariableValue(obj, arg); + } + } + + @Override + protected void preprocessVoidType(VoidType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessVoidType(obj, arg); + } + } + + @Override + protected void postprocessVoidType(VoidType obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessVoidType(obj, arg); + } + } + + @Override + protected void preprocessWhileFuncStatement(WhileFuncStatement obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.preprocessWhileFuncStatement(obj, arg); + } + } + + @Override + protected void postprocessWhileFuncStatement(WhileFuncStatement obj, T arg) { + for (CifWithArgWalker walker: walkers) { + walker.postprocessWhileFuncStatement(obj, arg); + } + } +} diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif index be34dd5801be1b3040b75543f986e674e618c6bd..f06ff01810eebecdcfd7e5ead72e715436cbd4af 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif @@ -15,7 +15,7 @@ group g: event e1; // Not (un)controllable. controllable int[0..5] e2; // Event with data type. - automaton a: // Automaton with 'automaton' kind. + automaton a: // Kindless automaton. location: initial; edge e1, e2, tau; // Explicit 'tau'. @@ -29,8 +29,8 @@ group g: end plant p0: // Automaton without initial location. - disc int[1..2] x1 in {1,2}; // Non-deterministic variable init. - disc int[1..2] x2 in any; // Non-deterministic variable init. + disc int[1..2] x1 in {1,2}; // Multiple potential initial values. + disc int[1..2] x2 in any; // Multiple potential initial values. cont cnt der 1.0; // Continuous variable, real type/value. input bool inp; // Input variable. disc list bool lb = [true]; // List type/expr. @@ -56,7 +56,7 @@ group g: initial sqrt(-1.0) > 0; // Eval/idx fail, real expr/type, -/>/sqrt. marked sqrt(-2.0) > 0; // Eval/idx fail, real expr/type, -/>/sqrt. - plant invariant 7 = 7; // Invariant in location (regardless kind). + plant invariant 7 = 7; // Invariant in location (regardless of kind). end plant p2: // Automaton with two initial locations. diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err index 9df182c021f193b6ad3474201216e62dedb22037..764cb6f2599f4933803b869f391cf8ed84fdd9e4 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err @@ -1,77 +1,59 @@ WARNING: File "cif2supremica/invalid1.cif": Semantic warning at line 31, column 9: Automaton "g.p0" has no initial location. ERROR: CIF to Supremica transformation failed due to unsatisfied preconditions: - - Failed to evaluate initialization predicate(s): sqrt(-1.0) > 0. - - Failed to evaluate marker predicate(s): sqrt(-1.0) > 0. - - Unsupported automaton "g.a": kindless/regular automata are currently not supported. - - Unsupported automaton "g.p0": automata without an initial location are currently not supported. - - Unsupported automaton "g.p2": automata with multiple (2) initial locations are currently not supported. - - Unsupported declaration "g.p0.cnt": continuous variables are currently unsupported. - - Unsupported declaration "g.p0.inp": input variables are currently unsupported. - - Unsupported declaration "g.p0.lb": discrete variables with multiple marker predicates are currently not supported. - - Unsupported declaration "g.p0.x1": discrete variables with multiple marker predicates are currently not supported. - - Unsupported declaration "g.p0.x1": discrete variables with multiple potential initial values are currently not supported. - - Unsupported declaration "g.p0.x2": discrete variables with multiple potential initial values are currently not supported. - - Unsupported event "g.e1": event is not declared as controllable or uncontrollable. - - Unsupported event "g.e2": event is a channel (has a data type). - - Unsupported event "tau": event is not controllable or uncontrollable (explicit use of "tau"). - - Unsupported event "tau": event is not controllable or uncontrollable (implicit use of "tau"). - - Unsupported expression "(1, 2)": tuple expressions are currently not supported. - - Unsupported expression "(g.p0.x1, g.p0.x2)": tuple expressions are currently not supported. - - Unsupported expression "-1.0": unary operator "-" is currently not supported, or is not supported for the operand that is used. - - Unsupported expression "-2.0": unary operator "-" is currently not supported, or is not supported for the operand that is used. - - Unsupported expression "1.0": real number expressions are currently not supported. - - Unsupported expression "1.0": real number expressions are currently not supported. - - Unsupported expression "1.2": real number expressions are currently not supported. - - Unsupported expression "2.0": real number expressions are currently not supported. - - Unsupported expression "[false, true]": list expressions are currently not supported. - - Unsupported expression "[false]": list expressions are currently not supported. - - Unsupported expression "[true]": list expressions are currently not supported. - - Unsupported expression "[true]": list expressions are currently not supported. - - Unsupported expression "g.p0.lb[0]": projection expressions are currently not supported. - - Unsupported expression "sqrt(-1.0) > 0": binary operator ">" is currently not supported, or is not supported for the operands that are used. - - Unsupported expression "sqrt(-1.0)": function calls are currently not supported. - - Unsupported expression "sqrt(-2.0) > 0": binary operator ">" is currently not supported, or is not supported for the operands that are used. - - Unsupported expression "sqrt(-2.0)": function calls are currently not supported. - - Unsupported function "g.f": user-defined functions are currently unsupported. - - Unsupported group "g": initialization predicates are currently only supported in locations. - - Unsupported group "g": unsupported kindless state invariant "8 = 8". - - Unsupported group "g": unsupported kindless state/event exclusion invariant "g.e1 needs g.p0.x1 > 0". - - Unsupported group "g": unsupported kindless state/event exclusion invariant "g.p0.x1 > 0 disables g.e1". - - Unsupported group "g": unsupported marker predicate "1 > 2". - - Unsupported group "g": unsupported marker predicate "2 = 2". - - Unsupported group "g": unsupported marker predicate "g.p0.cnt = 1.2". - - Unsupported group "g": unsupported marker predicate "not false". - - Unsupported group "g": unsupported plant state invariant "9 = 9". - - Unsupported group "g": unsupported supervisor state invariant "10 = 10". - - Unsupported location of automaton "g.p0": edges with 'if' updates are currently unsupported. - - Unsupported location of automaton "g.p0": edges with multi-assignments are currently unsupported. - - Unsupported location of automaton "g.p0": edges with partial variable assignments are currently unsupported. - - Unsupported location of automaton "g.p0": urgent locations are currently unsupported. - - Unsupported location of automaton "g.p1": state invariants in locations are currently unsupported. - - Unsupported location of automaton "g.snd": urgent edges are currently unsupported. - - Unsupported type "func real(real)": function types are currently not supported. - - Unsupported type "func real(real)": function types are currently not supported. - - Unsupported type "list bool": list types are currently not supported. - - Unsupported type "list bool": list types are currently not supported. - - Unsupported type "list bool": list types are currently not supported. - - Unsupported type "list bool": list types are currently not supported. - - Unsupported type "list bool": list types are currently not supported. - - Unsupported type "list[1] bool": list types are currently not supported. - - Unsupported type "list[1] bool": list types are currently not supported. - - Unsupported type "list[1] bool": list types are currently not supported. - - Unsupported type "list[2] bool": list types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "tuple(int[1..1]; int[2..2])": tuple types are currently not supported. - - Unsupported type "tuple(int[1..2]; int[1..2])": tuple types are currently not supported. + - Unsupported "g": component contains an initialization predicate. + - Unsupported "g": component has a kindless state invariant. + - Unsupported "g": component has a kindless state/event exclusion invariant, lacking a supervisory kind. + - Unsupported "g": component has a marker predicate that is not of the form "discrete_variable = marked_value". + - Unsupported "g": component has a plant state invariant. + - Unsupported "g": component has a supervisor state invariant. + - Unsupported "g": uses list literal "[false, true]". + - Unsupported "g": uses list literal "[false]". + - Unsupported "g": uses list literal "[true]". + - Unsupported "g": uses list type "list bool". + - Unsupported "g": uses list type "list[1] bool". + - Unsupported "g": uses list type "list[2] bool". + - Unsupported "g": uses real number literal "1.2". + - Unsupported "g": uses real type "real". + - Unsupported "g.a": automaton has an edge with explicitly event "tau" on it, which is not controllable or uncontrollable. + - Unsupported "g.a": automaton has an edge with implicitly event "tau" on it, which is not controllable or uncontrollable. + - Unsupported "g.a": automaton is a kindless automaton, lacking a supervisory kind. + - Unsupported "g.e1": event is not declared as controllable or uncontrollable. + - Unsupported "g.e2": event is a channel (has a data type). + - Unsupported "g.f": function is a user-defined function. + - Unsupported "g.p0": automaton has an edge with a multi-assignment. + - Unsupported "g.p0": automaton has an edge with a partial variable assignment. + - Unsupported "g.p0": automaton has an edge with an 'if' update. + - Unsupported "g.p0": automaton has an urgent location. + - Unsupported "g.p0": automaton has no initial location. + - Unsupported "g.p0": uses list type "list bool". + - Unsupported "g.p0": uses projection expression "g.p0.lb[0]". + - Unsupported "g.p0": uses tuple literal "(1, 2)". + - Unsupported "g.p0": uses tuple literal "(g.p0.x1, g.p0.x2)". + - Unsupported "g.p0": uses tuple type "tuple(int[1..1]; int[2..2])". + - Unsupported "g.p0": uses tuple type "tuple(int[1..2]; int[1..2])". + - Unsupported "g.p0.cnt": uses real number literal "1.0". + - Unsupported "g.p0.cnt": uses real type "real". + - Unsupported "g.p0.cnt": variable is a continuous variable. + - Unsupported "g.p0.inp": variable is an input variable. + - Unsupported "g.p0.lb": discrete variable has multiple predicates to specify its marked values. + - Unsupported "g.p0.lb": uses list literal "[true]". + - Unsupported "g.p0.lb": uses list type "list bool". + - Unsupported "g.p0.lb": uses list type "list[1] bool". + - Unsupported "g.p0.x1": discrete variable has multiple (2) potential initial values. + - Unsupported "g.p0.x1": discrete variable has multiple predicates to specify its marked values. + - Unsupported "g.p0.x2": discrete variable has multiple potential initial values (any value in its domain). + - Unsupported "g.p1": automaton has a location with a state invariant. + - Unsupported "g.p1": failed to determine whether the automaton's location is an initial location, as evaluating one of its initialization predicates resulted in an evaluation error. + - Unsupported "g.p1": static evaluation of a marker predicate in the location of the automaton resulted in an evaluation error. + - Unsupported "g.p1": uses binary operator ">" on operands of types "real" and "int[0..0]" in binary expression "sqrt(-1.0) > 0". + - Unsupported "g.p1": uses binary operator ">" on operands of types "real" and "int[0..0]" in binary expression "sqrt(-2.0) > 0". + - Unsupported "g.p1": uses function call "sqrt(-1.0)". + - Unsupported "g.p1": uses function call "sqrt(-2.0)". + - Unsupported "g.p1": uses function type "func real(real)". + - Unsupported "g.p1": uses real number literal "1.0". + - Unsupported "g.p1": uses real number literal "2.0". + - Unsupported "g.p1": uses real type "real". + - Unsupported "g.p1": uses unary operator "-" on an operand of type "real" in unary expression "-1.0". + - Unsupported "g.p1": uses unary operator "-" on an operand of type "real" in unary expression "-2.0". + - Unsupported "g.p2": automata has multiple (2) initial locations. + - Unsupported "g.snd": automaton has an urgent edge. diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid2.cif b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid2.cif index 43dcb9ae5a174c4c6547b97db049c430e384658f..6d37e0f8fd8f5dbc91758c435f0f5bf376cbdb49 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid2.cif +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid2.cif @@ -51,7 +51,7 @@ plant p: edge u do b := i >= i; // Rangeless int type and '>='. edge u do b := true in sb; // Set type, 'in' on set. edge u do b := sb sub sb; // Set type, 'sub' on set. - edge u do (b, db) := sample db; // Dict type/sample, multi-asgn. + edge u do (b, db) := sample db; // Dist type/sample, multi-asgn, tuple type. edge u do i := +i; // Rangeless int type and '+'. edge u do i := -i; // Rangeless int type and '-'. edge u do str := "a"; // String type/expr. diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid2.cif.cif2supremica.err b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid2.cif.cif2supremica.err index 82604a3b54755f439fb54103afac23c5c6d1da9d..3f75bc28ac1d0a5457d858305903f7eb0c7ce450 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid2.cif.cif2supremica.err +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid2.cif.cif2supremica.err @@ -1,138 +1,64 @@ ERROR: CIF to Supremica transformation failed due to unsatisfied preconditions: - - Unsupported expression ""a"": string literal expressions are currently not supported. - - Unsupported expression ""a"": string literal expressions are currently not supported. - - Unsupported expression "(p.b, p.db)": tuple expressions are currently not supported. - - Unsupported expression "(true, false)": tuple expressions are currently not supported. - - Unsupported expression "+p.i": unary operator "+" is currently not supported, or is not supported for the operand that is used. - - Unsupported expression "-p.i": unary operator "-" is currently not supported, or is not supported for the operand that is used. - - Unsupported expression "1.0": real number expressions are currently not supported. - - Unsupported expression "1.2": real number expressions are currently not supported. - - Unsupported expression "1": cast expressions are currently not supported. - - Unsupported expression "[true]": list expressions are currently not supported. - - Unsupported expression "constant(true)": function calls are currently not supported. - - Unsupported expression "if true: 1 else 2 end": 'if' expressions are currently not supported. - - Unsupported expression "p.i < p.i": binary operator "<" is currently not supported, or is not supported for the operands that are used. - - Unsupported expression "p.i <= p.i": binary operator "<=" is currently not supported, or is not supported for the operands that are used. - - Unsupported expression "p.i > p.i": binary operator ">" is currently not supported, or is not supported for the operands that are used. - - Unsupported expression "p.i >= p.i": binary operator ">=" is currently not supported, or is not supported for the operands that are used. - - Unsupported expression "p.i div p.i": binary operator "div" is currently not supported, or is not supported for the operands that are used. - - Unsupported expression "p.i mod p.i": binary operator "mod" is currently not supported, or is not supported for the operands that are used. - - Unsupported expression "p.lb[:]": slice expressions are currently not supported. - - Unsupported expression "p.r * p.r": binary operator "*" is currently not supported, or is not supported for the operands that are used. - - Unsupported expression "p.r + p.r": binary operator "+" is currently not supported, or is not supported for the operands that are used. - - Unsupported expression "p.r - p.r": binary operator "-" is currently not supported, or is not supported for the operands that are used. - - Unsupported expression "p.r / p.r": binary operator "/" is currently not supported, or is not supported for the operands that are used. - - Unsupported expression "p.sb sub p.sb": binary operator "sub" is currently not supported, or is not supported for the operands that are used. - - Unsupported expression "p.tbb[a]": projection expressions are currently not supported. - - Unsupported expression "sample p.db": unary operator "sample" is currently not supported, or is not supported for the operand that is used. - - Unsupported expression "switch 1: else 2 end": 'switch' expressions are currently not supported. - - Unsupported expression "switch p: case l: 3 end": 'switch' expressions are currently not supported. - - Unsupported expression "time": the use of variable "time" is currently not supported. - - Unsupported expression "true in p.sb": binary operator "in" is currently not supported, or is not supported for the operands that are used. - - Unsupported expression "{false}": set expressions are currently not supported. - - Unsupported expression "{false}": set expressions are currently not supported. - - Unsupported expression "{true: false}": dictionary expressions are currently not supported. - - Unsupported expression "{true: true}": dictionary expressions are currently not supported. - - Unsupported expression "{true} and {false}": binary operator "and" is currently not supported, or is not supported for the operands that are used. - - Unsupported expression "{true} or {false}": binary operator "or" is currently not supported, or is not supported for the operands that are used. - - Unsupported expression "{true}": set expressions are currently not supported. - - Unsupported expression "{true}": set expressions are currently not supported. - - Unsupported expression "{true}": set expressions are currently not supported. - - Unsupported function "f": user-defined functions are currently unsupported. - - Unsupported location "l" of automaton "p": edges with multi-assignments are currently unsupported. - - Unsupported location "l" of automaton "p": edges with partial variable assignments are currently unsupported. - - Unsupported location "l" of automaton "p": state invariants in locations are currently unsupported. - - Unsupported type "dict(bool:bool)": dictionary types are currently not supported. - - Unsupported type "dict(bool:bool)": dictionary types are currently not supported. - - Unsupported type "dict(bool:bool)": dictionary types are currently not supported. - - Unsupported type "dict(bool:bool)": dictionary types are currently not supported. - - Unsupported type "dist bool": distribution types are currently not supported. - - Unsupported type "dist bool": distribution types are currently not supported. - - Unsupported type "dist bool": distribution types are currently not supported. - - Unsupported type "dist bool": distribution types are currently not supported. - - Unsupported type "dist bool": distribution types are currently not supported. - - Unsupported type "dist bool": distribution types are currently not supported. - - Unsupported type "dist bool": distribution types are currently not supported. - - Unsupported type "func bool(bool)": function types are currently not supported. - - Unsupported type "func bool(bool)": function types are currently not supported. - - Unsupported type "func bool(bool)": function types are currently not supported. - - Unsupported type "func bool(bool)": function types are currently not supported. - - Unsupported type "func dist bool(bool)": function types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "int": rangeless integer types are currently not supported. - - Unsupported type "list bool": list types are currently not supported. - - Unsupported type "list bool": list types are currently not supported. - - Unsupported type "list bool": list types are currently not supported. - - Unsupported type "list bool": list types are currently not supported. - - Unsupported type "list[1] bool": list types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "real": real types are currently not supported. - - Unsupported type "set bool": set types are currently not supported. - - Unsupported type "set bool": set types are currently not supported. - - Unsupported type "set bool": set types are currently not supported. - - Unsupported type "set bool": set types are currently not supported. - - Unsupported type "set bool": set types are currently not supported. - - Unsupported type "set bool": set types are currently not supported. - - Unsupported type "set bool": set types are currently not supported. - - Unsupported type "set bool": set types are currently not supported. - - Unsupported type "set bool": set types are currently not supported. - - Unsupported type "set bool": set types are currently not supported. - - Unsupported type "set bool": set types are currently not supported. - - Unsupported type "set bool": set types are currently not supported. - - Unsupported type "set bool": set types are currently not supported. - - Unsupported type "string": string types are currently not supported. - - Unsupported type "string": string types are currently not supported. - - Unsupported type "string": string types are currently not supported. - - Unsupported type "string": string types are currently not supported. - - Unsupported type "tuple(bool a; bool b)": tuple types are currently not supported. - - Unsupported type "tuple(bool a; bool b)": tuple types are currently not supported. - - Unsupported type "tuple(bool; bool)": tuple types are currently not supported. - - Unsupported type "tuple(bool; dist bool)": tuple types are currently not supported. - - Unsupported type "tuple(bool; dist bool)": tuple types are currently not supported. + - Unsupported "f": function is a user-defined function. + - Unsupported "p.db": uses distribution type "dist bool". + - Unsupported "p.db": uses function call "constant(true)". + - Unsupported "p.db": uses function type "func dist bool(bool)". + - Unsupported "p.dbb": uses dictionary literal "{true: false}". + - Unsupported "p.dbb": uses dictionary type "dict(bool:bool)". + - Unsupported "p.fbb": uses function type "func bool(bool)". + - Unsupported "p.i": uses rangeless integer type "int". + - Unsupported "p.l": location has a state invariant. + - Unsupported "p.l": location has an edge with a multi-assignment. + - Unsupported "p.l": location has an edge with a partial variable assignment. + - Unsupported "p.l": uses binary operator "*" on operands of types "real" and "real" in binary expression "p.r * p.r". + - Unsupported "p.l": uses binary operator "+" on operands of types "real" and "real" in binary expression "p.r + p.r". + - Unsupported "p.l": uses binary operator "-" on operands of types "real" and "real" in binary expression "p.r - p.r". + - Unsupported "p.l": uses binary operator "/" in binary expression "p.r / p.r". + - Unsupported "p.l": uses binary operator "<" on operands of types "int" and "int" in binary expression "p.i < p.i". + - Unsupported "p.l": uses binary operator "<=" on operands of types "int" and "int" in binary expression "p.i <= p.i". + - Unsupported "p.l": uses binary operator ">" on operands of types "int" and "int" in binary expression "p.i > p.i". + - Unsupported "p.l": uses binary operator ">=" on operands of types "int" and "int" in binary expression "p.i >= p.i". + - Unsupported "p.l": uses binary operator "and" on operands of types "set bool" and "set bool" in binary expression "{true} and {false}". + - Unsupported "p.l": uses binary operator "div" on operands of types "int" and "int" in binary expression "p.i div p.i". + - Unsupported "p.l": uses binary operator "in" in binary expression "true in p.sb". + - Unsupported "p.l": uses binary operator "mod" on operands of types "int" and "int" in binary expression "p.i mod p.i". + - Unsupported "p.l": uses binary operator "or" on operands of types "set bool" and "set bool" in binary expression "{true} or {false}". + - Unsupported "p.l": uses binary operator "sub" in binary expression "p.sb sub p.sb". + - Unsupported "p.l": uses conditional expression "if true: 1 else 2 end". + - Unsupported "p.l": uses dictionary literal "{true: true}". + - Unsupported "p.l": uses dictionary type "dict(bool:bool)". + - Unsupported "p.l": uses distribution type "dist bool". + - Unsupported "p.l": uses function type "func bool(bool)". + - Unsupported "p.l": uses list type "list bool". + - Unsupported "p.l": uses projection expression "p.tbb[a]". + - Unsupported "p.l": uses rangeless integer type "int". + - Unsupported "p.l": uses real number literal "1.0". + - Unsupported "p.l": uses real type "real". + - Unsupported "p.l": uses set literal "{false}". + - Unsupported "p.l": uses set literal "{true}". + - Unsupported "p.l": uses set type "set bool". + - Unsupported "p.l": uses slice expression "p.lb[:]". + - Unsupported "p.l": uses string literal ""a"". + - Unsupported "p.l": uses string type "string". + - Unsupported "p.l": uses switch expression "switch 1: else 2 end". + - Unsupported "p.l": uses switch expression "switch p: case l: 3 end". + - Unsupported "p.l": uses time variable reference "time". + - Unsupported "p.l": uses tuple literal "(p.b, p.db)". + - Unsupported "p.l": uses tuple type "tuple(bool a; bool b)". + - Unsupported "p.l": uses tuple type "tuple(bool; dist bool)". + - Unsupported "p.l": uses type-changing cast expression "1". + - Unsupported "p.l": uses unary operator "+" on an operand of type "int" in unary expression "+p.i". + - Unsupported "p.l": uses unary operator "-" on an operand of type "int" in unary expression "-p.i". + - Unsupported "p.l": uses unary operator "sample" in unary expression "sample p.db". + - Unsupported "p.lb": uses list literal "[true]". + - Unsupported "p.lb": uses list type "list bool". + - Unsupported "p.lb": uses list type "list[1] bool". + - Unsupported "p.r": uses real number literal "1.2". + - Unsupported "p.r": uses real type "real". + - Unsupported "p.sb": uses set literal "{true}". + - Unsupported "p.sb": uses set type "set bool". + - Unsupported "p.str": uses string literal ""a"". + - Unsupported "p.str": uses string type "string". + - Unsupported "p.tbb": uses tuple literal "(true, false)". + - Unsupported "p.tbb": uses tuple type "tuple(bool a; bool b)". + - Unsupported "p.tbb": uses tuple type "tuple(bool; bool)". diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid3.cif b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid3.cif index 184f9b83de0b8156e6926d73370749a7baa3dffe..f47f45b5500876d94f50941659a05d3b658c8d2b 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid3.cif +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid3.cif @@ -12,7 +12,7 @@ ////////////////////////////////////////////////////////////////////////////// plant p: - disc bool b in any; + disc bool b in any; // Multiple potential initial values. location: initial b; // Non-static eval. diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid3.cif.cif2supremica.err b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid3.cif.cif2supremica.err index 8b289c213d7a22df45dc924ba103bc54ed1573f4..861b059d3ff593e79cf029b190f91a7f1746942a 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid3.cif.cif2supremica.err +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid3.cif.cif2supremica.err @@ -1 +1,3 @@ -ERROR: Predicate "p.b" can not statically be evaluated to a single value. +ERROR: CIF to Supremica transformation failed due to unsatisfied preconditions: + - Unsupported "p": failed to determine whether the automaton's location is an initial location, as one of its initialization predicates can not be statically evaluated. + - Unsupported "p.b": discrete variable has multiple potential initial values (any value in its domain). diff --git a/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/EmfCodeGenerator.java b/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/EmfCodeGenerator.java index 665bf79eb2683bad4d65416c52ec559c3800c264..28032beb3fb9dd22720d2798e87c725a50c7f6c3 100644 --- a/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/EmfCodeGenerator.java +++ b/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/EmfCodeGenerator.java @@ -47,7 +47,7 @@ public abstract class EmfCodeGenerator { * Loads an {@link EPackage} via reflection. * * @param pkgClassName The full name of the {@link EPackage} Java class. For instance, {@code - * "bla.somelang.v1x0x0.metamodel.somelang.SomeLangPackage"}. + * "bla.somelang.metamodel.somelang.SomeLangPackage"}. * @param path The path to add to the Java class path to allow the main package Java class to be found. For * instance, {@code "bin"}. It is allowed to add multiple paths. For instance, {@code "bin|../bin"}. * @return The loaded {@link EPackage}. diff --git a/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/java/EmfConstructorsGenerator.java b/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/java/EmfConstructorsGenerator.java index 32ae28960adcde70b2f1e90413506d4fcc0d8b51..edd9a2b335031d40183ba29c168f9d3c465faf7f 100644 --- a/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/java/EmfConstructorsGenerator.java +++ b/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/java/EmfConstructorsGenerator.java @@ -45,12 +45,12 @@ public class EmfConstructorsGenerator extends EmfJavaCodeGenerator { * @param args Application arguments: *
    *
  • The full name of the main {@link EPackage} Java class. For instance, {@code - * "bla.somelang.v1x0x0.metamodel.somelang.SomeLangPackage"}.
  • + * "bla.somelang.metamodel.somelang.SomeLangPackage"}. *
  • The path to add to the Java class path to allow the main package Java class to be found. For instance, * {@code "bin"}. It is allowed to add multiple paths. For instance, {@code "bin|../bin"}.
  • - *
  • The output file name path. For instance, {@code "src/bla/somelang/v1x0x0/metamodel/java"}.
  • + *
  • The output directory path. For instance, {@code "src/bla/somelang/metamodel/java"}.
  • *
  • The output class name. For instance, {@code "SomeLangConstructors"}.
  • - *
  • The output package name. For instance, {@code "bla.somelang.v1x0x0.metamodel.java"}.
  • + *
  • The output package name. For instance, {@code "bla.somelang.metamodel.java"}.
  • *
* @throws IOException In case the code could not be written to a file; or in case the java class path extension * path is invalid. @@ -80,7 +80,7 @@ public class EmfConstructorsGenerator extends EmfJavaCodeGenerator { box.writeToFile(outputFilePath); // We are done. - System.out.print("Code written to: " + outputFilePath); + System.out.printf("Code written to: %s%n", outputFilePath); } /** diff --git a/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/java/ModelWalkerGenerator.java b/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/java/ModelWalkerGenerator.java index a8f01828708e5c22c4f385db0c8c6bda93e825b7..4724c5b6cde089adc2b8043efa411dd0f46a14da 100644 --- a/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/java/ModelWalkerGenerator.java +++ b/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/java/ModelWalkerGenerator.java @@ -39,6 +39,18 @@ import org.eclipse.escet.common.java.JavaCodeUtils; * Java model walker class generator for Ecore models. * *

+ * Generates: + *

    + *
  • Model walkers that walks over the model, providing various methods to override and operate on the model.
  • + *
  • Composite model walkers. They support combining multiple model walkers. This allows one to separate a large model + * walker into separate smaller, simpler, easier-to-maintain model walkers and combining them to functionally obtain + * back the original larger model walker.
  • + *
  • Model walkers and composite model walkers where the methods have an extra argument of some specified type, + * allowing to pass along some object while walking over the models.
  • + *
+ *

+ * + *

* The following Ecore features are currently not supported, and may lead to invalid code: *

    *
  • Multiple inheritance.
  • @@ -49,20 +61,23 @@ import org.eclipse.escet.common.java.JavaCodeUtils; */ public class ModelWalkerGenerator extends EmfJavaCodeGenerator { /** - * Generate model walker class code for an {@link EPackage}, including all its sub-packages (recursively). Note that - * structural features that have types outside of the supplied package result in the exploration of additional - * packages. + * Generate a model walker and composite model walker for an {@link EPackage}, including all its sub-packages + * (recursively). Note that structural features that have types outside of the supplied package result in the + * exploration of additional packages. * * @param args Application arguments: *
      *
    • The full name of the main {@link EPackage} Java class. For instance, {@code - * "bla.somelang.v1x0x0.metamodel.somelang.SomeLangPackage"}.
    • + * "bla.somelang.metamodel.somelang.SomeLangPackage"}. *
    • The path to add to the Java class path to allow the main package Java class to be found. For instance, * {@code "bin"}. It is allowed to add multiple paths. For instance, {@code "bin|../bin"}.
    • - *
    • The output file name path. For instance, {@code "src/bla/somelang/v1x0x0/metamodel/java"}.
    • - *
    • The output class name. For instance, {@code "SomeLangWalker"}.
    • - *
    • The output package name. For instance, {@code "bla.somelang.v1x0x0.metamodel.java"}.
    • - *
    • The name of the {@link EClass} that is the root of all instances of the metamodel.
    • + *
    • The output directory path. For instance, {@code "src/bla/somelang/metamodel/java"}.
    • + *
    • The model walker output class name. For instance, {@code "SomeLangWalker"}.
    • + *
    • The composite model walker output class name. For instance, {@code "CompositeSomeLangWalker"}.
    • + *
    • The extra-argument model walker output class name. For instance, {@code "SomeLangWithArgWalker"}.
    • + *
    • The extra-argument composite model walker output class name. For instance, + * {@code "CompositeSomeLangWithArgWalker"}.
    • + *
    • The output package name. For instance, {@code "bla.somelang.metamodel.java"}.
    • *
    * @throws IOException In case the code could not be written to a file; or in case the java class path extension * path is invalid. @@ -74,42 +89,68 @@ public class ModelWalkerGenerator extends EmfJavaCodeGenerator { throws IOException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException { // Process arguments. - Assert.check(args.length == 6); + Assert.check(args.length == 8, args.length); String mainPkgClassName = args[0]; String binPath = args[1]; String outputPath = args[2]; - String outputClassName = args[3]; - String outputPackageName = args[4]; - String rootClassName = args[5]; + String outputClassNameWalker = args[3]; + String outputClassNameComposite = args[4]; + String outputClassNameWalkerWithArg = args[5]; + String outputClassNameCompositeWithArg = args[6]; + String outputPackageName = args[7]; // Resolve the package. EPackage mainPkg = loadEPackage(mainPkgClassName, binPath); // Generate code for the package. - CodeBox box = generate(mainPkg, rootClassName, outputClassName, outputPackageName); + CodeBox boxWalker = generateClass(false, mainPkg, outputClassNameWalker, outputClassNameComposite, + outputPackageName, false); + CodeBox boxComposite = generateClass(true, mainPkg, outputClassNameWalker, outputClassNameComposite, + outputPackageName, false); + CodeBox boxWalkerWithArg = generateClass(false, mainPkg, outputClassNameWalkerWithArg, + outputClassNameCompositeWithArg, outputPackageName, true); + CodeBox boxCompositeWithArg = generateClass(true, mainPkg, outputClassNameWalkerWithArg, + outputClassNameCompositeWithArg, outputPackageName, true); // Try to write the code to a file. - String outputFilePath = new File(new File(outputPath), outputClassName + ".java").getAbsolutePath(); - box.writeToFile(outputFilePath); + String outputFilePathWalker = new File(new File(outputPath), outputClassNameWalker + ".java").getAbsolutePath(); + String outputFilePathComposite = new File(new File(outputPath), outputClassNameComposite + ".java") + .getAbsolutePath(); + String outputFilePathWalkerWithArg = new File(new File(outputPath), outputClassNameWalkerWithArg + ".java") + .getAbsolutePath(); + String outputFilePathCompositeWithArg = new File(new File(outputPath), + outputClassNameCompositeWithArg + ".java").getAbsolutePath(); + boxWalker.writeToFile(outputFilePathWalker); + boxComposite.writeToFile(outputFilePathComposite); + boxWalkerWithArg.writeToFile(outputFilePathWalkerWithArg); + boxCompositeWithArg.writeToFile(outputFilePathCompositeWithArg); // We are done. - System.out.print("Code written to: " + outputFilePath); + System.out.printf("Walker code written to: %s%n", outputFilePathWalker); + System.out.printf("Composite walker code written to: %s%n", outputFilePathComposite); + System.out.printf("Extra-argument walker code written to: %s%n", outputFilePathWalkerWithArg); + System.out.printf("Extra-argument composite walker code written to: %s%n", outputFilePathCompositeWithArg); } /** - * Generate model walker class code for an {@link EPackage}. + * Generate (composite) model walker class code for an {@link EPackage}. * + * @param genComposite Whether to generate a composite model walker ({@code true}) or a model walker + * ({@code false}). * @param startPackage The {@link EPackage} to generate the code for. - * @param rootClassName The name of the {@link EClass} that is the root of all instances of the metamodel. - * @param genClassName The name of the Java class to generate. + * @param genClassNameWalker The name of the model walker Java class to generate. + * @param genClassNameComposite The name of the composite model walker Java class to generate. * @param genPackageName The name of the package that the generated Java class will be a part of. + * @param withArg Whether to generate an extra-argument walker ({@code true}) or a regular walker ({@code false}). * @return The generated code. */ - private static CodeBox generate(EPackage startPackage, String rootClassName, String genClassName, - String genPackageName) + private static CodeBox generateClass(boolean genComposite, EPackage startPackage, String genClassNameWalker, + String genClassNameComposite, String genPackageName, boolean withArg) { + // Initialize the code. CodeBox box = new MemoryCodeBox(); + // Collect the classes and packages to consider. List packages = list(startPackage); List classes; while (true) { @@ -148,6 +189,7 @@ public class ModelWalkerGenerator extends EmfJavaCodeGenerator { } } + // Add the file header. box.add("//////////////////////////////////////////////////////////////////////////////"); box.add("// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation"); box.add("//"); @@ -169,13 +211,16 @@ public class ModelWalkerGenerator extends EmfJavaCodeGenerator { box.add("package %s;", genPackageName); box.add(); + // Add the imports. List imports = listc(classes.size()); - imports.add("java.util.List"); - imports.add("org.eclipse.escet.common.java.Assert"); + if (!genComposite) { + imports.add("java.util.List"); + imports.add("org.eclipse.escet.common.java.Assert"); + } for (EClass impClass: classes) { imports.add(getJavaTypeName(impClass)); - if (!impClass.isAbstract()) { + if (!genComposite && !impClass.isAbstract()) { if (!getDerivedClasses(impClass, classes).isEmpty()) { imports.add(getImplClassName(impClass)); } @@ -187,10 +232,11 @@ public class ModelWalkerGenerator extends EmfJavaCodeGenerator { } box.add(); + // Add the class JavaDoc. box.add("/**"); - box.add(" * A walker for \"%s\" models.", startPackage.getName()); + box.add(" * A %swalker for \"%s\" models.", genComposite ? "composite " : "", startPackage.getName()); box.add(" *"); - box.add(" *

    The walker works as follows:"); + box.add(" *

    The %swalker works as follows:", genComposite ? "composite " : ""); box.add(" *

      "); box.add(" *
    • Performs a top-down depth-first walk over the object tree, using the"); box.add(" * containment hierarchy.
    • "); @@ -212,38 +258,92 @@ public class ModelWalkerGenerator extends EmfJavaCodeGenerator { box.add(" *
    "); box.add(" *

    "); box.add(" *"); - box.add(" *

    By default, the pre-processing and post-processing methods do nothing"); - box.add(" * (they have an empty implementation). It is up to derived classes to"); - box.add(" * override methods and provide actual implementations. They may also override"); - box.add(" * walk and crawl methods, if desired.

    "); + if (genComposite) { + box.add(" *

    A composite walking does not perform any pre-processing or post-processing"); + box.add(" * by itself. It can be configured with any number of other (composite or"); + box.add(" * non-composite) model walkers. As pre-processing and post-processing the"); + box.add(" * composite model walker invokes pre-processing and post-processing on each"); + box.add(" * 'other' model walker, in the order they are supplied. The walking and"); + box.add(" * crawling methods of the non-composite of the 'other' model walkers are not"); + box.add(" * used.

    "); + } else { + box.add(" *

    By default, the pre-processing and post-processing methods do nothing"); + box.add(" * (they have an empty implementation). It is up to derived classes to"); + box.add(" * override methods and provide actual implementations. They may also override"); + box.add(" * walk and crawl methods, if desired.

    "); + } box.add(" *"); box.add(" *

    This abstract walker class has no public methods. It is up to the derived"); box.add(" * classes to add a public method as entry method. They can decide which"); box.add(" * classes are to be used as starting point, and they can give the public"); box.add(" * method a proper name, parameters, etc. They may even allow multiple public"); box.add(" * methods to allow starting from multiple classes.

    "); + if (withArg) { + box.add(" *"); + box.add(" * @param The type of the extra argument provided to the walking, crawling"); + box.add(" * and processing methods."); + } box.add(" */"); - box.add("public abstract class %s {", genClassName); - boolean first = true; - for (EClass cls: classes) { - if (!first) { - box.add(); + + // Add the class header. + if (genComposite) { + box.add("public abstract class %s%s extends %s%s {", genClassNameComposite, withArg ? "" : "", + genClassNameWalker, withArg ? "" : ""); + } else { + box.add("public abstract class %s%s {", genClassNameWalker, withArg ? "" : ""); + } + + // Add the class body. + if (genComposite) { + // Add fields. + box.indent(); + box.add("/** The walkers to be composed by this composite walker. */"); + box.add("private final %s%s[] walkers;", genClassNameWalker, withArg ? "" : ""); + box.dedent(); + box.add(); + + // Add constructor. + box.indent(); + box.add("/**"); + box.add(" * Constructor of the {@link %s} class.", genClassNameComposite); + box.add(" *"); + box.add(" * @param walkers The walkers to be composed by this composite walker."); + box.add(" */"); + box.add("public %s(%s%s[] walkers) {", genClassNameComposite, genClassNameWalker, withArg ? "" : ""); + box.add(" this.walkers = walkers;"); + box.add("}"); + box.dedent(); + + // Add methods. + for (EClass cls: classes) { + generateCompositeWalkerMethods(cls, genClassNameWalker, withArg, box); + } + } else { + // Add methods. + boolean first = true; + for (EClass cls: classes) { + if (!first) { + box.add(); + } + generateWalkerMethods(cls, classes, withArg, box); + first = false; } - genModelWalkerClass(cls, classes, box); - first = false; } + + // Close the class. box.add("}"); return box; } /** - * Generate model walker class code for an {@link EClass}. + * Generate model walker methods code for an {@link EClass}. * * @param cls The {@link EClass} to generate the code for. * @param classes The candidate derived classes for the given 'cls'. + * @param withArg Whether to generate an extra-argument methods ({@code true}) or regular methods ({@code false}). * @param box The generated code (appended in-place). */ - private static void genModelWalkerClass(EClass cls, List classes, CodeBox box) { + private static void generateWalkerMethods(EClass cls, List classes, boolean withArg, CodeBox box) { List derivedClasses = getDerivedClasses(cls, classes); // Walking function. @@ -252,8 +352,11 @@ public class ModelWalkerGenerator extends EmfJavaCodeGenerator { box.add(" * Walking function for the {@link %s} class.", cls.getName()); box.add(" *"); box.add(" * @param obj The object to walk over."); + if (withArg) { + box.add(" * @param arg The extra argument provided to the walking method."); + } box.add(" */"); - box.add("protected void walk%s(%s obj) {", cls.getName(), cls.getName()); + box.add("protected void walk%s(%s obj%s) {", cls.getName(), cls.getName(), withArg ? ", T arg" : ""); box.indent(); if (derivedClasses.size() > 0) { @@ -261,7 +364,7 @@ public class ModelWalkerGenerator extends EmfJavaCodeGenerator { box.add("if (obj instanceof %s) {", derived.getName()); box.indent(); - box.add("walk%s((%s)obj);", derived.getName(), derived.getName()); + box.add("walk%s((%s)obj%s);", derived.getName(), derived.getName(), withArg ? ", arg" : ""); box.add("return;"); box.dedent(); @@ -276,7 +379,7 @@ public class ModelWalkerGenerator extends EmfJavaCodeGenerator { if (derivedClasses.size() > 0) { box.add("Assert.check(obj.getClass() == %s.class);", getImplClassSimpleName(cls)); } - box.add("precrawl%s(obj);", cls.getName()); + box.add("precrawl%s(obj%s);", cls.getName(), withArg ? ", arg" : ""); List feats = getAllContainmentStructuralFeatures(cls); for (EReference feat: feats) { String methodName = feat.getName(); @@ -287,7 +390,7 @@ public class ModelWalkerGenerator extends EmfJavaCodeGenerator { box.add("List<%s> _%s = obj.%s();", feat.getEReferenceType().getName(), feat.getName(), methodName); box.add("for (%s x: _%s) {", feat.getEReferenceType().getName(), feat.getName()); box.indent(); - box.add("walk%s(x);", feat.getEReferenceType().getName()); + box.add("walk%s(x%s);", feat.getEReferenceType().getName(), withArg ? ", arg" : ""); box.dedent(); box.add("}"); } else { @@ -298,17 +401,19 @@ public class ModelWalkerGenerator extends EmfJavaCodeGenerator { // Case: [0..1] box.add("if (_%s != null) {", feat.getName()); box.indent(); - box.add("walk%s(_%s);", feat.getEReferenceType().getName(), feat.getName()); + box.add("walk%s(_%s%s);", feat.getEReferenceType().getName(), feat.getName(), + withArg ? ", arg" : ""); box.dedent(); box.add("}"); } else { // Case: [1] Assert.check(feat.getLowerBound() == 1); - box.add("walk%s(_%s);", feat.getEReferenceType().getName(), feat.getName()); + box.add("walk%s(_%s%s);", feat.getEReferenceType().getName(), feat.getName(), + withArg ? ", arg" : ""); } } } - box.add("postcrawl%s(obj);", cls.getName()); + box.add("postcrawl%s(obj%s);", cls.getName(), withArg ? ", arg" : ""); } box.dedent(); @@ -325,14 +430,17 @@ public class ModelWalkerGenerator extends EmfJavaCodeGenerator { box.add(" * Pre-crawling function for the {@link %s} class.", cls.getName()); box.add(" *"); box.add(" * @param obj The object to crawl over."); + if (withArg) { + box.add(" * @param arg The extra argument provided to the pre-crawling method."); + } box.add(" */"); - box.add("protected void precrawl%s(%s obj) {", cls.getName(), cls.getName()); + box.add("protected void precrawl%s(%s obj%s) {", cls.getName(), cls.getName(), withArg ? ", T arg" : ""); box.indent(); for (EClass superClass: superClasses) { - box.add("precrawl%s(obj);", superClass.getName()); + box.add("precrawl%s(obj%s);", superClass.getName(), withArg ? ", arg" : ""); } - box.add("preprocess%s(obj);", cls.getName()); + box.add("preprocess%s(obj%s);", cls.getName(), withArg ? ", arg" : ""); box.dedent(); box.add("}"); @@ -343,13 +451,16 @@ public class ModelWalkerGenerator extends EmfJavaCodeGenerator { box.add(" * Post-crawling function for the {@link %s} class.", cls.getName()); box.add(" *"); box.add(" * @param obj The object to crawl over."); + if (withArg) { + box.add(" * @param arg The extra argument provided to the post-crawling method."); + } box.add(" */"); - box.add("protected void postcrawl%s(%s obj) {", cls.getName(), cls.getName()); + box.add("protected void postcrawl%s(%s obj%s) {", cls.getName(), cls.getName(), withArg ? ", T arg" : ""); box.indent(); - box.add("postprocess%s(obj);", cls.getName()); + box.add("postprocess%s(obj%s);", cls.getName(), withArg ? ", arg" : ""); for (EClass superClass: superClasses) { - box.add("postcrawl%s(obj);", superClass.getName()); + box.add("postcrawl%s(obj%s);", superClass.getName(), withArg ? ", arg" : ""); } box.dedent(); @@ -361,8 +472,11 @@ public class ModelWalkerGenerator extends EmfJavaCodeGenerator { box.add(" * Pre-processing function for the {@link %s} class.", cls.getName()); box.add(" *"); box.add(" * @param obj The object to pre-process."); + if (withArg) { + box.add(" * @param arg The extra argument provided to the pre-processing method."); + } box.add(" */"); - box.add("protected void preprocess%s(%s obj) {", cls.getName(), cls.getName()); + box.add("protected void preprocess%s(%s obj%s) {", cls.getName(), cls.getName(), withArg ? ", T arg" : ""); box.add(" // Derived classes may override this method to do actual processing."); box.add("}"); box.add(); @@ -372,10 +486,47 @@ public class ModelWalkerGenerator extends EmfJavaCodeGenerator { box.add(" * Post-processing function for the {@link %s} class.", cls.getName()); box.add(" *"); box.add(" * @param obj The object to post-process."); + if (withArg) { + box.add(" * @param arg The extra argument provided to the post-processing method."); + } box.add(" */"); - box.add("protected void postprocess%s(%s obj) {", cls.getName(), cls.getName()); + box.add("protected void postprocess%s(%s obj%s) {", cls.getName(), cls.getName(), withArg ? ", T arg" : ""); box.add(" // Derived classes may override this method to do actual processing."); box.add("}"); box.dedent(); } + + /** + * Generate composite model walker methods code for an {@link EClass}. + * + * @param cls The {@link EClass} to generate the code for. + * @param genClassNameWalker The name of the model walker Java class to generate. + * @param withArg Whether to generate an extra-argument methods ({@code true}) or regular methods ({@code false}). + * @param box The generated code (appended in-place). + */ + private static void generateCompositeWalkerMethods(EClass cls, String genClassNameWalker, boolean withArg, + CodeBox box) + { + // Pre-processing function. + box.add(); + box.indent(); + box.add("@Override"); + box.add("protected void preprocess%s(%s obj%s) {", cls.getName(), cls.getName(), withArg ? ", T arg" : ""); + box.add(" for (%s%s walker: walkers) {", genClassNameWalker, withArg ? "" : ""); + box.add(" walker.preprocess%s(obj%s);", cls.getName(), withArg ? ", arg" : ""); + box.add(" }"); + box.add("}"); + box.dedent(); + + // Post-processing function. + box.add(); + box.indent(); + box.add("@Override"); + box.add("protected void postprocess%s(%s obj%s) {", cls.getName(), cls.getName(), withArg ? ", T arg" : ""); + box.add(" for (%s%s walker: walkers) {", genClassNameWalker, withArg ? "" : ""); + box.add(" walker.postprocess%s(obj%s);", cls.getName(), withArg ? ", arg" : ""); + box.add(" }"); + box.add("}"); + box.dedent(); + } } diff --git a/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/latex/EmfLatexDocSkeletonDetailGenerator.java b/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/latex/EmfLatexDocSkeletonDetailGenerator.java index e1f0855076d71936f50d4a4b6564f237904c407d..72379201488232168dceb04fb3e92a48b7ca0a27 100644 --- a/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/latex/EmfLatexDocSkeletonDetailGenerator.java +++ b/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/latex/EmfLatexDocSkeletonDetailGenerator.java @@ -56,10 +56,10 @@ public class EmfLatexDocSkeletonDetailGenerator extends EmfLatexCodeGenerator { * @param args Application arguments: *
      *
    • The full name of the main {@link EPackage} Java class. For instance, {@code - * "bla.somelang.v1x0x0.metamodel.somelang.SomeLangPackage"}.
    • + * "bla.somelang.metamodel.somelang.SomeLangPackage"}. *
    • The path to add to the Java class path to allow the main package Java class to be found. For instance, * {@code "bin"}. It is allowed to add multiple paths. For instance, {@code "bin|../bin"}.
    • - *
    • The output file name path. For instance, {@code "docs"}.
    • + *
    • The output directory path. For instance, {@code "docs"}.
    • *
    * @throws IOException In case the code could not be written to a file; or in case the java class path extension * path is invalid. @@ -88,7 +88,7 @@ public class EmfLatexDocSkeletonDetailGenerator extends EmfLatexCodeGenerator { box.writeToFile(outputFilePath); // We are done. - System.out.print("Code written to: " + outputFilePath); + System.out.printf("Code written to: %s%n", outputFilePath); } /** diff --git a/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/latex/EmfLatexDocSkeletonGenerator.java b/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/latex/EmfLatexDocSkeletonGenerator.java index e27c0588dcc0017d18c8e59fb7493c93be68354d..aa5e75cadf85ab39fba902f4081070c5b31258fd 100644 --- a/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/latex/EmfLatexDocSkeletonGenerator.java +++ b/common/org.eclipse.escet.common.emf.ecore.codegen/src/org/eclipse/escet/common/emf/ecore/codegen/latex/EmfLatexDocSkeletonGenerator.java @@ -54,10 +54,10 @@ public class EmfLatexDocSkeletonGenerator extends EmfLatexCodeGenerator { * @param args Application arguments: *
      *
    • The full name of the main {@link EPackage} Java class. For instance, {@code - * "bla.somelang.v1x0x0.metamodel.somelang.SomeLangPackage"}.
    • + * "bla.somelang.metamodel.somelang.SomeLangPackage"}. *
    • The path to add to the Java class path to allow the main package Java class to be found. For instance, * {@code "bin"}. It is allowed to add multiple paths. For instance, {@code "bin|../bin"}.
    • - *
    • The output file name path. For instance, {@code "docs"}.
    • + *
    • The output directory path. For instance, {@code "docs"}.
    • *
    * @throws IOException In case the code could not be written to a file; or in case the java class path extension * path is invalid. @@ -85,7 +85,7 @@ public class EmfLatexDocSkeletonGenerator extends EmfLatexCodeGenerator { box.writeToFile(outputFilePath); // We are done. - System.out.print("Code written to: " + outputFilePath); + System.out.printf("Code written to: %s%n", outputFilePath); } /**