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

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

?? pat5h.htm

?? java設計范式.rar
?? HTM
?? 第 1 頁 / 共 2 頁
字號:
<HTML><HEAD>	<TITLE>State</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="State"></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>Allow an object to alter its behavior when its internal state changes.The object will appear to change its class.</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>Objects for States</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>Consider a class TCPConnection that represents a network connection.A TCPConnection object can be in one of several different states:Established, Listening, Closed.  When a TCPConnection object receivesrequests from other objects, it responds differently depending on itscurrent state.  For example, the effect of an Open request depends onwhether the connection is in its Closed state or its Establishedstate.  The State pattern describes how TCPConnection can exhibitdifferent behavior in each state.</P><A NAME="tcpstate"></A><P>The key idea in this pattern is to introduce an abstract class calledTCPState to represent the states of the network connection.  TheTCPState class declares an interface common to all classes thatrepresent different operational states.  Subclasses of TCPStateimplement state-specific behavior. For example, the classesTCPEstablished and TCPClosed implement behavior particular to theEstablished and Closed states of TCPConnection.</P><A NAME="tcpconnect-305c"></A><P ALIGN=CENTER><IMG SRC="Pictures/state-eg.gif"></P><A NAME="auto1003"></A><P>The class TCPConnection maintains a state object (an instance of asubclass of TCPState) that represents the current state of the TCPconnection.  The class TCPConnection delegates all state-specificrequests to this state object.  TCPConnection uses its TCPStatesubclass instance to perform operations particular to the state of theconnection.</P><A NAME="auto1004"></A><P>Whenever the connection changes state, the TCPConnection objectchanges the state object it uses.  When the connection goes fromestablished to closed, for example, TCPConnection will replace itsTCPEstablished instance with a TCPClosed instance.</P><A NAME="applicability"></A><H2><A HREF="#structure"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Structure"></A> Applicability</H2> <A NAME="auto1005"></A><P>Use the State pattern in either of the following cases:</P><UL><A NAME="auto1006"></A><LI>An object's behavior depends on its state, and it must change itsbehavior at run-time depending on that state.</LI><A NAME="auto1007"></A><P></P><A NAME="auto1008"></A><LI>Operations have large, multipart conditional statements that depend onthe object's state.  This state is usually represented by one or moreenumerated constants.  Often, several operations will contain thissame conditional structure.  The State pattern puts each branch of theconditional in a separate class.  This lets you treat the object'sstate as an object in its own right that can vary independently fromother objects.</LI></UL><A NAME="structure"></A><H2><A HREF="#participants"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Participants"></A> Structure</H2> <P ALIGN=CENTER><IMG SRC="Pictures/state.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="auto1009"></A><P></P><A NAME="auto1010"></A><LI><B>Context</B> (TCPConnection)</LI><A NAME="auto1011"></A><P></P><UL><A NAME="auto1012"></A><LI>defines the interface of interest to clients.    <A NAME="auto1013"></A><P><!-- extra space --></P><A NAME="auto1014"></A><LI>maintains an instance of a ConcreteState subclass that defines thecurrent state.</UL><A NAME="auto1015"></A><P></P><A NAME="auto1016"></A><LI><B>State</B> (TCPState)</LI><A NAME="auto1017"></A><P></P><UL><A NAME="auto1018"></A><LI>defines an interface for encapsulating the behavior associated with aparticular state of the Context.</LI></UL><A NAME="auto1019"></A><P></P><A NAME="auto1020"></A><LI><B>ConcreteState subclasses</B> (TCPEstablished, TCPListen, TCPClosed)</LI><A NAME="auto1021"></A><P></P><UL><A NAME="auto1022"></A><LI>each subclass implements a behavior associated with a state ofthe Context.</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="auto1023"></A><LI>Context delegates state-specific requests to the current ConcreteStateobject.</LI><A NAME="auto1024"></A><P></P><A NAME="auto1025"></A><LI>A context may pass itself as an argument to the State objecthandling the request.  This lets the State object accessthe context if necessary.</LI><A NAME="auto1026"></A><P></P><A NAME="auto1027"></A><LI>Context is the primary interface for clients. Clients can configure acontext with State objects. Once a context is configured, its clients don't have to deal with the State objects directly. </LI><A NAME="auto1028"></A><P></P><A NAME="auto1029"></A><LI>Either Context or the ConcreteState subclasses can decide which statesucceeds another and under what circumstances.</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="auto1030"></A><P>The State pattern has the following consequences:</P><OL><A NAME="auto1031"></A><LI><EM>It localizes state-specific behavior and partitionsbehavior for different states.</EM>The State pattern puts all behavior associated with a particular stateinto one object.  Because all state-specific code lives in a Statesubclass, new states and transitions can be added easily by definingnew subclasses.<A NAME="auto1032"></A><P>An alternative is to use data values to define internal states andhave Context operations check the data explicitly.  But then we'dhave look-alike conditional or case statements scattered throughoutContext's implementation.  Adding a new state could requirechanging several operations, which complicates maintenance.</P><A NAME="auto1033"></A><P>The State pattern avoids this problem but might introduce another,because the pattern distributes behavior for different states acrossseveral State subclasses. This increases the number of classes and isless compact than a single class.  But such distribution is actuallygood if there are many states, which would otherwise necessitate largeconditional statements.</P><A NAME="auto1034"></A><P>Like long procedures, large conditional statements are undesirable.They're monolithic and tend to make the code less explicit, whichin turn makes them difficult to modify and extend.  The State patternoffers a better way to structure state-specific code.  The logic thatdetermines the state transitions doesn't reside in monolithic<CODE>if</CODE> or <CODE>switch</CODE> statements but instead is partitionedbetween the State subclasses.  Encapsulating each state transition andaction in a class elevates the idea of an execution state to fullobject status.  That imposes structure on the code and makes itsintent clearer.</P></LI><A NAME="auto1035"></A><P></P><A NAME="state-avoid-inconsistent"></A><A NAME="state-atomic"></A><LI><EM>It makes state transitions explicit.</EM>When an object defines its current state solely in terms of internaldata values, its state transitions have no explicit representation;they only show up as assignments to some variables.  Introducingseparate objects for different states makes the transitions moreexplicit.  Also, State objects can protect the Context frominconsistent internal states, because state transitions are atomicfrom the Context's perspective&#151;they happen by rebinding <EM>one</EM>variable (the Context's State object variable), notseveral [<A HREF="bibfs.htm#dechampeaux_oosd" TARGET="_mainDisplayFrame">dCLF93</A>].</LI><A NAME="auto1036"></A><P></P><A NAME="flywt-w-state"></A><A NAME="state-sharing"></A><LI><EM>State objects can be shared.</EM>If State objects have no instance variables&#151;that is, the state theyrepresent is encoded entirely in their type&#151;then contexts can sharea State object. When states are shared in this way, they areessentially flyweights (see <A HREF="pat4ffs.htm" TARGET="_mainDisplayFrame">Flyweight (195</A>)) with nointrinsic state, only behavior.</LI></OL><A NAME="implementation"></A><H2><A HREF="#samplecode"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Sample Code"></A> Implementation</H2> <A NAME="auto1037"></A><P>The State pattern raises a variety of implementation issues:</P><OL><A NAME="auto1038"></A><LI><EM>Who defines the state transitions?</EM>The State pattern does not specify which participant defines thecriteria for state transitions.  If the criteria are fixed, then theycan be implemented entirely in the Context.  It is generally moreflexible and appropriate, however, to let the State subclassesthemselves specify their successor state and when to make thetransition.  This requires adding an interface to the Context thatlets State objects set the Context's current state explicitly.<A NAME="auto1039"></A><P>Decentralizing the transition logic in this way makes it easy tomodify or extend the logic by defining new State subclasses.  Adisadvantage of decentralization is that one State subclass will haveknowledge of at least one other, which introduces implementationdependencies between subclasses.</P></LI><A NAME="auto1040"></A><P></P><A NAME="state-tablebased"></A><LI><EM>A table-based alternative.</EM>In <EM>C++ Programming Style</EM> [<A HREF="bibfs.htm#cargill_c++style" TARGET="_mainDisplayFrame">Car92</A>], Cargilldescribes another way to impose structure on state-driven code: Heuses tables to map inputs to state transitions.  For each state, atable maps every possible input to a succeeding state.  In effect,this approach converts conditional code (and virtual functions, in thecase of the State pattern) into a table look-up.<A NAME="auto1041"></A><P>The main advantage of tables is their regularity: You can change thetransition criteria by modifying data instead of changing programcode.  There are some disadvantages, however:</P><A NAME="auto1042"></A><P></P><UL><A NAME="auto1043"></A><LI>A table look-up is often less efficient than a (virtual)function call.<A NAME="auto1044"></A><P></P><A NAME="auto1045"></A><LI>Putting transition logic into a uniform, tabular format makes thetransition criteria less explicit and therefore harder to understand.<A NAME="auto1046"></A><P></P><A NAME="auto1047"></A><LI>It's usually difficult to add actions to accompany the statetransitions.  The table-driven approach captures the states and theirtransitions, but it must be augmented to perform arbitrary computationon each transition.</UL><A NAME="auto1048"></A>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人美女视频在线看| 日韩精品一区二区三区老鸭窝| 国产91露脸合集magnet| 加勒比av一区二区| 韩国av一区二区三区| 国产主播一区二区三区| 久久狠狠亚洲综合| 久久国产精品99精品国产| 奇米亚洲午夜久久精品| 麻豆精品视频在线观看免费| 麻豆国产欧美一区二区三区| 裸体歌舞表演一区二区| 国产精品综合二区| 成人性生交大片免费看在线播放| 丰满白嫩尤物一区二区| 成人午夜视频免费看| 成人app网站| 91亚洲精品久久久蜜桃| 91美女在线视频| 欧美视频一区二区三区在线观看| 欧美日韩精品一区二区三区蜜桃| 69久久夜色精品国产69蝌蚪网| 在线不卡免费av| 欧美电影精品一区二区| 久久九九国产精品| 国产精品久久久久久久久晋中 | 日韩精品一区二区三区在线| 日韩欧美中文字幕公布| 久久香蕉国产线看观看99| 中文字幕亚洲综合久久菠萝蜜| 亚洲另类色综合网站| 日本在线不卡视频| 韩国理伦片一区二区三区在线播放| 成人一区二区三区在线观看 | 国产精品乱码妇女bbbb| 尤物视频一区二区| 日韩和欧美一区二区| 国产一区二区精品久久91| caoporen国产精品视频| 欧美影院精品一区| 精品免费99久久| 国产精品久久久久久久久免费丝袜| 亚洲综合无码一区二区| 蓝色福利精品导航| av一区二区三区黑人| 欧美日韩一区二区三区在线看| 日韩精品一区二| 亚洲美女精品一区| 久久精品理论片| 91一区二区在线| 日韩免费一区二区三区在线播放| ...av二区三区久久精品| 丝袜美腿亚洲一区二区图片| 国产成人aaa| 欧美疯狂性受xxxxx喷水图片| 国产目拍亚洲精品99久久精品| 亚洲成人一区二区| 国产成人在线色| 国产精品久久久久久户外露出 | 一区二区三区四区在线| 麻豆精品国产传媒mv男同 | 日韩一二三四区| 亚洲婷婷在线视频| 国产一区二区免费视频| 欧美三级资源在线| 中文字幕av免费专区久久| 亚洲一二三四在线| 成人在线视频首页| 久久午夜老司机| 日韩中文字幕亚洲一区二区va在线| proumb性欧美在线观看| 欧美精品一区二区三区一线天视频| 伊人婷婷欧美激情| 高清av一区二区| 欧美成人官网二区| 天天综合天天做天天综合| 日本韩国欧美在线| 国产精品国产精品国产专区不蜜 | 亚洲四区在线观看| 国产久卡久卡久卡久卡视频精品| 在线不卡中文字幕| 亚洲综合成人在线| 91麻豆免费视频| 国产精品久久久久久久午夜片 | 成人网男人的天堂| 精品日韩欧美一区二区| 午夜精品一区二区三区三上悠亚 | 国产精品青草综合久久久久99| 六月丁香婷婷色狠狠久久| 777a∨成人精品桃花网| 亚洲一区二区三区爽爽爽爽爽| av在线一区二区三区| 国产欧美精品在线观看| 国产一区在线观看视频| 精品欧美一区二区久久| 老司机午夜精品| 日韩亚洲电影在线| 奇米影视在线99精品| 日韩视频免费观看高清完整版| 亚洲成va人在线观看| 欧美男男青年gay1069videost| 亚洲综合无码一区二区| 在线观看免费一区| 亚洲国产综合91精品麻豆| 欧美视频精品在线| 婷婷综合五月天| 91麻豆精品国产91久久久使用方法 | 久久夜色精品一区| 精品一区精品二区高清| 26uuu精品一区二区三区四区在线| 久久电影国产免费久久电影| 精品三级在线观看| 激情欧美一区二区三区在线观看| 精品国产一区二区三区忘忧草| 久久99国产精品免费| 精品国产凹凸成av人网站| 国产一区二区精品在线观看| 国产喷白浆一区二区三区| 成人免费不卡视频| 亚洲人成在线观看一区二区| 在线视频一区二区免费| 亚洲第一激情av| 日韩欧美国产一区二区三区 | 国产尤物一区二区在线| 久久香蕉国产线看观看99| 成人一区二区三区视频| 亚洲男人天堂av网| 欧美日韩成人综合天天影院| 免费日韩伦理电影| 精品国产亚洲在线| 成人深夜在线观看| 亚洲乱码国产乱码精品精小说| 欧美日韩视频专区在线播放| 青椒成人免费视频| 国产精品色婷婷久久58| 日本高清不卡在线观看| 香蕉乱码成人久久天堂爱免费| 欧美成人a视频| 波多野结衣欧美| 午夜欧美在线一二页| 欧美tk丨vk视频| aaa欧美日韩| 日韩高清在线不卡| 久久久久国产精品免费免费搜索| 91亚洲资源网| 免费成人在线视频观看| 国产精品久久午夜夜伦鲁鲁| 欧美日韩精品是欧美日韩精品| 久草在线在线精品观看| 综合色天天鬼久久鬼色| 欧美一区二区三区视频免费| 国产成人av电影在线播放| 亚洲伊人色欲综合网| 精品国产91乱码一区二区三区| 日本乱人伦aⅴ精品| 麻豆精品在线播放| 亚洲黄色av一区| 久久久亚洲精品石原莉奈| 在线观看一区二区精品视频| 国模套图日韩精品一区二区| 一区二区三区日韩欧美| 欧美成人一区二区三区片免费 | 日韩免费成人网| 色婷婷综合五月| 国产一区91精品张津瑜| 亚洲一级二级三级| 中文字幕的久久| 日韩精品一区二区三区四区视频 | 97aⅴ精品视频一二三区| 免费美女久久99| 一区二区三区中文免费| 精品国产百合女同互慰| 欧美三级视频在线观看| 成人av免费在线播放| 麻豆成人91精品二区三区| 亚洲无人区一区| 国产精品久久99| 国产视频一区二区三区在线观看| 777奇米成人网| 欧美影院精品一区| 成人a免费在线看| 欧美午夜精品久久久久久超碰 | 欧美日韩精品一区二区三区| 北条麻妃国产九九精品视频| 精品一区二区三区在线视频| 午夜久久久影院| 一区二区成人在线视频| 日韩理论片中文av| 欧美韩国一区二区| 久久久99精品久久| 日韩精品自拍偷拍| 欧美一级黄色大片| 欧美精品一二三区| 欧美自拍偷拍一区| 日本黄色一区二区| 色狠狠一区二区| 日本韩国欧美在线| 91丝袜美女网| 91蜜桃网址入口| 在线观看91视频|