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

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

?? pat5i.htm

?? java設計范式.rar
?? HTM
?? 第 1 頁 / 共 2 頁
字號:
<HTML><HEAD><TITLE>Strategy</TITLE><SCRIPT>function setFocus() {		if ((navigator.appName != "Netscape") && (parseFloat(navigator.appVersion) == 2)) {	return;	} else {	self.focus();	}}</SCRIPT></HEAD><BODY   BGCOLOR         = #FFFFFF onLoad="setFocus()";><A NAME="top"></A><A NAME="Strategy"></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>Define a family of algorithms, encapsulate each one, and make theminterchangeable.  Strategy lets the algorithm vary independently fromclients that use it.</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>Policy</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>Many algorithms exist for breaking a stream of text into lines.Hard-wiring all such algorithms into the classes that require themisn't desirable for several reasons:</P><UL><A NAME="auto1003"></A><LI>Clients that need linebreaking get more complex if they includethe linebreaking code.  That makes clients bigger and harder tomaintain, especially if they support multiple linebreaking algorithms.</LI><A NAME="auto1004"></A><P></P><A NAME="auto1005"></A><LI>Different algorithms will be appropriate at different times.  We don'twant to support multiple linebreaking algorithms if we don't use themall.</LI><A NAME="auto1006"></A><P></P><A NAME="auto1007"></A><LI>It's difficult to add new algorithms and vary existing ones whenlinebreaking is an integral part of a client.</LI></UL><A NAME="def-strategy"></A><P>We can avoid these problems by defining classes that encapsulatedifferent linebreaking algorithms. An algorithm that's encapsulated inthis way is called a <STRONG>strategy</STRONG>.</P><A NAME="315c"></A><P ALIGN=CENTER><IMG SRC="Pictures/strat011.gif"></P><A NAME="compositor"></A><P>Suppose a Composition class is responsible for maintaining andupdating the linebreaks of text displayed in a text viewer.Linebreaking strategies aren't implemented by the class Composition.Instead, they are implemented separately by subclasses of the abstractCompositor class. Compositor subclasses implement different strategies:</P><UL><A NAME="simplecompositor"></A><LI><STRONG>SimpleCompositor</STRONG>implements a simple strategy that determines linebreaks one at atime.</LI><A NAME="auto1008"></A><P></P><A NAME="tex-comp"></A><LI><STRONG>TeXCompositor</STRONG>implements the TeX algorithm for finding linebreaks. This strategytries to optimize linebreaks globally, that is, one paragraph at atime.</LI><A NAME="auto1009"></A><P></P><A NAME="auto1010"></A><LI><STRONG>ArrayCompositor</STRONG>implements a strategy that selects breaks so that each row has a fixednumber of items.  It's useful for breaking a collection of icons intorows, for example.</LI></UL><A NAME="auto1011"></A><P>A Composition maintains a reference to a Compositor object. Whenever aComposition reformats its text, it forwards this responsibility to itsCompositor object. The client of Composition specifies whichCompositor should be used by installing the Compositor it desires intothe Composition.</P><A NAME="applicability"></A><H2><A HREF="#structure"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Structure"></A> Applicability</H2> <A NAME="auto1012"></A><P>Use the Strategy pattern when</P><UL><A NAME="auto1013"></A><LI>many related classes differ only in their behavior.  Strategiesprovide a way to configure a class with one of many behaviors.</LI><A NAME="auto1014"></A><P></P><A NAME="auto1015"></A><LI>you need different variants of an algorithm. For example, you might definealgorithms reflecting different space/time trade-offs.Strategies can be used when these variants are implemented as a classhierarchy of algorithms [<A HREF="bibfs.htm#halbert-obrien" TARGET="_mainDisplayFrame">HO87</A>].</LI><A NAME="auto1016"></A><P></P><A NAME="auto1017"></A><LI>an algorithm uses data that clients shouldn't know about. Use theStrategy pattern to avoid exposing complex, algorithm-specific datastructures.</LI><A NAME="auto1018"></A><P></P><A NAME="auto1019"></A><LI>a class defines many behaviors, and these appear as multipleconditional statements in its operations. Instead of manyconditionals, move related conditional branches into their ownStrategy class.</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="strat-316c"></A><P ALIGN=CENTER><IMG SRC="Pictures/strategy.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="auto1020"></A><LI><B>Strategy</B> (Compositor)</LI><A NAME="auto1021"></A><P></P>    <UL>    <A NAME="auto1022"></A><LI>declares an interface common to all supported algorithms.    Context uses this interface to call the    algorithm defined by a ConcreteStrategy.</LI>    </UL><A NAME="auto1023"></A><P></P><A NAME="auto1024"></A><LI><B>ConcreteStrategy</B> (SimpleCompositor, TeXCompositor,ArrayCompositor)</LI><A NAME="auto1025"></A><P></P>    <UL>    <A NAME="auto1026"></A><LI>implements the algorithm using the Strategy interface.</LI>    </UL><A NAME="auto1027"></A><P></P><A NAME="auto1028"></A><LI><B>Context</B> (Composition)<A NAME="auto1029"></A><P></P>    <UL>    <A NAME="auto1030"></A><LI>is configured with a ConcreteStrategy object.</LI>    <A NAME="auto1031"></A><P><!-- extra space --></P>    <A NAME="auto1032"></A><LI>maintains a reference to a Strategy object.</LI>    <A NAME="auto1033"></A><P><!-- extra space --></P>    <A NAME="auto1034"></A><LI>may define an interface that lets Strategy access its data.</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>Strategy and Context interact to implement the chosen algorithm.  Acontext may pass all data required by the algorithm to the strategywhen the algorithm is called. Alternatively, the context can passitself as an argument to Strategy operations. That lets the strategycall back on the context as required.</LI><A NAME="auto1036"></A><P></P><A NAME="auto1037"></A><LI>A context forwards requests from its clients to its strategy.  Clientsusually create and pass a ConcreteStrategy object to the context;thereafter, clients interact with the context exclusively. There isoften a family of ConcreteStrategy classes for a client to choosefrom.</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="auto1038"></A><P>The Strategy pattern has the following benefits and drawbacks:</P><OL><A NAME="families"></A><LI><EM>Families of related algorithms.</EM>Hierarchies of Strategy classes define a family of algorithms orbehaviors for contexts to reuse. Inheritance canhelp factor out common functionality of the algorithms.</LI><A NAME="auto1039"></A><P></P><A NAME="auto1040"></A><LI><EM>An alternative to subclassing.</EM>Inheritance offers another way to support a variety of algorithms orbehaviors. You can subclass a Context class directly to give itdifferent behaviors. But this hard-wires the behavior into Context.It mixes the algorithm implementation with Context's, making Contextharder to understand, maintain, and extend. And you can't vary thealgorithm dynamically. You wind up with many related classes whoseonly difference is the algorithm or behavior they employ.Encapsulating the algorithm in separate Strategy classes lets you varythe algorithm independently of its context, making it easier toswitch, understand, and extend.</LI><A NAME="auto1041"></A><P></P><A NAME="auto1042"></A><LI><EM>Strategies eliminate conditional statements.</EM>The Strategy pattern offers an alternative to conditional statements forselecting desired behavior. When different behaviors are lumped into oneclass, it's hard to avoid using conditional statements to select theright behavior. Encapsulating the behavior in separate Strategy classeseliminates these conditional statements.<A NAME="auto1043"></A><P>For example, without strategies, the code for breakingtext into lines could look like<A NAME="auto1044"></A><PRE>    void Composition::Repair () {        switch (_breakingStrategy) {        case SimpleStrategy:            ComposeWithSimpleCompositor();            break;        case TeXStrategy:            ComposeWithTeXCompositor();            break;        // ...        }        // merge results with existing composition, if necessary    }</PRE><A NAME="auto1045"></A><P>The Strategy pattern eliminates this case statement by delegating thelinebreaking task to a Strategy object:</P><A NAME="auto1046"></A><PRE>    void Composition::Repair () {        _compositor->Compose();        // merge results with existing composition, if necessary    }</PRE><A NAME="auto1047"></A><P>Code containing many conditional statements often indicatesthe need to apply the Strategy pattern.</P></LI><A NAME="auto1048"></A><P></P><A NAME="auto1049"></A><LI><EM>A choice of implementations.</EM>Strategies can provide different implementations of the <EM>same</EM>behavior. The client can choose among strategies with differenttime and space trade-offs.</LI><A NAME="auto1050"></A><P></P><A NAME="auto1051"></A><LI><EM>Clients must be aware of different Strategies.</EM>The pattern has a potential drawback in that a client must understandhow Strategies differ before it can select the appropriate one.Clients might be exposed to implementation issues.  Therefore youshould use the Strategy pattern only when the variation in behavior isrelevant to clients.</LI><A NAME="auto1052"></A><P></P><A NAME="auto1053"></A><LI><EM>Communication overhead between Strategy and Context.</EM>The Strategy interface is shared by all ConcreteStrategy classeswhether the algorithms they implement are trivial or complex.  Henceit's likely that some ConcreteStrategies won't use all the informationpassed to them through this interface; simple ConcreteStrategies mayuse none of it!  That means there will be times when the contextcreates and initializes parameters that never get used. If this is anissue, then you'll need tighter coupling between Strategy and Context.</LI><A NAME="auto1054"></A><P></P><A NAME="auto1055"></A><LI><EM>Increased number of objects.</EM>Strategies increase the number of objects in an application. Sometimesyou can reduce this overhead by implementing strategies as statelessobjects that contexts can share. Any residual state is maintained by thecontext, which passes it in each request to the Strategy object. Sharedstrategies should not maintain state across invocations. The<A HREF="pat4ffs.htm" TARGET="_mainDisplayFrame">Flyweight (195</A>) pattern describes this approach in more

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕一区二区三区蜜月| 播五月开心婷婷综合| 欧美妇女性影城| 日韩va亚洲va欧美va久久| 91麻豆精品国产自产在线| 日韩黄色免费网站| 欧美刺激午夜性久久久久久久| 蜜桃视频在线一区| 久久久不卡影院| 色偷偷成人一区二区三区91| 洋洋成人永久网站入口| 91精品欧美综合在线观看最新| 久久国产精品色婷婷| 久久久国产精品不卡| 精品国产欧美一区二区| 激情久久五月天| 一区二区三区精品久久久| 欧美绝品在线观看成人午夜影视| 久久se这里有精品| 一区二区三区中文字幕在线观看| 日韩一级片网址| 欧美在线一区二区三区| 国产毛片精品一区| 亚洲大片免费看| 国产精品午夜免费| 91精品国产综合久久久久久| www.综合网.com| 国产成人亚洲综合a∨婷婷| 奇米777欧美一区二区| 中文幕一区二区三区久久蜜桃| 欧美一区二区在线免费观看| 色婷婷av一区二区三区之一色屋| 大桥未久av一区二区三区中文| 日韩电影在线看| 亚洲妇女屁股眼交7| 一区二区三区成人| 夜色激情一区二区| 亚洲成人免费看| 亚洲一区二区三区自拍| 国产精品电影一区二区| 亚洲国产高清aⅴ视频| 国产精品拍天天在线| 久久精品人人做人人综合| 久久久精品日韩欧美| 久久综合网色—综合色88| 久久久久99精品国产片| 久久综合久久综合亚洲| 国产网站一区二区| 亚洲天天做日日做天天谢日日欢| 亚洲午夜精品17c| 国内精品视频一区二区三区八戒| 蜜臀av国产精品久久久久| 九九九精品视频| 成人污污视频在线观看| 丁香六月久久综合狠狠色| 91免费版在线看| 欧美男女性生活在线直播观看| 欧美精品在线观看播放| 久久久国际精品| 一区二区三区四区在线| 日本不卡1234视频| 成人免费毛片片v| 欧美日韩欧美一区二区| 精品国产麻豆免费人成网站| 中文成人av在线| 日韩av中文字幕一区二区三区| 激情综合网天天干| 91成人在线精品| 久久综合久久综合亚洲| 午夜精彩视频在线观看不卡| 国产成人免费9x9x人网站视频| 在线观看免费成人| 国产欧美日韩久久| 麻豆久久久久久| 欧美在线观看禁18| 亚洲视频一二区| 国产毛片精品一区| 日韩精品一区二区在线观看| 亚洲女同女同女同女同女同69| 激情伊人五月天久久综合| 欧美日韩三级在线| 亚洲国产成人高清精品| 99国产精品久久久久久久久久 | 中文无字幕一区二区三区| 91视频精品在这里| 日韩欧美不卡一区| 亚洲成人www| 51久久夜色精品国产麻豆| 中文无字幕一区二区三区| 国产馆精品极品| 久久久午夜精品理论片中文字幕| 午夜av区久久| 91麻豆精品国产91久久久使用方法| 亚洲一区二区三区自拍| 91精品国产91综合久久蜜臀| 日韩va欧美va亚洲va久久| 欧美巨大另类极品videosbest| 夜夜嗨av一区二区三区中文字幕 | 国产v综合v亚洲欧| 国产精品嫩草影院com| 99久久久国产精品| 午夜精品福利一区二区三区av| 欧美精品v日韩精品v韩国精品v| 午夜电影久久久| 久久综合九色综合欧美亚洲| 国产精品66部| 亚洲一区在线视频观看| 日韩免费成人网| av在线一区二区| 午夜精品视频在线观看| 欧美国产激情二区三区| 一本大道久久a久久综合| 日本欧洲一区二区| 亚洲色图都市小说| 久久久天堂av| 欧美精品九九99久久| 国产不卡免费视频| 日韩国产精品久久久久久亚洲| 亚洲国产wwwccc36天堂| 久久久99精品免费观看| 国产精品理伦片| 欧美精品日韩一本| 99re这里只有精品视频首页| 免费观看一级欧美片| 亚洲v日本v欧美v久久精品| 国产精品天干天干在线综合| 欧美一区二区三区思思人| 成人激情文学综合网| 国产精品亚洲第一区在线暖暖韩国| 亚洲午夜精品久久久久久久久| 老汉av免费一区二区三区| 亚洲国产精品麻豆| 亚洲激情自拍视频| 成人免费一区二区三区视频| 日本一区二区电影| 精品国产a毛片| 26uuu亚洲| 久久久综合视频| 2020日本不卡一区二区视频| 欧美大白屁股肥臀xxxxxx| 欧美一区二区久久久| 日韩一二在线观看| 精品免费日韩av| 久久久精品免费观看| 国产精品网站导航| 亚洲欧美激情一区二区| 亚洲欧洲成人av每日更新| 亚洲天堂网中文字| 亚洲福利视频三区| 日日摸夜夜添夜夜添精品视频| 香蕉影视欧美成人| 久久精工是国产品牌吗| 韩国午夜理伦三级不卡影院| 成人不卡免费av| 在线观看一区二区视频| 欧美一区二区三区在线看| 欧美国产精品一区二区三区| 亚洲国产精品久久人人爱蜜臀| 麻豆精品久久精品色综合| www.亚洲精品| 日韩欧美成人一区二区| 亚洲精品免费在线观看| 亚洲动漫第一页| 国产高清无密码一区二区三区| 91丨九色丨尤物| 精品美女被调教视频大全网站| 秋霞午夜av一区二区三区| 国产精一区二区三区| 欧美色区777第一页| 中文字幕精品一区二区三区精品| 亚洲自拍偷拍图区| 国产成人在线影院 | 久久国产精品99久久人人澡| 99亚偷拍自图区亚洲| 精品国产一区二区精华| 亚洲国产欧美在线| 不卡一区二区三区四区| 久久久国产午夜精品| 久久精品国产网站| 欧美一区二区人人喊爽| 五月天激情综合网| 日本精品视频一区二区三区| 日本一区二区在线不卡| 国产二区国产一区在线观看| 欧美一区二区三区播放老司机| 亚洲一区二区成人在线观看| 91免费版在线| 亚洲蜜臀av乱码久久精品蜜桃| 99精品久久久久久| 一区二区三区在线视频观看| 成人动漫视频在线| 国产精品美女久久久久久久久| 国产精品99久久久久久似苏梦涵| 精品福利一二区| 国产精品一卡二卡在线观看| 国产精品天美传媒| 91国模大尺度私拍在线视频| 亚洲成人免费观看| 亚洲精品一区二区三区在线观看| 九色|91porny|