Tomsovi

  • Zvětšit velikost písma
  • Výchozí velikost písma
  • Zmenšit velikost písma
Domů Honza Škola 5. ročník Diplomová práce - Automatizované modelování - G Zdrojový kód aplikace DecisionMaker

Diplomová práce - Automatizované modelování - G Zdrojový kód aplikace DecisionMaker

Email Tisk PDF
seznam článků
Diplomová práce - Automatizované modelování
Obsah
1 Úvod
1.2 Typografické konvence
Tabulka 1: Slovník zkratek
2 Cíl práce
3 Metodika
4 Přehled vlastností modelovacích nástrojů
4.1 Úloha modelování v běžném životě
4.1 Úloha modelování v běžném životě - pokračování
4.1.1 Vhodnost použití objektových nástrojů pro modelování a transformace
4.2 Architektura řízená modelem - Model Driven Architecture
4.2.1 The Object Management Group
4.2.2 Základní cíle a přístupy MDA
4.2.3 Platforma
4.2.4 Hierarchie modelů dle MDA
4.2.5 Model nezávislý na počítačovém zpracování
4.2.6 Model nezávislý na platformě
4.2.7 Mapování a značkování
4.2.8 Model specifický ke konkrétní platformě
4.2.9 Zdrojový kód aplikace
4.3 MDA a Oracle Designer
4.4 Vlastní zkušenost
4.5 Vlastnosti modelovacích nástrojů
4.6 Craft.CASE
4.7 Eclipse Modeling Framework
4.8 Omondo EclipseUML2
4.9 Enterprise Architect
5 Transformační modelovací jazyky
5.2 Eclipse Modelling Framework
5.4 XSLT
Část II - Projekt
6 Vlastní projekt
7 Požadavky na informační systém
8 Analýza
8.1 Model případů užití
8.2 Doménový objektový model
9 Design informačního systému
10 Aplikace Architektury řízené modelem (MDA)
11 Vývoj generátoru
12 Generování kódu z modelu
13 Závěr
Literatura
Přílohy
A Případy užití
A.1 Hlavní případy užití
A.2 Správa skupin parametrů
A.3 Správa parametrů
A.4 Správa modelů
B Sada šablon EA pro generování kódu v jazyku Smalltalk
C Vygenerované zdrojové kódy FSM v jazyku Smalltalk
D UML profil systému DecisionMaker
E Podpůrné třídy metamodelu UML
F Generátor entit aplikace DecisionMaker
G Zdrojový kód aplikace DecisionMaker
Všechny strany

G Zdrojový kód aplikace DecisionMaker

G.1 Iterace 1 - psáno ručně

WAFileLibrary subclass: #DMFileLibrary
   instanceVariableNames: ''
   classVariableNames: ''
   poolDictionaries: ''
   category: 'DecisionMaker'
DMFileLibrary methodsFor: 'uploaded' stamp: 'JanTomsa 4/3/2010 03:32'
dmCss 
   ^'
   .dmEditor { display: table; }
   .dmEditor > div { display: table-row; }
   .dmEditor > div > * { display: table-cell; }
   .dmEditor textArea { height: 4em; width: 30em; }
   .dmEditor div.hidden { display: none; }
 
   body { 
      font-family: Georgia, "Times New Roman", Times, serif; 
      font-size: small; 
   } 
 
   #allcontent { 
      width: 770px; 
      padding-top: 5px; 
      padding-bottom: 5px; 
      background-color: #f4e8d7; 
      margin-left: auto; 
      margin-right: auto; 
   }
 
   *.section { 
      background-color: #f1dfc7; 
   }
 
   #header { 
      margin: 10px;
   }
 
   #main { 
      padding: 15px; 
      margin: 0px 10px 10px 10px; 
      width: 550px; 
      float: right; 
   }
 
   #sidebar { 
      padding: 15px; 
      margin: 0px 600px 10px 10px;
   }
 
   #footer { 
      color: #704620; 
      text-align: center; 
      padding: 15px; 
      margin: 10px; 
      clear: right;
   }'.
DMFileLibrary methodsFor: 'uploaded'
dmJpg
   ^ #(255 216 255 224 0 16 74 70 73 70 ...) asByteArray
WAComponent subclass: #DMHome
   instanceVariableNames: ''
   classVariableNames: ''
   poolDictionaries: ''
   category: 'DecisionMaker'
DMHome methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/3/2010 03:35'
renderContentOn: canvas
 
   canvas image 
      altText: 'Kombajn GLEANER L2'; 
      url: DMFileLibrary / 'dm.jpg'; 
      yourself.

WAComponent subclass: #DMMain
   instanceVariableNames: 'mainArea'
   classVariableNames: ''
   poolDictionaries: ''
   category: 'DecisionMaker'
DMMain methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/6/2010 00:02'
children
 
   ^Array with: mainArea.
DMMain methodsFor: 'as yet unclassified' stamp: 'JanTomsa 3/28/2010 00:59'
initialize 
 
   super initialize. 
   mainArea := DMHome new.
DMMain methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/6/2010 00:01'
renderContentOn: canvas 
   canvas div 
      id: 'allcontent'; 
      with: [
         self renderHeaderOn: canvas; 
         renderMainOn: canvas; 
         renderSidebarOn: canvas; 
         renderFooterOn: canvas; 
         yourself.
      ].
DMMain methodsFor: 'as yet unclassified' stamp: 'JanTomsa 3/27/2010 23:58'
renderFooterOn: canvas 
   canvas div 
      id: 'footer'; 
      class: 'section'; 
      with: [ 
         canvas text: 'Copyright (c) ' , Date today year printString.
      ]; 
   yourself.
DMMain methodsFor: 'as yet unclassified' stamp: 'JanTomsa 3/27/2010 23:55'
renderHeaderOn: canvas 
 
   canvas div 
      id: 'header'; 
      class: 'section'; 
      with: [ 
         canvas heading 
            level1; 
            with: 'Decision Maker'; "Title on the front page"
            yourself. 
         ]; 
      yourself.
DMMain methodsFor: 'as yet unclassified' stamp: 'JanTomsa 3/28/2010 01:01'
renderMainOn: canvas
 
   canvas div 
      id: 'main'; 
      class: 'section'; 
      with: [canvas render: mainArea ].
