日本国产亚洲-日本国产一区-日本国产一区二区三区-日本韩国欧美一区-日本韩国欧美在线-日本韩国欧美在线观看

當(dāng)前位置:雨林木風(fēng)下載站 > 辦公軟件教程 > 詳細(xì)頁(yè)面

如何使用visio畫UML序列圖

如何使用visio畫UML序列圖

更新時(shí)間:2024-02-12 文章作者:未知 信息來(lái)源:網(wǎng)絡(luò) 閱讀次數(shù):

Office Visio 是Office軟件系列中的負(fù)責(zé)繪制流程圖和示意圖的軟件,是一款便于IT和商務(wù)人員就復(fù)雜信息、系統(tǒng)和流程進(jìn)行可視化處理、分析和交流的軟件。使用 Office Visio 圖表,可以促進(jìn)對(duì)系統(tǒng)和流程的了解。

?今天嘗試使用visio畫了一個(gè)序列圖。

話不多說(shuō),先打開visio,新建一個(gè)UML序列。

如何使用visio畫UML序列圖

先新建幾個(gè)對(duì)象生命線

如何使用visio畫UML序列圖

加入幾個(gè)激活

如何使用visio畫UML序列圖

而后是消息,實(shí)線表示請(qǐng)求,虛線表示響應(yīng)。

如何使用visio畫UML序列圖

當(dāng)然如果不影響理解,可以不用每個(gè)請(qǐng)求都配上一個(gè)響應(yīng)。

此UML例子是在《UML精粹:標(biāo)準(zhǔn)對(duì)象建模語(yǔ)言簡(jiǎn)明指南》中拿過來(lái)的,為了更好的理解這個(gè)UML,下面使用java來(lái)實(shí)現(xiàn)此UML。

procuct

packagecom.simon.uml.sequenceDiagram;

/**

*CreatedbyIntelliJIDEA.

*

*@author:Simon

*@date:2019-05-09

*@time:14:50

*@description:產(chǎn)品

*/

publicclassProduct{

privateStringname;

privatedoubleprice;

publicStringgetName(){

returnname;

}

publicvoidsetName(Stringname){

this.name=name;

}

publicdoublegetPrice(){

returnprice;

}

publicdoublegetPrice(intnumber){

doubleorderLinePrice=price*number;

System.out.println("productname:"+getName()

+"\tprice:"+getPrice()

+"\tnumber:"+number

+"\torderlineprice:"+orderLinePrice

);

returnorderLinePrice;

}

publicvoidsetPrice(doubleprice){

this.price=price;

}

}

customer

packagecom.simon.uml.sequenceDiagram;

/**

*CreatedbyIntelliJIDEA.

*

*@author:Simon

*@date:2019-05-09

*@time:14:51

*@description:客戶

*/

publicclassCustomer{

privatedoublediscount;

publicdoublegetDiscountedValue(Orderorder){

returndiscount*order.getBaseValue();

}

publicdoublegetDiscount(){

returndiscount;

}

publicvoidsetDiscount(doublediscount){

this.discount=discount;

}

}

order

packagecom.simon.uml.sequenceDiagram;

importjava.util.List;

/**

*CreatedbyIntelliJIDEA.

*

*@author:Simon

*@date:2019-05-09

*@time:14:50

*@description:訂單

*/

publicclassOrder{

privatedoublebaseValue;

privateCustomercustomer;

privateListorderLineList;

publicdoublecalculatePrice(){

doublesumOrderLinePrice=0;

for(OrderLineorderLine:orderLineList){

doubleorderLinePrice=orderLine.calculatePrice();

sumOrderLinePrice+=orderLinePrice;

}

this.setBaseValue(sumOrderLinePrice);

System.out.println("orderbaseprice:"+sumOrderLinePrice);

doublediscountedValue=getCustomer().getDiscountedValue(this);

System.out.println("orderdiscountedprice:"+discountedValue);

returndiscountedValue;

}

publicdoublegetBaseValue(){

returnbaseValue;

}

publicvoidsetBaseValue(doublebaseValue){

this.baseValue=baseValue;

}

publicListgetOrderLineList(){

returnorderLineList;

}

publicvoidsetOrderLineList(ListorderLineList){

this.orderLineList=orderLineList;

}

publicCustomergetCustomer(){

returncustomer;

}

publicvoidsetCustomer(Customercustomer){

this.customer=customer;

}

}

