andy's blog
記錄我的所做所思
BlogJava
::
首頁(yè)
::
聯(lián)系
::
聚合
::
管理
1 Posts :: 13 Stories :: 0 Comments :: 0 Trackbacks
常用鏈接
我的隨筆
我的評(píng)論
我的參與
留言簿
(1)
給我留言
查看公開(kāi)留言
查看私人留言
我參與的團(tuán)隊(duì)
隨筆分類(lèi)
日志(1)
隨筆檔案
2006年3月 (1)
文章分類(lèi)
Ant&Maven
English(1)
Hibernate
Ibatis
J2EE技術(shù)
JAVA語(yǔ)言(1)
Junit
Log
Spring
Velocity
其它技術(shù)
總體
考研
設(shè)計(jì)模式(11)
重構(gòu)
文章檔案
2006年5月 (1)
2006年4月 (1)
2006年3月 (11)
收藏夾
JAVA相關(guān)(1)
java相關(guān)
考研
搜索
最新評(píng)論
Adapter
一:
???? 現(xiàn)實(shí)生活例子:插座是三相的如果電器插頭是兩相的,那么需要一個(gè)adapter把三相的插座轉(zhuǎn)成兩相。
????
//
Enumeration到Iterator的Adapter
public
?
class
?EnumerationIterator?
implements
?Iterator?
{
????
private
?Enumeration?enumeration;
????
public
?EnumerationIterator(Enumeration?enumeration)
????
{
????????
this
.enumeration
=
enumeration;
????}
????
public
?
boolean
?hasNext()?
{
????????
return
?enumeration.hasMoreElements();
????}
????
public
?Object?next()?
{
????????
return
?enumeration.nextElement();
????}
????
public
?
void
?remove()?
{
????????
throw
?
new
?UnsupportedOperationException();
????}
}
????
/**?*/
/**
?????*?客戶(hù)端代碼
?????
*/
????
public
?
static
?
void
?main(String[]?args)?
{
????????Vector?vect
=
new
?Vector();
????????vect.add(
"
v1
"
);
????????vect.add(
"
v2
"
);
????????display(
new
?EnumerationIterator(vect.elements()));
????????List?list1
=
new
?ArrayList();
????????list1.add(
"
L1
"
);
????????list1.add(
"
L2
"
);
????????display(list1.iterator());
????}
????
public
?
static
?
void
?display(Iterator?iter)
????
{
????????
while
?(iter.hasNext())
????????
{
????????????System.out.println(iter.next());
????????}
????}
????
The Adapter Pattern
converts the interface of? a class into another interface the client expect.Adapter lets classes work together that couldn't otherwise because of? incompatible interfaces.
???和Decorator模式不同,decorator對(duì)類(lèi)包裝后是增加它的功能,而Adapter是改變接口形式以適用client需要
???
?? 應(yīng)用實(shí)例:WINE在Linux環(huán)境下運(yùn)行Windows程序。
?????????????????????? JDBC/ODBC橋。
posted on 2006-03-30 11:29
zhoumin
閱讀(114)
評(píng)論(0)
編輯
收藏
所屬分類(lèi):
設(shè)計(jì)模式
新用戶(hù)注冊(cè)
刷新評(píng)論列表
只有注冊(cè)用戶(hù)
登錄
后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問(wèn)
管理
相關(guān)文章:
Singleton
Iterator
Template
Proxy
Facade
Adapter
Factory
Decorator
Observer
Strategy
Copyright @ zhoumin
Powered by:
.Text
and
ASP.NET
Theme by:
.NET Monster
主站蜘蛛池模板:
91在线手机精品免费观看
|
国产精品视频免费一区二区三区
|
无码专区永久免费AV网站
|
亚洲欧洲日产国码av系列天堂
|
色视频在线观看免费
|
亚洲AV无码不卡在线播放
|
性做久久久久久免费观看
|
免费在线观看亚洲
|
亚洲AV成人无码久久精品老人
|
精品无码一区二区三区亚洲桃色
|
久久毛片免费看一区二区三区
|
亚洲国产精品一区二区三区久久
|
337P日本欧洲亚洲大胆艺术图
|
四虎免费永久在线播放
|
免费国产叼嘿视频大全网站
|
亚洲乱码无人区卡1卡2卡3
|
成全视频免费高清
|
在线免费观看一区二区三区
|
久久国产乱子伦精品免费午夜
|
色久悠悠婷婷综合在线亚洲
|
99久久免费国产精品特黄
|
一级特黄录像免费播放肥
|
亚洲国产精品无码观看久久
|
亚洲AV无码一区东京热
|
1000部免费啪啪十八未年禁止观看
|
亚洲色欲www综合网
|
在线观看亚洲精品国产
|
成全影视免费观看大全二
|
久久久久成人片免费观看蜜芽
|
亚洲欧洲一区二区
|
免费**毛片在线播放直播
|
一区二区三区免费视频播放器
|
久久青青草原亚洲AV无码麻豆
|
成人A级毛片免费观看AV网站
|
色偷偷亚洲女人天堂观看欧
|
女人被免费视频网站
|
看成年女人免费午夜视频
|
亚洲六月丁香六月婷婷色伊人
|
日韩在线看片免费人成视频播放
|
人成午夜免费大片在线观看
|
亚洲三级在线观看
|