Difference between revisions of "Help:UML"

From Wiki4Intranet
Jump to: navigation, search
(Массовая правка: замена PCRE \n{3,}<noinclude>\[\[Category:Справка\]\]</noinclude> на <noinclude>Category:Справка</noinclude>)
 
(4 intermediate revisions by 4 users not shown)
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>
 +
 
 +
Пример графа:
 +
{{Annotated|
 +
<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>
 +
|<code-xml>
 +
<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>
 +
</code-xml>
 +
|Разметка}}
 +
 
 +
= [http://www.umlgraph.org/ UMLGraph] =
 +
 
 +
== Диаграммы классов ==
 
<code-java>
 
<code-java>
 
/**
 
/**
Line 18: Line 118:
 
<umlgraph>
 
<umlgraph>
 
/**
 
/**
* @opt nodefontcolor "blue"
+
* @opt nodefontcolor «blue»
 
*/
 
*/
class Person {  
+
class Person {
 
         String    Name;
 
         String    Name;
 
}
 
}
 
      
 
      
class Employee extends Person {}
+
class Employee extends Person {}
  
 
class Client extends Person {}
 
class Client extends Person {}
 
</umlgraph>
 
</umlgraph>
 
 
 
  
 
<umlgraph>
 
<umlgraph>
Line 38: Line 135:
  
 
/**
 
/**
* @composed 1 - 4 Tyre
+
* @composed 1 4 Tyre
* @composed 1 - 1 Engine
+
* @composed 1 1 Engine
* @composed 1 - 1 Body
+
* @composed 1 1 Body
 
*/
 
*/
 
class Car {}
 
class Car {}
Line 47: Line 144:
  
 
<code-java>
 
<code-java>
 
  
 
class Tyre {}
 
class Tyre {}
Line 61: Line 157:
  
 
</code-java>
 
</code-java>
 
 
 
 
 
  
 
<code-java>
 
<code-java>
Line 125: Line 216:
 
</umlgraph>
 
</umlgraph>
  
 
+
=== Большой пример ===
===Большой пример===
+
  
 
<umlgraph>
 
<umlgraph>
Line 197: Line 287:
 
</umlgraph>
 
</umlgraph>
  
===Generalisation Relationships===
+
=== Generalisation Relationships ===
  
 
<umlgraph>
 
<umlgraph>
 
 
 
/*
 
/*
 
  * Generalisation
 
  * Generalisation
Line 229: Line 317:
 
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 343:
 
  * @navassoc - - - PowerManager
 
  * @navassoc - - - PowerManager
 
  */
 
  */
class SetTopController implements URLStreamHandler {
+
class SetTopController implements URLStreamHandler {
 
int authorizationLevel;
 
int authorizationLevel;
 
void startUp() {}
 
void startUp() {}
Line 264: Line 350:
 
}
 
}
  
/** @depend - <friend> - SetTopController */
+
/** @depend <friend> SetTopController */
 
class ChannelIterator {}
 
class ChannelIterator {}
  
Line 273: Line 359:
 
void toExternalForm();
 
void toExternalForm();
 
}
 
}
 +
</umlgraph>
  
 +
=== Relationships Inference ===
  
</umlgraph>
 
 
===Relationships Inference===
 
 
<umlgraph>
 
<umlgraph>
 
 
 
import java.util.List;
 
import java.util.List;
 
import java.util.Map;
 
import java.util.Map;
Line 314: Line 397:
 
Person owner;
 
Person owner;
 
}
 
}
 
  
 
</umlgraph>
 
</umlgraph>
  
===Schema===
+
=== Schema ===
 +
 
 
<umlgraph>
 
<umlgraph>
 
  
 
/*
 
/*
Line 391: Line 473:
 
Name name;
 
Name name;
 
}
 
}
 
  
 
</umlgraph>
 
</umlgraph>
  
===Element Visibility===
+
=== Element Visibility ===
 +
 
 
<umlgraph>
 
<umlgraph>
 
  
 
/**
 
/**
Line 424: Line 505:
 
private void compact() {}
 
private void compact() {}
 
}
 
}
 
  
 
</umlgraph>
 
</umlgraph>
  
===Association Types===
+
=== Association Types ===
 +
 
 
<umlgraph>
 
<umlgraph>
 
  
 
/**
 
/**
Line 439: Line 519:
 
  * @hidden
 
  * @hidden
 
  */
 
  */
