OCL cheat sheet

Document Sample
OCL cheat sheet Powered By Docstoc
					OCL cheat sheet




                  Set (or Bag) of T                                        Set (or Bag) of T
   Operation            Notation         Result Type    Operation               Notation                Result Type
     equals               a=b              Boolean      there exists       a->exists( i:T | exp)         Boolean
   not equals            a <> b            Boolean         forall          a->forall( i:T | exp)         Boolean
       size             a >size()          Integer         forall      a->forall(i:T, ..., n:T | exp)    Boolean
      sum               a >sum()           Type T       exists one         a >one( i:T | exp)            Boolean
      count            a >count(t)         Integer          any             a >any( i:T | exp)            Type T
    includes          a >includes(t)       Boolean        collect            a >collect(exp)             Bag of T
    excludes         a >excludes(t)        Boolean         select            a >select(exp)             Set/Bag of T
   includes all     a >includesall(b)      Boolean         reject            a >reject(exp)             Set/Bag of T
   excludes all     a >excludesall(b)      Boolean
    is empty          a >isEmpty()         Boolean
   not empty         a >notEmpty()         Boolean                   KEY
                                                                            a, b : Set or Bag of Type
      union            a >union(b)       Set/Bag of T                       c, d : Set of Type T
  intersection      c >intersection(d)   Set/Bag of T                           t : object of Type T
   difference             c-d              Set of T                          exp is an expression
Cartesian product    a >product(b)       Set of (TxT)
     insert          a >including(t)     Set/Bag of T
     remove          a >excluding(t)     Set/Bag of T