Commit bcfd2924 authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ added complementary constraint to check for compatible types when component...

+ added complementary constraint to check for compatible types when component references are used, #230
parent a1d4f22f
Loading
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ context RepeatedEventSequence
  


--TODO: why is this not active?

--context EventOccurrence
--  -- Combining Multiple 'EventOccurrence's
@@ -99,6 +100,20 @@ context DataReference
          and self.content.argument->closure(a | 
          a.dataUse.argument)->forAll(a|a.dataUse.isEffectivelyStatic())
    
  -- Compatible 'DataType's when 'ComponentInstance's are used
  inv CompatibleDataTypeInDataReference ('Only compatible \'DataType\'s may be used directly when \'ComponentInstance\'s are referenced within a top-level \'DataReference\'.' + self.toString()):
    self.container().oclIsTypeOf(EventOccurrenceSpecification) implies ( 
          self.container().oclAsType(EventOccurrenceSpecification).oppositeEntityReference
          ->including(self.container().oclAsType(EventOccurrenceSpecification).entityReference)
          ->collect(e | e.component)->excluding(null)->isEmpty()
          or
          self.container().oclAsType(EventOccurrenceSpecification).oppositeEntityReference
          ->including(self.container().oclAsType(EventOccurrenceSpecification).entityReference)
          ->collect(e | e.component)->excluding(null)
          ->collect(c | c.type.allGates())
          ->collect(g | g.type.allDataTypes())
          ->exists(d | self.content.resolveDataType().conformsTo(d))
    )