class UMLOptions {}  
+
class UMLOptions {}
  
/** @assoc * - "*\n\n+user " User */
+
/** @assoc * "*\n\n+user " User */
 
class UserGroup {}
 
class UserGroup {}
  
/** @navassoc "1\n\n+owner\r" - "*\n\n+key" Password */
+
/** @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>
+
  
 +
<umlgraph>
  
 
/*
 
/*
Line 480: Line 559:
 
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 593:
 
/** @stereotype query */
 
/** @stereotype query */
 
int length() {};
 
int length() {};
/** @stereotype "helper functions" */
+
/** @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 639:
 
/** @hidden */
 
/** @hidden */
 
class ColorValue{}
 
class ColorValue{}
 
  
 
</umlgraph>
 
</umlgraph>
  
==Еще пример==
+
== Еще пример ==
  
 
<umlgraph>
 
<umlgraph>
 
/**
 
/**
* @assoc * - 1 Aeroport
+
* @assoc * 1 Aeroport
* @assoc * - 1 Aeroport
+
* @assoc * 1 Aeroport
* @assoc * - 1 PlaneModel
+
* @assoc * 1 PlaneModel
* @assoc * - 1 Company
+
* @assoc * 1 Company
*/
+
* /
 
class Race {
 
class Race {
 
  public DateTime dtime_depart_local;
 
  public DateTime dtime_depart_local;
Line 584: Line 660:
  
 
/**
 
/**
* @has 1 - 1..* Town
+
* @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 1 - 1..* PlacesBlock
+
* @composed 1 1..* PlacesBlock
*/
+
* /
 
class PlaneModel {
 
class PlaneModel {
 
  public Name name;
 
  public Name name;
Line 600: Line 675:
  
 
/**
 
/**
* @assoc * - 1 PlaceType
+
* @assoc * 1 PlaceType
*/
+
* /
 
class PlacesBlock {
 
class PlacesBlock {
 
  public int count;
 
  public int count;
Line 613: Line 688:
 
  public Name  name_eng;
 
  public Name  name_eng;
 
}
 
}
 
  
 
/**
 
/**
* @assoc * - 1 Company
+
* @assoc * 1 Company
* @assoc * - 1 Race
+
* @assoc * 1 Race
*/
+
* /
 
class Tariff {
 
class Tariff {
 
  public Name name_rus;
 
  public Name name_rus;
Line 627: Line 701:
  
 
/**
 
/**
* @assoc * - 1 PlaceType
+
* @assoc * 1 PlaceType
* @assoc * - 1 Race
+
* @assoc * 1 Race
 
* @note Rest
 
* @note Rest
* of tickets
+
* of tickets
*/
+
* /
 
class Rest {
 
class Rest {
 
  public int count;
 
  public int count;
 
}
 
}
  
 
 
/**
 
/**
* @assoc * - 1 Town
+
* @assoc * 1 Town
*/
+
* /
 
class Aeroport{
 
class Aeroport{
 
   public Name code;
 
   public Name code;
Line 674: Line 747:
 
</umlgraph>
 
</umlgraph>
  
==Ссылки==
+
== Ссылки ==
 
* http://umlgraph.org Automated Drawing of UML Diagrams
 
* http://umlgraph.org Automated Drawing of UML Diagrams
  
[[Category: CustisWiki:Справка]]
+
<noinclude>[[Category:Справка]]</noinclude>
 
+
 
+
{{replicate-from-custiswiki-to-lib}}
+
{{replicate-from-custiswiki-to-tools}}
+

Latest revision as of 14:56, 1 September 2015

Можно автоматически рисовать UML-диаграммы классов по их текстовому описанию, причём с помощью двух расширений:

  • PlantUML — более удобный, чем UMLGraph, по собственному языку разметки.
  • UMLGraph — по близкому к описанию классов на языках типа Java/С#.

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 {}

 
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

Еще пример

Ссылки