Entity: NamedElement 103 30 null * abstract name String 3 false false false Entity: Relationship 549 34 NamedElement * abstract Entity: Feature 6 125 NamedElement * abstract isStatic boolean 3 false false false Entity: Type 261 133 NamedElement * abstract typeId String 3 false true false Entity: Classifier 275 201 Type * abstract Entity: StructuralFeature 26 208 Feature * abstract isReadOnly boolean 3 false false false Entity: DataType 343 143 Classifier * abstract Entity: PrimitiveType 405 196 DataType * Entity: Enumeration 469 160 DataType * Entity: Entity 295 292 Classifier * isAbstract boolean 3 false false false isInterface boolean 3 false false false Entity: Property 27 325 StructuralFeature * lower int 3 false false false upper int 3 false false false isOrdered boolean 3 false false false isUnique boolean 3 false false false isDerived boolean 3 false false false Entity: Association 603 345 Relationship * addOnly boolean 3 false false false aggregation boolean 3 false false false Entity: Generalization 509 248 Relationship * Entity: EnumerationLiteral 374 54 NamedElement * Entity: BehaviouralFeature 8 471 Feature * abstract Entity: Operation 8 527 BehaviouralFeature * isQuery boolean 3 false false false isCached boolean 3 false false false text String 3 false false false Entity: Constraint 506 567 null * constraintKind int 3 false false false ordered boolean 3 false false false Entity: Expression 338 591 null * abstract needsBracket boolean 3 false false false umlKind UMLKind 3 false false false expId String 3 false true false Entity: UseCase 661 449 Classifier * isGeneric boolean 3 false false false isDerived boolean 3 false false false Entity: CollectionType 398 92 DataType * Entity: CStruct 729 609 CType * name String 3 false true false Operation: toString CStruct String query true result = "struct " + name Operation: allCMembers CStruct Set(CMember) query true sups = members->select(name = "super") & (sups.size = 0 => result = members) & (sups.size > 0 => result = (members - sups)->union(sups.any.inheritedCMembers())) Entity: CMember 1138 619 null * name String 3 false false false isKey boolean 3 false false false Operation: toString CMember String query true (isKey = true => result = " " + type + " " + name + "; // key") & (isKey = false => result = " " + type + " " + name + ";") Operation: inheritedCMembers CMember Set(CMember) query type : CPointerType & type.pointsTo : CStruct anc = type.pointsTo & result = anc.allCMembers() Operation: getterOp CMember String ent String query true result = type + " get" + ent + "_" + name + "(struct " + ent + "* self) { return self->" + name + "; }\n" Operation: inheritedGetterOp CMember String ent String sup String query true (name /= "super" => result = type + " get" + ent + "_" + name + "(struct " + ent + "* self) { return get" + sup + "_" + name + "(self->super); }\n") & (name = "super" => result = self.ancestorGetterOps(ent,sup) ) Operation: ancestorGetterOps CMember String ent String sup String query type : CPointerType & type.pointsTo : CStruct anc = type.pointsTo & result = anc.members->collect( m | m.inheritedGetterOp(ent, sup) )->sum() Operation: inheritedGetterOps CMember String ent String query type : CPointerType & type.pointsTo : CStruct sup = type.pointsTo & result = sup.members->collect( m | m.inheritedGetterOp(ent, sup.name) )->sum() Operation: setterOp CMember String ent String query true result = "void set" + ent + "_" + name + "(struct " + ent + "* self, " + type + " _value) { self->" + name + " = _value; }\n" Operation: inheritedSetterOp CMember String ent String sup String query true (name /= "super" => result = "void set" + ent + "_" + name + "(struct " + ent + "* self, " + type + " _value) { set" + sup + "_" + name + "(self->super, _value); }\n") & (name = "super" => result = self.ancestorSetterOps(ent,sup) ) Operation: ancestorSetterOps CMember String ent String sup String query type : CPointerType & type.pointsTo : CStruct anc = type.pointsTo & result = anc.members->collect( m | m.inheritedSetterOp(ent, sup) )->sum() Operation: inheritedSetterOps CMember String ent String query type : CPointerType & type.pointsTo : CStruct sup = type.pointsTo & result = sup.members->collect( m | m.inheritedSetterOp(ent, sup.name) )->sum() Operation: getAllOp CMember String ent String query true result = type + "* getAll" + ent + "_" + name + "(struct " + ent + "* col[])\n" + "{ int n = length((void**) col);\n" + " " + type + "* result = (" + type + "*) calloc(n, sizeof(" + type + "));\n" + " int i = 0;\n" + " for ( ; i < n; i++)\n" + " { result[i] = get" + ent + "_" + name + "(col[i]); }\n" + " return result;\n" + "}\n" Operation: getAllOp1 CMember String ent String query true result = type + "* getAll" + ent + "_" + name + "(struct " + ent + "* col[])\n" + "{ int n = length((void**) col);\n" + " " + type + "* result = (" + type + "*) calloc(n+1, sizeof(" + type + "));\n" + " int i = 0;\n" + " for ( ; i < n; i++)\n" + " { result[i] = get" + ent + "_" + name + "(col[i]); }\n" + " result[n] = NULL;\n" + " return result;\n" + "}\n" Operation: getPKOp CMember String ent String query true e = ent.toLowerCase & result = "struct " + ent + "* get" + ent + "ByPK(char* ex)\n" + "{ int n = length((void**) " + e + "_instances);\n" + " int i = 0;\n" + " for ( ; i < n; i++)\n" + " { char* attv = get" + ent + "_" + name + "(" + e + "_instances[i]);\n" + " if (attv != NULL && strcmp(attv,ex) == 0)\n" + " { return " + e + "_instances[i]; }\n" + " }\n" + " return NULL;\n" + "}\n" Operation: initialisation CMember String query true (isKey = true => result = "") & (name = "super" => result = " super = create" + type.pointsTo.name + "();\n") & (type : CPointerType or type : CArrayType => result = " " + name + " = NULL;\n") & (type : CPrimitiveType => result = " " + name + " = 0;\n") Entity: CType 899 845 null * abstract ctypeId String 3 false true false Operation: toString CType String query abstract true true Entity: COperation 556 917 null * name String 3 false false false text String 3 false false false scope String 3 false false false isQuery boolean 3 false false false Operation: parameterDeclaration COperation String s Sequence(CVariable) query true ( s.size = 0 => result = "" ) & ( s.size = 1 => result = s[1].type + " " + s[1].name ) & ( s.size > 1 => result = s[1].type + " " + s[1].name + ", " + parameterDeclaration(s.tail) ) Operation: parameterNames COperation String s Sequence(CVariable) query true ( s.size = 0 => result = "" ) & ( s.size = 1 => result = s[1].name ) & ( s.size > 1 => result = s[1].name + ", " + parameterNames(s.tail) ) Operation: toString COperation String query true result = returnType + " " + name + "(" + parameterDeclaration(parameters) + ")\n" + "{ " + text + " }\n" Entity: CVariable 917 991 null * name String 3 false false false kind String 3 false false false initialisation String 3 false false false Entity: CProgram 558 1049 null * Operation: printMainOperation CProgram void true "int main() { return 0; }"->display() Operation: printDeclarations CProgram void true true Operation: printOperations CProgram void true operations->forAll( op | op->display() ) Operation: printProgramHeader CProgram void true "#include "->display() & "#include "->display() & "#include "->display() & "#include "->display() & "#include "->display() & "#include "->display() & "#define ALLOCATIONSIZE 10\n"->display() & "#define TRUE 1"->display() & "#define FALSE 0\n"->display() & "#include \"ocl.h\"\n"->display() Entity: CPrimitiveType 710 701 CType * name String 3 false false false Operation: toString CPrimitiveType String query true result = name Entity: CArrayType 616 764 CType * duplicates boolean 3 false false false Operation: toString CArrayType String query true result = componentType + "*" Entity: CPointerType 1151 764 CType * Operation: toString CPointerType String query true result = pointsTo + "*" Entity: BinaryExpression 57 760 Expression * operator String 3 false false false Entity: UnaryExpression 654 712 Expression * operator String 3 false false false Entity: CollectionExpression 646 638 Expression * isOrdered boolean 3 false false false Type: UMLKind 789 796 value attribute role variable constant function queryop operation classid Entity: BasicExpression 284 828 Expression * data String 3 false false false prestate boolean 3 false false false Association: Feature Type 0 210 130 262 140 1 type null Association: Entity Property 1 300 292 63 326 0 ownedAttribute owner ordered Association: Association Property -1 604 394 248 392 0 memberEnd null ordered Association: Enumeration EnumerationLiteral -1 568 161 535 79 0 ownedLiteral null ordered Association: Entity Generalization 1 362 293 511 251 0 generalization specific Association: Generalization Entity 0 579 273 523 325 1 general specialization Association: Entity Operation 1 326 346 208 530 0 ownedOperation owner ordered Association: Operation Expression -1 225 540 395 588 1 precondition null Association: Operation Expression -1 218 581 338 615 1 postcondition null Association: Constraint Expression -1 510 571 406 591 1 condition null Association: Constraint Expression -1 508 620 429 611 1 succedent null Association: Entity Constraint 1 447 348 578 566 0 constraint owner Association: UseCase Constraint -1 668 505 619 565 0 orderedPostconditions null ordered Association: UseCase Constraint -1 788 505 708 593 0 assumptions null 789 593 Association: BehaviouralFeature Property -1 166 474 186 423 0 parameters null ordered Association: UseCase Property -1 664 450 246 421 0 parameters null ordered Association: Association Entity -1 605 356 521 348 -1 linkedClass null Association: UseCase UseCase -1 800 451 845 450 0 extensions null 800 423 904 422 Association: UseCase UseCase 0 863 502 877 473 0 inclusions null 862 525 940 526 940 492 Association: CollectionType Type 0 394 98 307 133 1 elementType null Association: CStruct CMember 1 975 646 1137 632 0 members null ordered Association: CStruct CMember 0 985 656 1147 642 0 allMembers null Association: COperation CVariable -1 816 954 920 1008 0 parameters null ordered Association: CVariable CType 0 1047 993 937 900 1 type null Association: COperation CType 0 816 917 901 899 1 returnType null Association: CArrayType CType 0 740 820 901 851 1 componentType null 741 847 Association: CPointerType CType 0 1251 802 1164 858 1 pointsTo null 1181 857 Association: CMember CType 0 1140 672 1055 845 1 type null Association: CProgram COperation 1 643 1051 653 1005 0 operations null Association: CProgram CVariable 1 739 1098 1019 1057 0 variables null Association: CProgram CStruct -1 560 1058 731 635 0 structs null 520 955 521 637 Association: Expression Type 0 340 591 266 176 1 type null Association: Expression Type 0 345 591 309 178 1 elementType null Association: CollectionExpression Expression 0 647 657 338 598 0 elements null Association: BinaryExpression Expression 0 124 760 338 599 1 left null 125 578 Association: BinaryExpression Expression 0 208 772 338 605 1 right null 221 581 Association: BasicExpression Expression 0 427 833 350 570 0 parameters null ordered Association: UnaryExpression Expression -1 657 715 413 592 1 argument null Association: BasicExpression Property 0 588 837 27 359 -1 referredProperty null Association: BasicExpression BasicExpression -1 287 934 339 958 -1 arrayIndex null 227 933 227 996 307 997 Association: Property Expression -1 664 678 335 616 1 initialValue null 665 626 514 622 Association: BasicExpression BasicExpression -1 490 953 408 962 -1 objectRef null 552 953 551 1002 443 1003 Generalisation: NamedElement Feature 53 127 105 67 Generalisation: NamedElement Relationship 552 40 261 35 Generalisation: NamedElement Type 278 135 243 68 Generalisation: Feature StructuralFeature 168 210 167 162 Generalisation: Type Classifier 287 203 287 156 Generalisation: DataType Enumeration 471 165 425 163 Generalisation: DataType PrimitiveType 414 198 414 165 Generalisation: Classifier Entity 336 296 335 224 Generalisation: Classifier DataType 372 164 334 203 Generalisation: StructuralFeature Property 51 329 52 247 Generalisation: Relationship Association 731 348 650 58 Generalisation: Relationship Generalization 588 247 583 56 Generalisation: NamedElement EnumerationLiteral 375 62 260 58 Generalisation: Feature BehaviouralFeature 12 472 14 165 Generalisation: BehaviouralFeature Operation 35 528 35 493 Generalisation: Classifier UseCase 777 452 356 220 775 245 Generalisation: DataType CollectionType 420 119 422 145 Generalisation: CType CStruct 962 663 962 847 Generalisation: CType CPrimitiveType 865 753 939 845 Generalisation: CType CPointerType 1160 801 1153 846 Generalisation: CType CArrayType 840 802 903 845 Generalisation: Expression UnaryExpression 655 739 341 610 Generalisation: Expression BasicExpression 357 826 347 613 Generalisation: Expression BinaryExpression 57 818 348 618 23 819 24 618 288 616 Generalisation: Expression CollectionExpression 722 639 375 637 722 623 474 622 GeneralUseCase: printcode false Constraint: null true printProgramHeader() CProgram printcode false Constraint: null true allMembers = allCMembers() CStruct printcode false Constraint: null true ( "struct " + name + " {" )->display() & members->forAll( m | m->display() ) & "};\n"->display() CStruct printcode false Constraint: null true ( "struct " + name + "** " + name.toLowerCase + "_instances = NULL;" )->display() & ( "int " + name.toLowerCase + "_size = 0;\n" )->display() CStruct printcode false Constraint: true f : members & f.name /= "super" f.getterOp(name)->display() CStruct printcode false Constraint: true f : members & f.name = "super" f.inheritedGetterOps(name)->display() CStruct printcode false Constraint: true f : members & f.name /= "super" f.setterOp(name)->display() CStruct printcode false Constraint: true f : members & f.name = "super" f.inheritedSetterOps(name)->display() CStruct printcode false Constraint: true f : allMembers & f.type : CPrimitiveType f.getAllOp(name)->display() CStruct printcode false Constraint: true f : allMembers & f.name /= "super" & f.type : CPointerType f.getAllOp1(name)->display() CStruct printcode false Constraint: true allMembers->exists( k | k.isKey ) & key = allMembers->select( isKey )->any() key.getPKOp(name)->display() CStruct printcode false Constraint: null true ( "struct " + name + "** append" + name + "(struct " + name + "* col[], struct " + name + "* ex)" )->display() & ( " { struct " + name + "** result;" )->display() & " int len = length((void**) col);"->display() & " if (len % ALLOCATIONSIZE == 0)"->display() & ( " { result = (struct " + name + "**) calloc(len + ALLOCATIONSIZE + 1, sizeof(struct " + name + "*));" )->display() & " int i = 0;"->display() & " for ( ; i < len; i++) { result[i] = col[i]; }"->display() & " }"->display() & " else { result = col; }"->display() & " result[len] = ex;"->display() & " result[len+1] = NULL;"->display() & " return result;"->display() & " }\n"->display() CStruct printcode false Constraint: null true ( "struct " + name + "* create" + name + "()" )->display() & ( "{ struct " + name + "* result = NULL;" )->display() & ( " result = (struct " + name + "*) malloc(sizeof(struct " + name + "));" )->display() & ( " " + name.toLowerCase + "_instances = append" + name + "(" + name.toLowerCase + "_instances, result);" )->display() & ( " " + name.toLowerCase + "_size++;" )->display() & " return result;"->display() & "}\n"->display() CStruct printcode false Constraint: null true ( "struct " + name + "** new" + name + "List()" )->display() & ( "{ return (struct " + name + "**) calloc(ALLOCATIONSIZE, sizeof(struct " + name + "*)); }\n" )->display() CStruct printcode false Constraint: null true ( "struct " + name + "** insert" + name + "(struct " + name + "* col[], struct " + name + "* self)" )->display() & " { if (isIn((void*) self, (void**) col))"->display() & " { return col; }"->display() & ( " return append" + name + "(col,self);" )->display() & " }\n"->display() CStruct printcode false Constraint: null true ( "struct " + name + "** select" + name + "(struct " + name + "* col[], int (*test)(struct " + name + "* self))" )->display() & ( "{ struct " + name + "** result;" )->display() & " int len = length((void**) col);"->display() & ( " result = (struct " + name + "**) calloc(len + 1, sizeof(struct " + name + "*));" )->display() & " int j = 0;"->display() & " int i = 0;"->display() & " for ( ; i < len; i++)"->display() & ( " { struct " + name + "* self = col[i];" )->display() & " if (self == NULL)"->display() & " { result[j] = NULL;"->display() & " return result;"->display() & " }"->display() & " if ((*test)(self))"->display() & " { result[j] = self;"->display() & " j++;"->display() & " }"->display() & " }"->display() & " result[j] = NULL;"->display() & " return result;"->display() & "}\n"->display() CStruct printcode false Constraint: null true ( "struct " + name + "** reject" + name + "(struct " + name + "* col[], int (*test)(struct " + name + "* self))" )->display() & ( "{ struct " + name + "** result;" )->display() & " int len = length((void**) col);"->display() & ( " result = (struct " + name + "**) calloc(len + 1, sizeof(struct " + name + "*));" )->display() & " int j = 0;"->display() & " int i = 0;"->display() & " for ( ; i < len; i++)"->display() & ( " { struct " + name + "* self = col[i];" )->display() & " if (self == NULL)"->display() & " { result[j] = NULL;"->display() & " return result;"->display() & " }"->display() & " if ((*test)(self)) {}"->display() & " else { result[j] = self;"->display() & " j++;"->display() & " }"->display() & " }"->display() & " result[j] = NULL;"->display() & " return result;"->display() & "}\n"->display() CStruct printcode false Constraint: null true ( " void** collect" + name + "(struct " + name + "* col[], void* (*fe)(struct " + name + "*))" )->display() & " { int n = length((void**) col);"->display() & " void** result = (void**) calloc(n+1, sizeof(void*));"->display() & " int i = 0;"->display() & " for ( ; i < n; i++)"->display() & ( " { struct " + name + "* self = col[i];" )->display() & " result[i] = (*fe)(self);"->display() & " }"->display() & " result[n] = NULL;"->display() & " return result;"->display() & " }\n"->display() CStruct printcode false Constraint: null true ( " unsigned char exists" + name + "(struct " + name + "* col[], int (*test)(struct " + name + "* ex))" )->display() & " { int n = length((void**) col);"->display() & " unsigned char result = FALSE;"->display() & " int i = 0;"->display() & " for ( ; i < n; i++)"->display() & ( " { struct " + name + "* ex = col[i];" )->display() & " if (ex == NULL) { return result; }"->display() & " if ((*test)(ex))"->display() & " { return TRUE; }"->display() & " }"->display() & " return result;"->display() & " }\n"->display() CStruct printcode false Constraint: null true ( " unsigned char forAll" + name + "(struct " + name + "* col[], int (*test)(struct " + name + "* ex))" )->display() & " { int n = length((void**) col);"->display() & " unsigned char result = TRUE;"->display() & " int i = 0;"->display() & " for ( ; i < n; i++)"->display() & ( " { struct " + name + "* ex = col[i];" )->display() & " if (ex == NULL) { return result; }"->display() & " if ((*test)(ex)) {}"->display() & " else { return FALSE; }"->display() & " }"->display() & " return result;"->display() & " }\n"->display() CStruct printcode false Constraint: null true (" struct " + name + "** subrange" + name + "(struct " + name + "** col, int i, int j)")->display() & (" { int len = length((void**) col);")->display() & (" if (i > j || j > len) { return NULL; }")->display() & (" struct " + name + "** result = (struct " + name + "**) calloc(j - i + 2, sizeof(struct " + name + "*));")->display() & (" int k = i-1;")->display() & (" int l = 0;")->display() & (" for ( ; k < j; k++, l++)")->display() & (" { result[l] = col[k]; }")->display() & (" result[l] = NULL;")->display() & (" return result;")->display() & (" }\n")->display() CStruct printcode false Constraint: null true (" struct " + name + "** reverse" + name + "(struct " + name + "** col)")->display() & (" { int len = length((void**) col);")->display() & (" struct " + name + "** result = (struct " + name + "**) calloc(n+1, sizeof(struct " + name + "*));")->display() & (" int i = 0;")->display() & (" int x = n-1;")->display() & (" for ( ; i < n; i++, x--)")->display() & (" { result[i] = col[x]; }")->display() & (" result[n] = NULL;")->display() & (" return result;")->display() & (" }\n")->display() CStruct printcode false Constraint: null true ("struct " + name + "** remove" + name + "(struct " + name + "* col[], struct " + name + "* ex)")->display() & ("{ int len = length((void**) col);")->display() & (" struct " + name + "** result = (struct " + name + "**) calloc(len+1, sizeof(struct " + name + "*));")->display() & (" int j = 0;")->display() & (" int i = 0;")->display() & (" for ( ; i < len; i++)")->display() & (" { struct " + name + "* eobj = col[i];")->display() & (" if (eobj == NULL)")->display() & (" { result[j] = NULL;")->display() & (" return result; ")->display() & (" }")->display() & (" if (eobj == ex) { }")->display() & (" else")->display() & (" { result[j] = eobj; j++; }")->display() & (" }")->display() & (" result[j] = NULL;")->display() & (" return result;")->display() & ("}\n")->display() CStruct printcode false Constraint: null true ("struct " + name + "** union" + name + "(struct " + name + "* col1[], struct " + name + "* col2[])")->display() & (" { int n = length((void**) col1);")->display() & (" int m = length((void**) col2);")->display() & (" struct " + name + "** result = (struct " + name + "**) calloc(n + m + 1, sizeof(struct " + name + "*));")->display() & (" int i = 0;")->display() & (" int j = 0;")->display() & (" for ( ; i < n; i++)")->display() & (" { struct " + name + "* ex = col1[i];")->display() & (" if (isIn((void*) ex, (void**) result)) { }")->display() & (" else ")->display() & (" { result[j] = ex; j++; }")->display() & (" } ")->display() & (" i = 0;")->display() & (" for ( ; i < m; i++)")->display() & (" { struct " + name + "* ex = col2[i];")->display() & (" if (isIn((void*) ex, (void**) result)) { }")->display() & (" else ")->display() & (" { result[j] = ex; j++; }")->display() & (" }")->display() & (" result[j] = NULL;")->display() & (" return result;")->display() & (" }\n")->display() CStruct printcode false Constraint: null true self->display() COperation printcode false Constraint: null true "main() { }"->display() CProgram printcode false GeneralUseCase: types2C false Constraint: name = "int" null CPrimitiveType->exists( p | p.ctypeId = typeId & p.name = "int" ) PrimitiveType types2C false Constraint: name = "long" null CPrimitiveType->exists( p | p.ctypeId = typeId & p.name = "long" ) PrimitiveType types2C false Constraint: name = "double" null CPrimitiveType->exists( p | p.ctypeId = typeId & p.name = "double" ) PrimitiveType types2C false Constraint: name = "boolean" null CPrimitiveType->exists( p | p.ctypeId = typeId & p.name = "unsigned char" ) PrimitiveType types2C false Constraint: name = "String" null CPointerType->exists( t | t.ctypeId = typeId & CPrimitiveType->exists( p | p.name = "char" & t.pointsTo = p ) ) PrimitiveType types2C false Constraint: name = "void" null CPrimitiveType->exists( p | p.ctypeId = typeId & p.name = "void" ) PrimitiveType types2C false Constraint: null true CPointerType->exists( p | p.ctypeId = typeId & CStruct->exists( c | c.name = name & c.ctypeId = name & p.pointsTo = c ) ) Entity types2C false Constraint: name = "Sequence" null CArrayType->exists( a | a.ctypeId = typeId & a.duplicates = true & a.componentType = CType@pre[elementType.typeId] ) CollectionType types2C false Constraint: name = "Set" null CArrayType->exists( c | c.ctypeId = typeId & c.duplicates = false & c.componentType = CType@pre[elementType.typeId] ) CollectionType types2C false GeneralUseCase: program2C false Constraint: p : ownedAttribute & p.name.size > 0 null CStruct->exists( c | c.name = name & CMember->exists( m | m.name = p.name & m.isKey = p.isUnique & m.type = CType@pre[p.type.typeId] & m : c.members ) ) Entity program2C false Constraint: null true COperation->exists( op | op.name = name & op.scope = "entity" & op.isQuery = isQuery & op.text = text & op.returnType = CType[type.typeId] & CVariable->exists( s | s.name = "self" & s.type = CType[owner.typeId] & s : op.parameters ) & parameters->forAll( p | CVariable->exists( v | v.name = p.name & v.type = CType[p.type.typeId] & v : op.parameters ) ) ) Operation program2C false Constraint: null true CMember->exists( m | m.name = "super" & CStruct->exists( sub | sub.name = specific.name & m : sub.members & m.type = CPointerType[general.typeId] ) ) Generalization program2C false Constraint: null true CProgram->exists( p | p.structs = CStruct.allInstances & p.operations = COperation.allInstances ) null program2C false