Class SequenceExpressions

java.lang.Object
com.dassault_systemes.modeler.kerml.model.SequenceExpressions

@OpenApiAll public class SequenceExpressions extends Object
  • Field Details

    • COMMA_OPERATOR

      public static final String COMMA_OPERATOR
      Operator symbol for sequencing expressions using the comma operator.
      See Also:
  • Constructor Details

    • SequenceExpressions

      public SequenceExpressions()
  • Method Details

    • addElementToSequence

      public static void addElementToSequence(Feature sequenceFeature, Element addedElement, Function<Element,Expression> expressionFactory)
      Adds the element to the sequence using the ',' operator.

      For example, if the passed sequence feature is the following: (requirement1.metadata, requirement2.metadata)
      and the element parameter requirement3 is passed along with MetadataAccessExpressions.createMetadataAccessExpression(Element) factory, it will result in the following sequence: (requirement1.metadata, requirement2.metadata, requirement3.metadata)
      Parameters:
      sequenceFeature - root feature of the sequence
      addedElement - element, which will be added to the sequence
    • getValue

      public static List<Expression> getValue(OperatorExpression topExpression)
      Extracts all non-operator expressions from a comma operator expression tree.
      Parameters:
      topExpression - the root operator expression
      Returns:
      list of contained expressions in sequence order
    • isCommaOperatorExpression

      public static boolean isCommaOperatorExpression(@CheckForNull Expression expression)
      Checks whether the given expression is a comma operator expression.
      Parameters:
      expression - the expression to check
      Returns:
      true if the expression uses the comma operator
    • createCommaOperatorExpression

      public static OperatorExpression createCommaOperatorExpression(Supplier<ElementsFactory> factorySupplier)
      Creates a new comma operator expression with two input parameters.
      Parameters:
      factorySupplier - supplier for the elements factory
      Returns:
      a new comma operator expression
    • createCommaOperatorExpression

      public static OperatorExpression createCommaOperatorExpression(Expression first, Expression second)
      Creates a comma operator expression combining two expressions.
      Parameters:
      first - the first expression
      second - the second expression
      Returns:
      a new comma operator expression
    • createCommaOperatorExpression

      @CheckForNull public static OperatorExpression createCommaOperatorExpression(Expression... expressions)
      Creates a comma operator expression from the given list of expressions. If no expressions are provided, this method returns null.
      Parameters:
      expressions - the expressions to combine using the comma operator
      Returns:
      a comma operator expression combining the given expressions, or null if the input is empty