orderline

packagecom.simon.uml.sequenceDiagram;

/**

*CreatedbyIntelliJIDEA.

*

*@author:Simon

*@date:2019-05-09

*@time:14:50

*@description:訂單明細(xì)

*/

publicclassOrderLine{

privateintnumber;

privateProductproduct;

publicOrderLine(intnumber,Productproduct){

this.number=number;

this.product=product;

}

publicdoublecalculatePrice(){

returnproduct.getPrice(number);

}

publicintgetNumber(){

returnnumber;

}

publicvoidsetNumber(intnumber){

this.number=number;

}

publicProductgetProduct(){

returnproduct;

}

publicvoidsetProduct(Productproduct){

this.product=product;

}

}

order的測(cè)試用例

packagecom.simon.uml.sequenceDiagram;

importorg.junit.Assert;

importjava.util.ArrayList;

importjava.util.List;

/**

*CreatedbyIntelliJIDEA.

*

*@author:Simon

*@date:2019-05-09

*@time:15:23

*@description:

*/

publicclassOrderTest{

@org.junit.Test

publicvoidcalculatePrice(){

//這個(gè)商品是鞋子,123塊錢一雙

ProductproductShoes=newProduct();

productShoes.setName("shoes");

productShoes.setPrice(123);

//這個(gè)商品是襪子,8塊錢一雙

ProductproductSocket=newProduct();

productSocket.setName("socket");

productSocket.setPrice(8);

//這是一個(gè)老客戶,打七折

Customercustomer=newCustomer();

customer.setDiscount(0.7);

//這個(gè)客戶下了一個(gè)單

Orderorder=newOrder();

order.setCustomer(customer);

//買了一雙鞋子,兩雙襪子

OrderLineorderLineShoes=newOrderLine(1,productShoes);

OrderLineorderLineSocket=newOrderLine(2,productSocket);

ListorderLineList=newArrayList();

orderLineList.add(orderLineShoes);

orderLineList.add(orderLineSocket);

order.setOrderLineList(orderLineList);

//算一算總共多少錢

doublepriceActual=order.calculatePrice();

Assert.assertEquals("97.3",String.valueOf(priceActual));

}

}

測(cè)試用例的輸出

productname:shoesprice:123.0number:1orderlineprice:123.0

productname:socketprice:8.0number:2orderlineprice:16.0

orderbaseprice:139.0

orderdiscountedprice:97.3


Visio幫助您創(chuàng)建具有專業(yè)外觀的圖表,以便理解、記錄和分析信息、數(shù)據(jù)、系統(tǒng)和過程。

溫馨提示:喜歡本站的話,請(qǐng)收藏一下本站!

本類教程下載

系統(tǒng)下載排行

主站蜘蛛池模板: 久久国产精品一国产精品金尊 | 亚洲欧美一区二区三区在饯 | 久久影院一区二区三区 | 精品国产三级a∨在线观看 精品国产三级a在线观看 | 久久久日本精品一区二区三区 | 欧美一级性 | 国产大片91精品免费观看不卡 | 国产精品成人观看视频免费 | 国产亚洲欧美在线中文无广告 | 国产精品性视频免费播放 | 91天堂素人搭讪系列在线观看 | 欧美日韩系列 | 深夜福利网站在线 | 亚洲丁香婷婷综合久久小说 | 婷婷在线免费观看 | 91热久久| 国内精品欧美久久精品 | 亚洲影院在线 | 全部免费毛片在线 | 欧美伊人影院 | 特级淫片日本高清视频 | 久久国产精品自线拍免费 | 最新精品国产 | 欧美在线成人免费国产 | 久久精品中文字幕有码日本 | 在线成人aa在线看片 | 亚洲国产精品久久 | 国产精品人人爽人人做 | 亚洲伊人色综合网站小说 | 国产日韩欧美亚洲综合首页 | 69国产成人综合久久精品91 | 久久精品国产免费观看99 | 国产高清久久 | 七次郎在线视频精品视频 | 欧美精品第1页在线播放 | 997在线观看视频国产 | 日本大片久久久高清免费看 | 精品入口蜜桃 | 久久99精品久久久久久青青91 | 精品久久久久久中文字幕无碍 | 国产成人欧美视频在线 |