亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pat5f.htm

?? java設計范式.rar
?? HTM
?? 第 1 頁 / 共 2 頁
字號:
<HTML><HEAD><TITLE>Memento</TITLE><SCRIPT>function setFocus() {		if ((navigator.appName != "Netscape") && (parseFloat(navigator.appVersion) == 2)) {	return;	} else {	self.focus();	}}</SCRIPT></HEAD><BODY   BGCOLOR         = #FFFFFFonLoad="setFocus()";><A NAME="top"></A><A NAME="Memento"></A><A NAME="intent"></A><H2><A HREF="#alsoknownas"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Also Known As"></A> Intent</H2> <A NAME="auto1000"></A><P>Without violating encapsulation, capture and externalize an object'sinternal state so that the object can be restored to this state later.</P><A NAME="alsoknownas"><A><H2><A HREF="#motivation"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Motivation"></A> Also Known As</H2> <A NAME="auto1001"></A><P>Token</P><A NAME="motivation"></A><H2><A HREF="#applicability"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Applicability"></A> Motivation</H2> <A NAME="auto1002"></A><P>Sometimes it's necessary to record the internal state of an object.This is required when implementing checkpoints and undo mechanismsthat let users back out of tentative operations or recover fromerrors.  You must save state information somewhere so that you canrestore objects to their previous states.  But objects normallyencapsulate some or all of their state, making it inaccessible toother objects and impossible to save externally.  Exposing this statewould violate encapsulation, which can compromise the application'sreliability and extensibility.</P><A NAME="auto1003"></A><P>Consider for example a graphical editor that supports connectivitybetween objects. A user can connect two rectangles with a line, andthe rectangles stay connected when the user moves either of them.  Theeditor ensures that the line stretches to maintain the connection.</P><P ALIGN=CENTER><IMG SRC="Pictures/memen029.gif"></P><A NAME="auto1004"></A><P>A well-known way to maintain connectivity relationships betweenobjects is with a constraint-solving system.  We can encapsulate thisfunctionality in a <STRONG>ConstraintSolver</STRONG> object.ConstraintSolver records connections as they are made and generatesmathematical equations that describe them.  It solves these equationswhenever the user makes a connection or otherwise modifies thediagram.  ConstraintSolver uses the results of its calculations torearrange the graphics so that they maintain the proper connections.</P><A NAME="supp-undo"></A><P>Supporting undo in this application isn't as easy as it may seem.  Anobvious way to undo a move operation is to store the original distancemoved and move the object back an equivalent distance.  However, thisdoes not guarantee all objects will appear where they did before.Suppose there is some slack in the connection.  In that case, simplymoving the rectangle back to its original location won't necessarilyachieve the desired effect.</P><P ALIGN=CENTER><IMG SRC="Pictures/memen028.gif"></P><A NAME="auto1005"></A><P>In general, the ConstraintSolver's public interface might beinsufficient to allow precise reversal of its effects on otherobjects. The undo mechanism must work more closely withConstraintSolver to reestablish previous state, but we should alsoavoid exposing the ConstraintSolver's internals to the undo mechanism.</P><A NAME="orig-def"></A><P>We can solve this problem with the Memento pattern. A<STRONG>memento</STRONG> is an object that stores a snapshot of theinternal state of another object&#151;the memento's<STRONG>originator</STRONG>. The undo mechanism will request a mementofrom the originator when it needs to checkpoint the originator'sstate. The originator initializes the memento with information thatcharacterizes its current state.  Only the originator can store andretrieve information from the memento&#151;the memento is "opaque" toother objects.</P><A NAME="auto1006"></A><P>In the graphical editor example just discussed, the ConstraintSolver can actas an originator.  The following sequence of events characterizes theundo process:</P><OL><A NAME="auto1007"></A><LI>The editor requests a memento from the ConstraintSolver as aside-effect of the move operation.</LI><A NAME="auto1008"></A><P></P><A NAME="solverstate"></A><LI>The ConstraintSolver creates and returns a memento, an instance of aclass SolverState in this case.  A SolverState memento contains datastructures that describe the current state of the ConstraintSolver'sinternal equations and variables.</LI><A NAME="auto1009"></A><P></P><A NAME="auto1010"></A><LI>Later when the user undoes the move operation, the editor gives theSolverState back to the ConstraintSolver.</LI><A NAME="auto1011"></A><P></P><A NAME="auto1012"></A><LI>Based on the information in the SolverState, the ConstraintSolverchanges its internal structures to return its equations and variablesto their exact previous state.</LI></OL><A NAME="auto1013"></A><P>This arrangement lets the ConstraintSolver entrust other objects withthe information it needs to revert to a previous state withoutexposing its internal structure and representations.</P><A NAME="applicability"></A><H2><A HREF="#structure"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Structure"></A> Applicability</H2> <A NAME="auto1014"></A><P>Use the Memento pattern when</P><UL><A NAME="auto1015"></A><LI>a snapshot of (some portion of) an object's state must be saved sothat it can be restored to that state later, <EM>and</EM></LI><A NAME="auto1016"></A><P></P><A NAME="auto1017"></A><LI>a direct interface to obtaining the state would exposeimplementation details and break the object's encapsulation.</LI></UL><A NAME="structure"></A><H2><A HREF="#participants"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Participants"></A> Structure</H2> <A NAME="orig-285c"></A><P ALIGN=CENTER><IMG SRC="Pictures/memento.gif"></P><A NAME="participants"></A><H2><A HREF="#collaborations"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Collaborations"></A> Participants</H2><UL><A NAME="auto1018"></A><LI><B>Memento</B> (SolverState)</LI><A NAME="auto1019"></A><P></P>    <UL>    <A NAME="auto1020"></A><LI>stores internal state of the Originator object.  The memento may    store as much or as little of the originator's internal state as    necessary at its originator's discretion.</LI>    <A NAME="auto1021"></A><P><!-- extra space --></P>    <A NAME="auto1022"></A><LI>protects against access by objects other than the    originator.  Mementos have effectively two interfaces. Caretaker    sees a <EM>narrow</EM> interface to the Memento&#151;it can only pass    the memento to other objects. Originator, in contrast, sees a    <EM>wide</EM> interface, one that lets it access all the data    necessary to restore itself to its previous state.  Ideally, only    the originator that produced the memento would be permitted to    access the memento's internal state.</LI>    </UL><A NAME="auto1023"></A><P></P><A NAME="auto1024"></A><LI><B>Originator</B> (ConstraintSolver)</LI><A NAME="auto1025"></A><P></P>    <UL>    <A NAME="auto1026"></A><LI>creates a memento containing a snapshot of its current    internal state.</LI>    <A NAME="auto1027"></A><P><!-- extra space --></P>    <A NAME="auto1028"></A><LI>uses the memento to restore its internal state.</LI>    </UL><A NAME="auto1029"></A><P></P><A NAME="auto1030"></A><LI><B>Caretaker</B> (undo mechanism)<A NAME="auto1031"></A><P></P>    <UL>    <A NAME="auto1032"></A><LI>is responsible for the memento's safekeeping.</LI>    <A NAME="auto1033"></A><P><!-- extra space --></P>    <A NAME="auto1034"></A><LI>never operates on or examines the contents of a memento.</LI>    </UL></UL><A NAME="collaborations"></A><H2><A HREF="#consequences"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Consequences"></A> Collaborations</H2><UL><A NAME="auto1035"></A><LI>A caretaker requests a memento from an originator, holds it for atime, and passes it back to the originator, as the followinginteraction diagram illustrates:<A NAME="orig-286i"></A><P ALIGN=CENTER><IMG SRC="Pictures/memen027.gif"></P><A NAME="auto1036"></A><P>Sometimes the caretaker won't pass the memento back to the originator,because the originator might never need to revert to an earlier state.</P></LI><A NAME="auto1037"></A><P></P><A NAME="auto1038"></A><LI>Mementos are passive. Only the originator that created a memento willassign or retrieve its state.</LI></UL><A NAME="consequences"></A><H2><A HREF="#implementation"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Implementation"></A> Consequences</H2> <A NAME="auto1039"></A><P>The Memento pattern has several consequences:</P><OL><A NAME="presrvencap"></A><LI><EM>Preserving encapsulation boundaries.</EM>Memento avoids exposing information that only an originator shouldmanage but that must be stored nevertheless outside the originator.The pattern shields other objects from potentially complex Originatorinternals, thereby preserving encapsulation boundaries.</LI><A NAME="auto1040"></A><P></P><A NAME="auto1041"></A><LI><EM>It simplifies Originator.</EM>In other encapsulation-preserving designs, Originator keeps theversions of internal state that clients have requested.  That puts allthe storage management burden on Originator.  Having clientsmanage the state they ask for simplifies Originator and keepsclients from having to notify originators when they're done.</LI><A NAME="auto1042"></A><P></P><A NAME="auto1043"></A><LI><EM>Using mementos might be expensive.</EM>Mementos might incur considerable overhead if Originator must copylarge amounts of information to store in the memento or if clientscreate and return mementos to the originator often enough.  Unlessencapsulating and restoring Originator state is cheap, the patternmight not be appropriate.  See the discussion of incrementality in theImplementation section.</LI><A NAME="auto1044"></A><P></P><A NAME="auto1045"></A><LI><EM>Defining narrow and wide interfaces.</EM>It may be difficult in some languages to ensure that only theoriginator can access the memento's state.</LI><A NAME="auto1046"></A><P></P><A NAME="auto1047"></A><LI><EM>Hidden costs in caring for mementos.</EM>A caretaker is responsible for deleting the mementos it cares for.However, the caretaker has no idea how much state is in the memento.Hence an otherwise lightweight caretaker might incur large storagecosts when it stores mementos.</LI>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲图片欧美激情| 久久国产夜色精品鲁鲁99| 亚洲高清不卡在线观看| 国产一区二区美女诱惑| 欧美日韩国产综合一区二区| 中文字幕制服丝袜成人av | 一本久道久久综合中文字幕| 欧美一二三区精品| 亚洲一区二区影院| eeuss鲁一区二区三区| 精品国偷自产国产一区| 三级成人在线视频| 色999日韩国产欧美一区二区| 国产日韩欧美a| 精品无码三级在线观看视频 | 成人av在线看| 欧美大黄免费观看| 美女一区二区久久| 7777精品伊人久久久大香线蕉| 亚洲精品视频自拍| 99九九99九九九视频精品| 欧美国产精品一区二区三区| 久久国产精品一区二区| 91麻豆精品国产91久久久使用方法| 亚洲最大成人综合| 欧美午夜精品久久久久久孕妇| 亚洲色图在线播放| 99久久精品99国产精品| 国产精品国产精品国产专区不片| 国产精品夜夜爽| 国产日韩欧美综合在线| 国产成人免费视频网站高清观看视频| 欧美www视频| 国产一区二区三区最好精华液 | 777久久久精品| 天天影视网天天综合色在线播放| 欧美日韩成人综合在线一区二区| 亚洲一区二区三区美女| 欧美视频三区在线播放| 一区二区三区资源| 7777精品伊人久久久大香线蕉最新版| 亚洲一区在线观看网站| 欧美亚洲综合久久| 亚洲成av人片www| 在线观看91av| 久久精品国产精品亚洲综合| 久久影院电视剧免费观看| 国产不卡视频在线播放| 亚洲视频资源在线| 欧美日韩一区三区| 韩国av一区二区三区四区 | 国产成人av电影在线| 欧美a一区二区| 欧美一区2区视频在线观看| 亚洲少妇30p| 欧美一级电影网站| 99久久国产综合精品女不卡| 亚洲综合小说图片| 欧美精品久久久久久久多人混战| 久久99精品久久久久| 国产精品视频看| 欧美视频一区在线观看| 久久电影网电视剧免费观看| 日本一二三不卡| 欧美高清视频在线高清观看mv色露露十八 | 亚洲综合在线视频| 欧美成人精精品一区二区频| 91在线看国产| 老司机精品视频在线| 综合久久国产九一剧情麻豆| 床上的激情91.| 精品一区二区精品| 久草这里只有精品视频| 久久国产生活片100| 欧美日韩大陆在线| 国产在线播精品第三| 亚洲尤物在线视频观看| 久久久久国产免费免费| 欧美色大人视频| 成人免费观看视频| 麻豆91在线看| 午夜成人免费视频| 综合久久给合久久狠狠狠97色 | 在线不卡免费av| 99久久精品免费| 国产美女在线观看一区| 午夜激情久久久| 国产精品二三区| 国产亚洲短视频| 日韩区在线观看| 欧美巨大另类极品videosbest | 91精品国产综合久久久久久久久久 | 国产剧情一区在线| 亚洲成在人线在线播放| 日韩理论电影院| 国产精品无码永久免费888| 精品日韩在线观看| 91精品国模一区二区三区| 在线观看精品一区| 99国产一区二区三精品乱码| 国产91精品精华液一区二区三区| 日本美女一区二区三区视频| 亚洲h在线观看| 亚洲欧美一区二区三区孕妇| 亚洲国产精品成人综合| 久久久综合网站| 日韩精品一区二区三区老鸭窝| 欧美日韩高清在线播放| 色老头久久综合| 色婷婷久久一区二区三区麻豆| 成人avav影音| 成人av网在线| 91色婷婷久久久久合中文| 成人美女视频在线观看| 波多野结衣在线aⅴ中文字幕不卡| 韩国成人福利片在线播放| 国产一区视频导航| 国产精品1区2区3区在线观看| 国产在线视频不卡二| 国产91丝袜在线播放九色| 国产精品99久久久久久久vr| 成人小视频免费观看| 成人av在线播放网站| 97se亚洲国产综合自在线观| 色香蕉久久蜜桃| 欧美私人免费视频| 国产精品99久久久久久久vr| 91网站黄www| 久久久亚洲欧洲日产国码αv| 午夜久久福利影院| 成人欧美一区二区三区黑人麻豆| 日韩精品在线一区| 亚洲国产激情av| 亚洲中国最大av网站| 日韩精品亚洲一区| 国产乱人伦精品一区二区在线观看 | 久久精品二区亚洲w码| 韩国在线一区二区| 97久久超碰国产精品电影| 在线精品视频免费观看| 欧美一区二区三区小说| 国产网站一区二区| 亚洲综合一二三区| 免费视频一区二区| 国产精品一级片在线观看| 93久久精品日日躁夜夜躁欧美| 欧亚一区二区三区| 精品奇米国产一区二区三区| 日韩一区二区在线看| 国产精品国产三级国产a| 国产精品自拍一区| 日韩一级大片在线| 欧美精品一区二区三区蜜桃| 91精品国产高清一区二区三区| 久久精品一区二区三区av| 亚洲欧美日韩国产一区二区三区| 久色婷婷小香蕉久久| 99精品久久99久久久久| 日韩欧美国产三级电影视频| 国产精品久久久久久久裸模| 蜜臀av一区二区在线免费观看 | 亚洲综合视频在线| 麻豆国产精品一区二区三区 | 99免费精品在线| 欧美妇女性影城| 国产精品国产自产拍高清av| 日韩精品亚洲专区| 91视频观看免费| 国产日韩欧美精品一区| 欧美精品视频www在线观看| 国产精品系列在线| 9人人澡人人爽人人精品| 国产精品久久久久永久免费观看 | 91年精品国产| 久久久久99精品国产片| 免费成人你懂的| 欧美性一级生活| 国产精品拍天天在线| 激情欧美日韩一区二区| 5月丁香婷婷综合| 亚洲午夜免费电影| 91丨九色丨黑人外教| 久久蜜桃一区二区| 九九久久精品视频| 欧美一二三四在线| 日本网站在线观看一区二区三区| 色婷婷激情综合| 亚洲男女一区二区三区| 成人黄色免费短视频| 久久久久久**毛片大全| 久久66热偷产精品| 日韩精品一区二区在线| 青娱乐精品视频| 欧美一级电影网站| 青草av.久久免费一区| 精品一二线国产| **性色生活片久久毛片| 欧美亚洲高清一区二区三区不卡| 九九国产精品视频| 亚洲天堂精品在线观看|