DMMain methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/6/2010 01:00'
renderSidebarOn: canvas 
   canvas div 
      id: 'sidebar'; 
      class: 'section'; 
      with: [ 
         canvas heading 
            level2; 
            with: DMTexts MENU.
         canvas anchor
            callback: [ mainArea := DMHome new ];
            with: DMTexts HOME.
         canvas break .
         canvas anchor
            callback: [ mainArea := DMModelCRUD new ];
            with: (DMModelTexts labelFor: #Models).
         "========= call GENERATED classes ========"
         canvas break .
         canvas anchor
            callback: [ mainArea := DXEquationCRUD new ];
            with: (DXEquationTexts labelFor: #Instances).
         canvas break .
         canvas anchor
            callback: [ mainArea := DXVariableCRUD new ];
            with: (DXVariableTexts labelFor: #Instances).
         canvas break .
         canvas anchor
            callback: [ mainArea := DXParamGroupCRUD new ];
            with: (DXParamGroupTexts labelFor: #Instances).
         canvas break .
         canvas anchor
            callback: [ mainArea := DXParameterCRUD new ];
            with: (DXParameterTexts labelFor: #Instances).
         "======== /call GENERATED classes ========"
      ]; 
   yourself.
DMMain methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/6/2010 00:02'
updateRoot: anHtmlRoot 
   super updateRoot: anHtmlRoot. 
   anHtmlRoot title: 'Decision Maker'. "Window title"
   anHtmlRoot link
      type: 'text/css';
      beStylesheet ;
      addAll;
      url: DMFileLibrary / 'dm.css';
      yourself .

DMMain class
   instanceVariableNames: ''
DMMain class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/3/2010 03:34'
description 
   ^'Podpora rozhodovani na zaklade matematickych modelu.'.
DMMain class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 3/27/2010 23:33'
initialize
"
   DMMain initialize.
"
   super initialize. 
   (self registerAsApplication: 'DecisionMaker')
      preferenceAt: #sessionClass 
      put: WASession; 
      yourself.
 Object subclass: #DMModel
   instanceVariableNames: 'modelName description optimisationType objective'
   classVariableNames: ''
   poolDictionaries: ''
   category: 'DecisionMaker'
DMModel methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/5/2010 22:38'
<= anObject
         ^self modelName<= anObject modelName
DMModel methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/5/2010 22:38'
buildStandardLPProblem
         Transcript cr.
DMModel methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/5/2010 22:38'
description
         ^description
DMModel methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/5/2010 22:38'
description: anObject
         description := anObject
DMModel methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/5/2010 22:39'
initialize
 
   super initialize.
   modelName := 'Model #', (self class models size + 1) asString.
   description := 'Popis modelu.'. "TODO: Maybe add short help here?"
   optimisationType := self optimisationTypeList first.
DMModel methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/5/2010 22:38'
modelName
         ^modelName
DMModel methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/5/2010 22:38'
modelName: anObject
         modelName := anObject
DMModel methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/5/2010 22:38'
objective
         ^objective
DMModel methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/5/2010 22:38'
objective: anObject
         objective := anObject
DMModel methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/5/2010 22:38'
optimisationType
         ^optimisationType
DMModel methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/5/2010 22:38'
optimisationType: anObject
         optimisationType := anObject
DMModel methodsFor: 'as yet unclassified' stamp: 'JanTomsa 3/28/2010 03:47'
optimisationTypeList
 
   ^#( 'Maximize' 'Minimize' ).
DMModel methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/5/2010 22:38'
solution
         Transcript cr.

DMModel class
   instanceVariableNames: 'models instances'
DMModel class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/4/2010 00:19'
createModels
"
   DMModel createModels
"
 
   models := nil.
   self models 
      add: (self new 
         modelName: 'Co máme pestovat?'; 
         description: 'Máme pestovat brambory nebo obilí?'; 
         optimisationType: 'Maximize'; 
         yourself); 
      add: (self new 
         modelName: 'Model #2'; 
         description: 'Description of model #2'; 
         optimisationType: 'Maximize' first; 
         yourself); 
      add: (self new 
         modelName: 'Model #3'; 
         Description: 'Description of model #3'; 
         optimisationType: 'Maximize' first; 
         yourself); 
      yourself.
DMModel class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/5/2010 22:38'
instances
         instances ifNil: [ instances := IdentitySet new ].
                              ^instances
DMModel class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 3/28/2010 00:09'
models
 
   models ifNil: [ models := IdentitySet new ].
   ^models .
 
WAComponent subclass: #DMModelCRUD
   instanceVariableNames: 'listComponent'
   classVariableNames: ''
   poolDictionaries: ''
   category: 'DecisionMaker'
DMModelCRUD methodsFor: 'columns' stamp: 'JanTomsa 4/2/2010 22:43'
actionReportColumn
 
   ^WAReportColumn new
      title: DMTexts ACTIONS;
      valueBlock: [ :aModel :html | 
         html anchor 
            onClick: ('return confirm(''', DMTexts CONFIRMQUESTION, ''')');
            callback: [ self delete: aModel  ];
            with: DMTexts DELETE
      ];
      yourself .
DMModelCRUD methodsFor: 'columns' stamp: 'JanTomsa 4/2/2010 22:37'
descriptionReportColumn
 
   ^WAReportColumn new
      title: (DMModelTexts labelFor: #description);
      selector: #description;
      clickBlock: nil;
      yourself .
DMModelCRUD methodsFor: 'columns' stamp: 'JanTomsa 4/2/2010 22:36'
modelNameReportColumn
 
   ^WAReportColumn new
      title: (DMModelTexts labelFor: #modelName);
      selector: #modelName;
      clickBlock: [ :each | self edit: each ];
      yourself .
DMModelCRUD methodsFor: 'columns' stamp: 'JanTomsa 4/2/2010 22:36'
optimisationTypeReportColumn
 
   ^WAReportColumn new
      title: (DMModelTexts labelFor: #optimisationType);
      selector: #optimisationType;
      clickBlock: nil;
      yourself .
DMModelCRUD methodsFor: 'data management' stamp: 'JanTomsa 4/5/2010 23:57'
add
 
   | editor instance answer |
   instance := DMModel new.
   editor := DMModelEditor on: instance.
   answer := self call: editor.
   answer 
      ifTrue: [ 
         DMModel models add: instance.
      ].
DMModelCRUD methodsFor: 'data management' stamp: 'JanTomsa 3/28/2010 00:48'
delete: aModel
 
   DMModel models remove: aModel .
DMModelCRUD methodsFor: 'data management' stamp: 'JanTomsa 3/28/2010 03:31'
edit: aModel
 
   | editor |
   editor := DMModelEditor on: aModel .
   self call: editor.
DMModelCRUD methodsFor: 'as yet unclassified' stamp: 'JanTomsa 3/28/2010 00:45'
children
 
   ^Array with: listComponent .
DMModelCRUD methodsFor: 'as yet unclassified' stamp: 'JanTomsa 3/28/2010 00:44'
initialize
 
   | columns |
   super initialize .
   columns := OrderedCollection new
      add: self modelNameReportColumn; 
      add: self descriptionReportColumn; 
      add: self optimisationTypeReportColumn;
      add: self actionReportColumn;
      yourself .
   listComponent := WATableReport new
      columns: columns ;
      rowPeriod: 1;
      yourself .
DMModelCRUD methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/5/2010 01:10'
renderContentOn: canvas
 
   canvas heading with: (DMModelTexts labelFor: #Models);
      level: 3.
   listComponent rows: DMModel models asSortedCollection .
   canvas render: listComponent .
   canvas anchor
      callback: [ self add ];
      with: DMTexts NEW.

WAComponent subclass: #DMModelEditor
   instanceVariableNames: 'model'
   classVariableNames: ''
   poolDictionaries: ''
   category: 'DecisionMaker'
DMModelEditor methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/5/2010 22:38'
initialize: anInstance
         self initialize.
model := anInstance.
DMModelEditor methodsFor: 'rendering' stamp: 'JanTomsa 4/5/2010 22:38'
renderButtonsOn: canvas
   canvas div: [
      canvas span: [
         canvas cancelButton callback: [self answer: false];
            with: DMTexts CANCEL.
      ].
      canvas span: [
         canvas submitButton callback: [self answer: true];
            with: DMTexts SAVE.
      ].
   ].
DMModelEditor methodsFor: 'rendering' stamp: 'JanTomsa 4/5/2010 22:38'
renderContentOn: canvas
   canvas form
   class: 'dmEditor';
   with: [
      self
         renderModelNameOn: canvas;
         renderDescriptionOn: canvas;
         renderOptimisationTypeOn: canvas;
         renderButtonsOn: canvas;
         yourself.
   ].
DMModelEditor methodsFor: 'rendering' stamp: 'JanTomsa 4/5/2010 22:38'
renderDescriptionOn: canvas
         | tagID |
canvas div: [
   canvas label
      for: (tagID := canvas nextId);
      with: (DMModelTexts labelFor: #description).
   canvas textArea
      id: tagID;
      value: model description;
      callback: [ :value | model description: value ]
].
DMModelEditor methodsFor: 'rendering' stamp: 'JanTomsa 4/5/2010 22:38'
renderModelNameOn: canvas
         | tagID |
canvas div: [
   canvas label
      for: (tagID := canvas nextId);
      with: (DMModelTexts labelFor: #modelName).
   canvas textInput
      value: model modelName;
      callback: [:value | model modelName: value]
].
DMModelEditor methodsFor: 'rendering' stamp: 'JanTomsa 4/6/2010 01:28'
renderOptimisationTypeOn: canvas
         | tagID |
canvas div: [
   canvas label
      for: (tagID := canvas nextId);
      with: (DMModelTexts labelFor: #optimisationType).
   canvas select
      id: tagID;
      name: tagID;
      selected: model optimisationType;
      list: model optimisationTypeList;
      callback: [ :value | model optimisationType: value ].
].

DMModelEditor class
   instanceVariableNames: ''
DMModelEditor class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/5/2010 22:38'
on: anInstance
   ^self basicNew
      initialize: anInstance;
      yourself.
Object subclass: #DMModelTexts
   instanceVariableNames: ''
   classVariableNames: ''
   poolDictionaries: ''
   category: 'DecisionMaker'

DMModelTexts class
   instanceVariableNames: 'labels'
DMModelTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:45'
labelFor: aSymbol
   ^self labelFor: aSymbol inLanguage: (DMTexts defaultLanguage).
DMModelTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/4/2010 09:29'
labelFor: aSymbol inLanguage: language
   ^(self labels at: language) at: aSymbol.
DMModelTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/4/2010 09:24'
labels 
   | labelsCzech labelsEnglish |
   labels ifNil: [ 
      labelsCzech := Dictionary new.
      labelsEnglish := Dictionary new.
      labelsCzech add: #modelName->'Název'.
      labelsEnglish add: #modelName->'Name'.
      labelsCzech add: #description->'Popis'.
      labelsEnglish add: #description->'Description'.
      labelsCzech add: #optimisationType->'Typ optimalizace'.
      labelsEnglish add: #optimisationType->'Optimisation type'.
      labelsCzech add: #Models->'Modely'.
      labelsEnglish add: #Models->'Models'.
      labels := Dictionary new.
      labels add: #czech->labelsCzech.
      labels add: #english->labelsEnglish.
   ].
   ^labels.
Object subclass: #DMTexts
   instanceVariableNames: ''
   classVariableNames: ''
   poolDictionaries: ''
   category: 'DecisionMaker'

DMTexts class
   instanceVariableNames: ''
DMTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:40'
ACTIONS
   ^self ACTIONS: (self defaultLanguage)
DMTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:40'
ACTIONS: language
   ^(language = #czech) 
      ifTrue: ['Akce']
      ifFalse: ['Actions'].
DMTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:15'
CANCEL
   ^self CANCEL: (self defaultLanguage)
DMTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:10'
CANCEL: language
   ^(language = #czech) 
      ifTrue: ['Zrušit']
      ifFalse: ['Cancel'].
DMTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:42'
CONFIRMQUESTION
   ^self CONFIRMQUESTION: (self defaultLanguage)
DMTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:42'
CONFIRMQUESTION: language
   ^(language = #czech) 
      ifTrue: ['Opravdu?']
      ifFalse: ['Are you sure?'].
DMTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:43'
DELETE
   ^self DELETE: (self defaultLanguage)
DMTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:43'
DELETE: language
   ^(language = #czech) 
      ifTrue: ['Smazat']
      ifFalse: ['Delete'].
DMTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:19'
HOME
   ^self HOME: (self defaultLanguage)
DMTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:19'
HOME: language
   ^(language = #czech) 
      ifTrue: ['Úvod']
      ifFalse: ['Home'].
DMTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:20'
MENU
   ^self MENU: (self defaultLanguage)
DMTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:20'
MENU: language
   ^(language = #czech) 
      ifTrue: ['Nabídka']
      ifFalse: ['Menu'].
 DMTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:15'
NEW
   ^self NEW: (self defaultLanguage)
DMTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:13'
NEW: language
   ^(language = #czech) 
      ifTrue: ['Nový']
      ifFalse: ['New'].
DMTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:14'
SAVE
   ^self SAVE: (self defaultLanguage)
DMTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:11'
SAVE: language
   ^(language = #czech) 
      ifTrue: ['Uložit']
      ifFalse: ['Save'].
DMTexts class methodsFor: 'as yet unclassified' stamp: 'JanTomsa 4/2/2010 22:45'
defaultLanguage
"   ^#english"
   ^#czech
DMMain initialize