Difference between revisions of "Help:UML"
Line 1: | Line 1: | ||
− | Можно автоматически рисовать UML-диаграммы классов по их текстовому описанию, | + | Можно автоматически рисовать UML-диаграммы классов по их текстовому описанию, причём с помощью двух расширений: |
− | близкому к описанию классов на языках типа Java/С#. | + | * [http://plantuml.sourceforge.net/ PlantUML] — более удобный, чем UMLGraph, по собственному языку разметки. |
+ | * [http://www.umlgraph.org/ UMLGraph] — по близкому к описанию классов на языках типа Java/С#. | ||
− | ==Диаграммы классов== | + | = [http://plantuml.sourceforge.net/ PlantUML] = |
+ | |||
+ | Полная справка по языку — [[Media:PlantUML Language Reference Guide.pdf]]. [[Файл:PlantUML Language Reference Guide.pdf|thumb|Справка по PlantUML]] | ||
+ | |||
+ | Синтаксис вставки — просто | ||
+ | <pre> | ||
+ | <uml> | ||
+ | ...код... | ||
+ | </uml> | ||
+ | </pre> | ||
+ | |||
+ | Пример графа: | ||
+ | |||
+ | <uml> | ||
+ | title Основной цикл — получение агрегированных проводок | ||
+ | |||
+ | autonumber "<b>[0]" | ||
+ | |||
+ | note left of МСФО: 1.1 | ||
+ | activate МСФО | ||
+ | МСФО -> Система: Запрос справочников | ||
+ | deactivate МСФО | ||
+ | |||
+ | note right of Система: 2.1 | ||
+ | activate Система | ||
+ | Система -> МСФО: Возврат справочников | ||
+ | deactivate Система | ||
+ | note left of МСФО: 1.2 | ||
+ | |||
+ | activate МСФО | ||
+ | МСФО -> Система: Запрос используемых аналитик | ||
+ | deactivate МСФО | ||
+ | note right of Система: 2.2 | ||
+ | activate Система | ||
+ | Система -> МСФО: Возврат используемых аналитик | ||
+ | deactivate Система | ||
+ | note left of МСФО: 1.3 | ||
+ | |||
+ | activate МСФО | ||
+ | МСФО -> Система: Запрос выгрузки/выгрузок | ||
+ | deactivate МСФО | ||
+ | note right of Система: 2.3 | ||
+ | activate Система | ||
+ | Система -> МСФО: Возврат выгрузки/выгрузок | ||
+ | deactivate Система | ||
+ | note left of МСФО: 1.4 | ||
+ | |||
+ | activate МСФО | ||
+ | МСФО -> Система: Результат выгрузки/выгрузок | ||
+ | deactivate МСФО | ||
+ | activate Система | ||
+ | note right of Система: 2.4 | ||
+ | </uml> | ||
+ | |||
+ | = [http://www.umlgraph.org/ UMLGraph] = | ||
+ | |||
+ | == Диаграммы классов == | ||
<code-java> | <code-java> | ||
/** | /** | ||
Line 18: | Line 75: | ||
<umlgraph> | <umlgraph> | ||
/** | /** | ||
− | * @opt nodefontcolor | + | * @opt nodefontcolor «blue» |
− | */ | + | * / |
− | class Person { | + | class Person { |
String Name; | String Name; | ||
} | } | ||
− | class Employee extends | + | class Employee extends Person {} |
class Client extends Person {} | class Client extends Person {} | ||
</umlgraph> | </umlgraph> | ||
− | |||
− | |||
− | |||
<umlgraph> | <umlgraph> | ||
Line 38: | Line 92: | ||
/** | /** | ||
− | * @composed | + | * @composed 1 — 4 Tyre |
− | * @composed | + | * @composed 1 — 1 Engine |
− | * @composed | + | * @composed 1 — 1 Body |
− | */ | + | * / |
class Car {} | class Car {} | ||
Line 47: | Line 101: | ||
<code-java> | <code-java> | ||
− | |||
class Tyre {} | class Tyre {} | ||
Line 61: | Line 114: | ||
</code-java> | </code-java> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
<code-java> | <code-java> | ||
Line 125: | Line 173: | ||
</umlgraph> | </umlgraph> | ||
− | + | === Большой пример === | |
− | ===Большой пример=== | + | |
<umlgraph> | <umlgraph> | ||
Line 197: | Line 244: | ||
</umlgraph> | </umlgraph> | ||
− | ===Generalisation Relationships=== | + | === Generalisation Relationships === |
<umlgraph> | <umlgraph> | ||
− | |||
− | |||
/* | /* | ||
* Generalisation | * Generalisation | ||
Line 229: | Line 274: | ||
class CheckingAccount extends BankAccount {} | class CheckingAccount extends BankAccount {} | ||
class SavingsAccount extends BankAccount {} | class SavingsAccount extends BankAccount {} | ||
− | |||
</umlgraph> | </umlgraph> | ||
− | ===Advanced Relationships=== | + | |
+ | === Advanced Relationships === | ||
<umlgraph> | <umlgraph> | ||
− | |||
− | |||
/* | /* | ||
* Advanced relationships | * Advanced relationships | ||
Line 257: | Line 300: | ||
* @navassoc - - - PowerManager | * @navassoc - - - PowerManager | ||
*/ | */ | ||
− | class | + | class SetTopController implements URLStreamHandler { |
int authorizationLevel; | int authorizationLevel; | ||
void startUp() {} | void startUp() {} | ||
Line 264: | Line 307: | ||
} | } | ||
− | /** @ | + | /** @depend — <friend> — SetTopController */ |
class ChannelIterator {} | class ChannelIterator {} | ||
Line 273: | Line 316: | ||
void toExternalForm(); | void toExternalForm(); | ||
} | } | ||
+ | </umlgraph> | ||
+ | === Relationships Inference === | ||
− | |||
− | |||
− | |||
<umlgraph> | <umlgraph> | ||
− | |||
− | |||
import java.util.List; | import java.util.List; | ||
import java.util.Map; | import java.util.Map; | ||
Line 314: | Line 354: | ||
Person owner; | Person owner; | ||
} | } | ||
− | |||
</umlgraph> | </umlgraph> | ||
− | ===Schema=== | + | === Schema === |
+ | |||
<umlgraph> | <umlgraph> | ||
− | |||
/* | /* | ||
Line 391: | Line 430: | ||
Name name; | Name name; | ||
} | } | ||
− | |||
</umlgraph> | </umlgraph> | ||
− | ===Element Visibility=== | + | === Element Visibility === |
+ | |||
<umlgraph> | <umlgraph> | ||
− | |||
/** | /** | ||
Line 424: | Line 462: | ||
private void compact() {} | private void compact() {} | ||
} | } | ||
− | |||
</umlgraph> | </umlgraph> | ||
− | ===Association Types=== | + | === Association Types === |
+ | |||
<umlgraph> | <umlgraph> | ||
− | |||
/** | /** | ||
Line 439: | Line 476: | ||
* @hidden | * @hidden | ||
*/ | */ | ||
− | class UMLOptions {} | + | class UMLOptions {} |
− | /** @assoc * | + | /** @assoc * — "*\n\n+user " User */ |
class UserGroup {} | class UserGroup {} | ||
− | /** @navassoc | + | /** @navassoc «1\n\n+owner\r» — «*\n\n+key» Password */ |
class User{} | class User{} | ||
class Password{} | class Password{} | ||
− | |||
</umlgraph> | </umlgraph> | ||
− | ===Real Example (Catalina Classes)=== | + | === Real Example (Catalina Classes) === |
− | + | ||
+ | <umlgraph> | ||
/* | /* | ||
Line 480: | Line 516: | ||
abstract interface ServletResponse {} | abstract interface ServletResponse {} | ||
abstract interface Response {} | abstract interface Response {} | ||
− | |||
</umlgraph> | </umlgraph> | ||
− | ===Class Stereotypes and Tagged Values=== | + | === Class Stereotypes and Tagged Values === |
+ | |||
<umlgraph> | <umlgraph> | ||
− | |||
/* | /* | ||
Line 515: | Line 550: | ||
/** @stereotype query */ | /** @stereotype query */ | ||
int length() {}; | int length() {}; | ||
− | /** @stereotype | + | /** @stereotype «helper functions» */ |
void reorder() {}; | void reorder() {}; | ||
} | } | ||
− | |||
</umlgraph> | </umlgraph> | ||
− | ===Fonts, Colors, Global and Local Options=== | + | === Fonts, Colors, Global and Local Options === |
+ | |||
<umlgraph> | <umlgraph> | ||
− | |||
/** | /** | ||
Line 562: | Line 596: | ||
/** @hidden */ | /** @hidden */ | ||
class ColorValue{} | class ColorValue{} | ||
− | |||
</umlgraph> | </umlgraph> | ||
− | ==Еще пример== | + | == Еще пример == |
<umlgraph> | <umlgraph> | ||
/** | /** | ||
− | * @assoc * | + | * @assoc * — 1 Aeroport |
− | * @assoc * | + | * @assoc * — 1 Aeroport |
− | * @assoc * | + | * @assoc * — 1 PlaneModel |
− | * @assoc * | + | * @assoc * — 1 Company |
− | */ | + | * / |
class Race { | class Race { | ||
public DateTime dtime_depart_local; | public DateTime dtime_depart_local; | ||
Line 584: | Line 617: | ||
/** | /** | ||
− | * @has | + | * @has 1 — 1..* Town |
− | */ | + | * / |
class Country { | class Country { | ||
public Name name_rus; | public Name name_rus; | ||
public Name name_eng; | public Name name_eng; | ||
} | } | ||
− | |||
/** | /** | ||
− | * @composed | + | * @composed 1 — 1..* PlacesBlock |
− | */ | + | * / |
class PlaneModel { | class PlaneModel { | ||
public Name name; | public Name name; | ||
Line 600: | Line 632: | ||
/** | /** | ||
− | * @assoc * | + | * @assoc * — 1 PlaceType |
− | */ | + | * / |
class PlacesBlock { | class PlacesBlock { | ||
public int count; | public int count; | ||
Line 613: | Line 645: | ||
public Name name_eng; | public Name name_eng; | ||
} | } | ||
− | |||
/** | /** | ||
− | * @assoc * | + | * @assoc * — 1 Company |
− | * @assoc * | + | * @assoc * — 1 Race |
− | */ | + | * / |
class Tariff { | class Tariff { | ||
public Name name_rus; | public Name name_rus; | ||
Line 627: | Line 658: | ||
/** | /** | ||
− | * @assoc * | + | * @assoc * — 1 PlaceType |
− | * @assoc * | + | * @assoc * — 1 Race |
* @note Rest | * @note Rest | ||
− | * | + | * of tickets |
− | */ | + | * / |
class Rest { | class Rest { | ||
public int count; | public int count; | ||
} | } | ||
− | |||
/** | /** | ||
− | * @assoc * | + | * @assoc * — 1 Town |
− | */ | + | * / |
class Aeroport{ | class Aeroport{ | ||
public Name code; | public Name code; | ||
Line 651: | Line 681: | ||
class CharterRace extends Race {}; | class CharterRace extends Race {}; | ||
− | // | + | //Ниже — настройки диаграммы, не трогать и не обращать внимание! |
/** | /** | ||
* @hidden | * @hidden | ||
Line 674: | Line 704: | ||
</umlgraph> | </umlgraph> | ||
− | ==Ссылки== | + | == Ссылки == |
* http://umlgraph.org Automated Drawing of UML Diagrams | * http://umlgraph.org Automated Drawing of UML Diagrams | ||
− | [[ | + | [[Категория:Справка]] |
− | + | ||
− | + | ||
{{replicate-from-custiswiki-to-lib}} | {{replicate-from-custiswiki-to-lib}} | ||
{{replicate-from-custiswiki-to-tools}} | {{replicate-from-custiswiki-to-tools}} |
Revision as of 15:22, 15 September 2011
Можно автоматически рисовать UML-диаграммы классов по их текстовому описанию, причём с помощью двух расширений:
- PlantUML — более удобный, чем UMLGraph, по собственному языку разметки.
- UMLGraph — по близкому к описанию классов на языках типа Java/С#.
Contents
- 1 PlantUML
- 2 UMLGraph
- 2.1 Диаграммы классов
- 2.1.1 Большой пример
- 2.1.2 Generalisation Relationships
- 2.1.3 Advanced Relationships
- 2.1.4 Relationships Inference
- 2.1.5 Schema
- 2.1.6 Element Visibility
- 2.1.7 Association Types
- 2.1.8 Real Example (Catalina Classes)
- 2.1.9 Class Stereotypes and Tagged Values
- 2.1.10 Fonts, Colors, Global and Local Options
- 2.2 Еще пример
- 2.3 Ссылки
- 2.1 Диаграммы классов
PlantUML
Полная справка по языку — Media:PlantUML Language Reference Guide.pdf. thumb|Справка по PlantUML
Синтаксис вставки — просто
<uml> ...код... </uml>
Пример графа:
UMLGraph
Диаграммы классов
/** * @opt nodefontcolor "blue" */ class Person { String Name; } class Employee extends Person {} class Client extends Person {}
Loading source file /vol/md0/sites/tools/www/images/generated/umlgraph/b/bd/bd20a3b8628d98c3d3553da0e63fa5b7/umlgraph.source.java... /vol/md0/sites/tools/www/images/generated/umlgraph/b/bd/bd20a3b8628d98c3d3553da0e63fa5b7/umlgraph.source.java:2: unclosed comment /** ^ 1 error
Loading source file /vol/md0/sites/tools/www/images/generated/umlgraph/7/7d/7dc5a240f4310546463419b360d90ca6/umlgraph.source.java... /vol/md0/sites/tools/www/images/generated/umlgraph/7/7d/7dc5a240f4310546463419b360d90ca6/umlgraph.source.java:6: unclosed comment /** ^ 1 error
class Tyre {} class Engine {} class Body {} /** * @composed 1 - 4 Tyre * @composed 1 - 1 Engine * @composed 1 - 1 Body */ class Car {}
/** * @opt shape node * @note Located in the * machine room * @note Sun Blade 6048 * @depend - - - MapLocation * @depend - - - DataMine */ class Server{} /** @opt shape component */ class MapLocation {} /** @opt shape component */ class DataMine {} /** * CPU-munching * components that must * run on this server * @opt shape note * @opt commentname * @assoc - - - MapLocation * @assoc - - - DataMine */ class munchComment {}
Большой пример
Generalisation Relationships
Advanced Relationships
Relationships Inference
Schema
Element Visibility
Association Types
Real Example (Catalina Classes)
Class Stereotypes and Tagged Values
Fonts, Colors, Global and Local Options
Еще пример
Ссылки
- http://umlgraph.org Automated Drawing of UML Diagrams
Внимание! Данная статья выбрана для репликации во внешнюю базу знаний компании. Пожалуйста, не допускайте в этой статье публикацию конфиденциальной информации, ведения обсуждений в теле статьи, и более ответственно относитесь к качеству самой статьи — проверяйте орфографию, пишите по-русски, избегайте непроверенной вами информации.
Статья отреплицирована из внутренней базы знаний компании.