📄 4classes.html
字号:
类复制)
<li><b>FlightDescription --</b> <b>departureTime</b>, <b>arrivalTime </b>(下一节中再增加 <b>capacity</b>
特性.)
<li><b>Flight --</b> <b>date</b>
<li><b>Ticket --</b> <b>basePrice</b>
</ol>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p></p>
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#cccccc">
<tr>
<td bgcolor="#bbbbbb">
<table border="0" cellpadding="5" cellspacing="2">
<tr>
<td bgcolor="white" valign="top">如果类节点太小无法显示所有成员,
Together
将显示一个垂直滚动条.<p>你可以拖动类节点的边界以便修改其大小.
也可以从它的右键菜单中执行
"Actual Size"
来为它自动设置大小以显示所有成员.</p>
<p>希望修改类成员顺序吗?
拖动它们就可以了.</p>
</td>
<td bgcolor="white" valign="top"><img src="images/airline/noderesize.png" width="133" height="105" border="0" alt="Class node" hspace="5"></td>
</tr>
</table>
</td>
</tr>
</table>
<p>
<hr>
<p class="head3"><a name="operations"></a>增加操作
</p>
<p>增加操作的技术与增加特性一样.
快捷键是 Ctrl+O.</p>
<table border="0" cellpadding="0" cellspacing="2" bgcolor="#993300" width="100%">
<tr>
<td bgcolor="#993300">
<table border="0" cellpadding="0" cellspacing="2" bgcolor="#ffffcc" width="100%">
<tr>
<td bgcolor="#ffffcc"><b>操作步骤:</b>
在 <b>Flight</b>
中增加一个无返回值的操作,
命名为 <b>makeReservation</b>.
为这个操作设置两个参数:
<ol>
<li><b>name</b>, 类型为 <b>String</b>,
表示乘客姓名.
<li><b>tKind</b>, 类型为 <b>int</b>,
表示机票类型.
</ol>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>模型图节点中操作的内嵌编辑器可以接受
UML 风格的输入(名称在前,
类型在后)或者 Java/C++
风格的输入(类型在前,
名称在后).
下图列出了其区别.</p>
<dl>
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#cccccc">
<tr>
<td bgcolor="#bbbbbb">
<table border="0" cellpadding="5" cellspacing="2">
<tr>
<td bgcolor="white" valign="top"><b>风格</b></td>
<td bgcolor="white" valign="top"><b>格式</b></td>
<td bgcolor="white" valign="top"><b>示例</b></td>
</tr>
<tr>
<td bgcolor="white" valign="top">UML</td>
<td bgcolor="white" valign="top"><i>name(parameters):type</i></td>
<td bgcolor="white" valign="top">myMethod(myParameter:int):double</td>
</tr>
<tr>
<td bgcolor="white" valign="top">Java/C++ </td>
<td bgcolor="white" valign="top"><nobr><i>type
name(parameters)</i></nobr></td>
<td bgcolor="white" valign="top">double myMethod(int
myParameter)</td>
</tr>
</table>
</td>
</tr>
</table>
<p></p>
</dl>
<p>特性缺省的可见度是
"private".
操作缺省的可见度是
"public".
你可以通过模型图节点的内嵌编辑器,
属性查看器,
或者源代码来修改类成员的可见度.</p>
<table border="0" cellpadding="0" cellspacing="2" bgcolor="#993300" width="100%">
<tr>
<td bgcolor="#993300">
<table border="0" cellpadding="0" cellspacing="2" bgcolor="#ffffcc" width="100%">
<tr>
<td bgcolor="#ffffcc"><b>操作步骤:</b>
使用 Designer 面板将
<b>makeReservation()</b> 从 <b>Flight</b>
复制到 <b>Agent</b> 中.</td>
</tr>
</table>
</td>
</tr>
</table>
<p>要将操作从一个类复制到另一个类,
可以按 <Ctrl> 键拖动.
或者从操作的右键菜单选择"Copy",
然后在目标类的右键菜单选择
"Past". Designer
面板将一个操作从一个类完整地复制到另一个类,
包括方法体.</p>
<table border="0" cellpadding="0" cellspacing="2" bgcolor="#993300" width="100%">
<tr>
<td bgcolor="#993300">
<table border="0" cellpadding="0" cellspacing="2" bgcolor="#ffffcc" width="100%">
<tr>
<td bgcolor="#ffffcc"><b>操作步骤:</b>
为 <b>Reservation</b>
类增加以下操作.
<ul>
<li>构造方法,
包括一个 <b>String</b>
类型参数(<b>name</b>)
和一个 <b>int</b>
类型参数(<b>tKind</b>)
<li><b>ticketPurchased()</b>
方法,
返回值为<b> boolean</b>
类型
<li><b>calcPrice()</b> 方法,
返回值为 <b>double</b>
类型
</ul>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p></p>
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#cccccc">
<tr>
<td bgcolor="#cccccc">
<table border="0" cellpadding="5" cellspacing="2">
<tr>
<td bgcolor="white" valign="top">
<p>类节点地右键菜单包括 <b>New | Constructor</b>
命令,
你可以通过这个命令创建 <b>Reservation</b>
类的构造函数.</p>
<p>你最终将使用到右键菜单的另外两项: <b>New | Property</b>
和 <b>New | <nobr>Member by Pattern</nobr></b>.
(右图显示可以通过右键菜单创建内部类.
你也可以将一个类拖动到另一个类内部来实现.)</p>
<p></p>
</td>
<td bgcolor="white" valign="top"><img src="images/airline/pro4_constructormenu.png" width="169" height="130" border="0" alt="Speedmenu" hspace="5"></td>
</tr>
</table>
</td>
</tr>
</table>
<p></p>
<hr>
<p class="head3"><a name="views"></a>修改查看设置</p>
<p>在 Together
的设置中包括类图中显示多少细节的设置. </p>
<table border="0" cellpadding="0" cellspacing="2" bgcolor="#993300" width="100%">
<tr>
<td bgcolor="#993300">
<table border="0" cellpadding="0" cellspacing="2" bgcolor="#ffffcc" width="100%">
<tr>
<td bgcolor="#ffffcc"><b>任务T:</b>
设置 <b>AirlinePD</b>
模型图的细节级别("detail
level"),
以便显示操作中的参数. </td>
</tr>
</table>
</td>
</tr>
</table>
<p>你可以点击 Designer
面板水平工具条中的
"View Management" 按纽(<img src="images/icons/designer_view_management.gif" width="14" height="14" border="0" alt="button" hspace="1">)来设置模型图的细节级别.</p>
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#cccccc">
<tr>
<td bgcolor="#cccccc">
<table border="0" cellpadding="5" cellspacing="2">
<tr>
<td bgcolor="white" valign="top">
<p>将模型图的细节级别设置为 "Implementation"
选项后, <b>Reservation</b>
节点显示情况如下:</p>
<p><img src="images/airline/reservationwithparameters.png" width="210" height="130" border="0" alt="Reservation node" hspace="2" vspace="3"></p>
<p>有些设置类别(比如
"View Management")
包含它们本身的顶级设置.
要访问较低级别的设置,
你必须先将上级设置展开. </p>
<p></p>
</td>
<td bgcolor="white" valign="top"><img src="images/airline/pro4_view_mgt_options.png" width="645" height="475" border="0" alt="Speedmenu" hspace="5"></td>
</tr>
</table>
</td>
</tr>
</table>
<p></p>
<table border="0" cellpadding="0" cellspacing="2" bgcolor="#993300" width="100%">
<tr>
<td bgcolor="#993300">
<table border="0" cellpadding="0" cellspacing="2" bgcolor="#ffffcc" width="100%">
<tr>
<td bgcolor="#ffffcc"><b>操作步骤:</b>
将以下操作增加到 <b>Flight</b>
类和 <b>Ticket</b> 类中.
<ul>
<li><b>Flight</b> - <b>numberOfTickets()</b>
方法,
返回一个<b> int</b><br>
<li><b>Ticket</b> - <b>calcPrice()</b>.
从 <b>Reservation</b>
类中复制.
</ul>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>如果特性(attribute)拥有对应的 getter
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -