Menu

#181 wrong assoc end types for spezialized assoc class

None
new
nobody
None
normal
major
Always
Model definition
3.0.4
2014-11-06
2014-08-28
Frank
No

NOTE: This ticket was lost during the migration from mantis to the SourceForge bug tracker.
Original Ticket ID: #144
== original content follows ============================================

wrong assoc end types for spezialized assoc class

PredSucc_ZeroPos is defined on Zero/Pos
BUT SHOWN TYPE IS Int/Int

use file below
[mg]


model Integer

abstract class Int
operations
predPlus():Set(Int)=
  predPlusOnSet(Set{pred}->excluding(null))
predPlusOnSet(s:Set(Int)):Set(Int)=
  let oneStep=s.pred->excluding(null)->asSet() in
  if oneStep->exists(i|s->excludes(i))
    then predPlusOnSet(s->union(oneStep)) else s endif
succPlus():Set(Int)=
  succPlusOnSet(Set{succ}->excluding(null))
succPlusOnSet(s:Set(Int)):Set(Int)=
  let oneStep=s.succ->excluding(null)->asSet() in
  if oneStep->exists(i|s->excludes(i))
    then succPlusOnSet(s->union(oneStep)) else s endif
constraints
  inv acyclicPredSucc:
    predPlus()->union(succPlus())->excludes(self)
  -- inv acyclicPred:
  -- predPlus()->excludes(self)
  -- inv acyclicSucc:
  -- succPlus()->excludes(self)
end

associationclass PredSucc between
  Int[0..1] role pred
  Int[0..1] role succ
end

associationclass PredSucc_ZeroPos < PredSucc between
  Zero[0..1] role pred
  Pos[0..1] role succ
end

class Zero < Int
constraints
  inv zeroNotLinkedToZero:
    not predPlus()->union(succPlus())->exists(i|
      i.oclIsTypeOf(Zero))
  inv zeroNotLinkedToNegAndPos:
    not predPlus()->union(succPlus())->exists(n,p|
      n.oclIsTypeOf(Neg) and p.oclIsTypeOf(Pos))
end

class Neg < Int
constraints
  inv negNotLinkedToPos:
    not predPlus()->union(succPlus())->exists(p|
      p.oclIsTypeOf(Pos))
  inv negLinkedToZeroBySucc:
    succPlus()->exists(z|z.oclIsTypeOf(Zero))
end

class Pos < Int
constraints
  inv posNotLinkedToNeg:
    not predPlus()->union(succPlus())->exists(n|
      n.oclIsTypeOf(Neg))
  inv posLinkedToZeroByPred:
    predPlus()->exists(z|z.oclIsTypeOf(Zero))
end

Discussion

  • Frank

    Frank - 2014-08-28
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,3 +1,7 @@
    +**NOTE:** This ticket was lost during the migration from mantis to the SourceForge bug tracker.
    +Original Ticket ID: #144
    +== original content follows ============================================
    +
     wrong assoc end types for spezialized assoc class
    
     PredSucc_ZeroPos is defined on Zero/Pos
    
     
  • Frank

    Frank - 2014-08-28

    Comment by H-man2:

    In USE 3.1.0 this models leads to the following message:
    Association end pred' navigable from classPos' conflicts with same rolename in association `PredSucc'.

    It needs to be discussed if this kind of association class inheritance is valid.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.