Systems-Modeling / SysML-v2-Pilot-Implementation

Proof-of-concept pilot implementation of the SysML v2 textual notation and visualization
GNU Lesser General Public License v3.0
123 stars 24 forks source link

ST6RI-731 Model-level evaluation of the list range construction operator #526

Closed seidewitz closed 8 months ago

seidewitz commented 8 months ago

This PR adds two additional model-level evaluable function implementations, under org.omg.sysml.expressions.functions.

  1. ListRangeFunction implements the range construction operator '..'. An expression of the form e1...e2, in which e1 and e2 evaluate to integers, results in an ordered sequence of a range of sequential integers from the value of e1 to the value of e2, inclusive. For example, 1..3 evaluates to the sequence (1, 2, 3). If the value of e1 is greater than the value of e2, then the result is the empty sequence.
  2. ExcludesFunction implements the SequenceFunctions::excludes function. This function tests whether a value is excluded from a sequence. For example, excludes(1..3, 2) is false, while excludes(1..3, 0) is true. It is the inverse of the includes function, which was already implemented.

It also adds tests to org.omg.sysml.interactive.tests.ModelLevelEvaluationTest for the above new function implementations, as well as adding some additional tests for other sequence-related functions previously implemented.

himi commented 8 months ago

It seems to work. I'll upload an example with my review later.

himi commented 8 months ago

Here is the visualized result:

Screenshot 2024-01-16 at 1 03 13 PM

seidewitz commented 8 months ago

Cool!