File: uml13_metamodel_ext.rb

package info (click to toggle)
ruby-rgen 0.10.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,428 kB
  • sloc: ruby: 11,344; xml: 1,368; yacc: 72; makefile: 10
file content (26 lines) | stat: -rw-r--r-- 628 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Some handy extensions to the UML13 metamodel
# 
module UML13
  
  module AssociationEnd::ClassModule
    def otherEnd
      association.connection.find{|c| c != self}
    end
  end
  
  module Classifier::ClassModule
    def localCompositeEnd
      associationEnd.select{|e| e.aggregation == :composite}
    end
    def remoteCompositeEnd
      associationEnd.otherEnd.select{|e| e.aggregation == :composite}
    end
    def localNavigableEnd
      associationEnd.select{|e| e.isNavigable}
    end
    def remoteNavigableEnd
      associationEnd.otherEnd.select{|e| e.isNavigable}
    end
  end

end