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

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

?? pat4f.htm

?? java設計范式.rar
?? HTM
?? 第 1 頁 / 共 2 頁
字號:
<SCRIPT>
function setFocus() {	
	if ((navigator.appName != "Netscape") && (parseFloat(navigator.appVersion) == 2)) {
	return;
	} else {
	self.focus();
	}
}
</SCRIPT><HTML><HEAD>	<TITLE>Flyweight</TITLE></HEAD><BODY	BGCOLOR	= #FFFFFF	TEXT = #000000
onLoad="setFocus()";><A NAME="top"></A><A NAME="Flyweight"></A><A NAME="intent"></A><H2><A HREF="#motivation"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Motivation"></A> Intent</H2> <A NAME="auto1000"></A><P>Use sharing to support large numbers of fine-grained objects efficiently.</P><A NAME="motivation"></A><H2><A HREF="#applicability"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Applicability"></A> Motivation</H2> <A NAME="auto1001"></A><P>Some applications could benefit from using objects throughout theirdesign, but a naive implementation would be prohibitively expensive.</P><A NAME="auto1002"></A><P>For example, most document editor implementations have text formattingand editing facilities that are modularized to some extent.Object-oriented document editors typically use objects to representembedded elements like tables and figures.  However, they usually stopshort of using an object for each character in the document, eventhough doing so would promote flexibility at the finest levels in theapplication. Characters and embedded elements could then be treateduniformly with respect to how they are drawn and formatted. Theapplication could be extended to support new character sets withoutdisturbing other functionality. The application's object structurecould mimic the document's physical structure.  The following diagram shows how a document editor can use objects to represent characters.</P><P ALIGN=CENTER><IMG SRC="Pictures/flywe055.gif"></P><A NAME="auto1003"></A><P>The drawback of such a design is its cost. Even moderate-sizeddocuments may require hundreds of thousands of character objects,which will consume lots of memory and may incur unacceptable run-timeoverhead.  The Flyweight pattern describes how to share objects toallow their use at fine granularities without prohibitive cost.</P><A NAME="def-flywt"></A><A NAME="def-extrinsicstate"></A><A NAME="def-intrinsicstate"></A><P>A <STRONG>flyweight</STRONG> is a shared object that can be used inmultiple contexts simultaneously. The flyweight acts as an independentobject in each context&#151;it's indistinguishable from an instance ofthe object that's not shared. Flyweights cannot make assumptions aboutthe context in which they operate. The key concept here is thedistinction between <STRONG>intrinsic</STRONG> and <STRONG>extrinsic</STRONG>state.  Intrinsic state is stored in the flyweight; it consists ofinformation that's independent of the flyweight's context, therebymaking it sharable.  Extrinsic state depends on and varies with theflyweight's context and therefore can't be shared. Client objects areresponsible for passing extrinsic state to the flyweight when it needsit.</P><A NAME="auto1004"></A><P>Flyweights model concepts or entities that are normally too plentifulto represent with objects. For example, a document editor can create aflyweight for each letter of the alphabet. Each flyweight stores acharacter code, but its coordinate position in the document and itstypographic style can be determined from the text layout algorithmsand formatting commands in effect wherever the character appears. Thecharacter code is intrinsic state, while the other information isextrinsic.</P><A NAME="auto1005"></A><P>Logically there is an object for every occurrence of a given character inthe document:</P><A NAME="flywt-eg-logic"></A><P ALIGN=CENTER><IMG SRC="Pictures/flywe054.gif"></P><A NAME="auto1006"></A><P>Physically, however, there is one shared flyweight object percharacter, and it appears in different contexts in the documentstructure. Each occurrence of a particular character object refers tothe same instance in the shared pool of flyweight objects:</P><P ALIGN=CENTER><IMG SRC="Pictures/flywe052.gif"></P><A NAME="auto1007"></A><P>The class structure for these objects is shown next.  Glyph is theabstract class for graphical objects, some of which may be flyweights.Operations that may depend on extrinsic state have it passed to themas a parameter.  For example, Draw and Intersects must know whichcontext the glyph is in before they can do their job.</P><P ALIGN=CENTER><IMG SRC="Pictures/flywe053.gif"></P><A NAME="auto1008"></A><P>A flyweight representing the letter "a" only stores thecorresponding character code; it doesn't need to store its location orfont. Clients supply the context-dependent information that theflyweight needs to draw itself. For example, a Row glyph knows whereits children should draw themselves so that they are tiledhorizontally.  Thus it can pass each child its location in the drawrequest.</P><A NAME="auto1009"></A><P>Because the number of different character objects is far less than thenumber of characters in the document, the total number of objects issubstantially less than what a naive implementation would use.  Adocument in which all characters appear in the same font and colorwill allocate on the order of 100 character objects (roughly the sizeof the ASCII character set) regardless of the document's length.  Andsince most documents use no more than 10 different font-colorcombinations, this number won't grow appreciably in practice.  Anobject abstraction thus becomes practical for individual characters.</P><A NAME="applicability"></A><H2><A HREF="#structure"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Structure"></A> Applicability</H2> <A NAME="auto1010"></A><P>The Flyweight pattern's effectiveness depends heavily on how and whereit's used. Apply the Flyweight pattern when <EM>all</EM> of the followingare true:</P><UL><A NAME="auto1011"></A><LI>An application uses a large number of objects.</LI><A NAME="auto1012"></A><P></P><A NAME="auto1013"></A><LI>Storage costs are high because of the sheer quantity of objects.</LI><A NAME="auto1014"></A><P></P><A NAME="auto1015"></A><LI>Most object state can be made extrinsic.</LI><A NAME="auto1016"></A><P></P><A NAME="auto1017"></A><LI>Many groups of objects may be replaced by relatively few sharedobjects once extrinsic state is removed.</LI><A NAME="auto1018"></A><P></P><A NAME="auto1019"></A><LI>The application doesn't depend on object identity. Since flyweightobjects may be shared, identity tests will return true for conceptuallydistinct 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/flywe050.gif"></P><A NAME="auto1020"></A><P>The following object diagram shows how flyweights are shared:</P><P ALIGN=CENTER><IMG SRC="Pictures/flywe051.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="auto1021"></A><LI><B>Flyweight</B><A NAME="auto1022"></A><P></P><UL>    <A NAME="auto1023"></A><LI>declares an interface through which flyweights can    receive and act on extrinsic state.</LI></UL><A NAME="auto1024"></A><P></P><A NAME="auto1025"></A><LI><B>ConcreteFlyweight</B> (Character)</LI><A NAME="auto1026"></A><P></P><UL>    <A NAME="auto1027"></A><LI>implements the Flyweight interface and adds storage for    intrinsic state, if any.  A ConcreteFlyweight object must be sharable. Any    state it stores must be intrinsic; that is, it must be    independent of the ConcreteFlyweight object's context.</LI></UL><A NAME="auto1028"></A><P></P><A NAME="unsharconcflywt"></A><LI><B>UnsharedConcreteFlyweight</B> (Row, Column)</LI><A NAME="auto1029"></A><P></P><UL>    <A NAME="auto1030"></A><LI>not all Flyweight subclasses need to be shared.  The    Flyweight interface <EM>enables</EM> sharing; it doesn't enforce it.    It's common for UnsharedConcreteFlyweight objects to have    ConcreteFlyweight objects as children at    some level in the flyweight object structure    (as the Row and Column classes have).</LI></UL><A NAME="auto1031"></A><P></P><A NAME="flywtfact-part"></A><LI><B>FlyweightFactory</B></LI><A NAME="auto1032"></A><P></P><UL>    <A NAME="auto1033"></A><LI>creates and manages flyweight objects.</LI>    <A NAME="auto1034"></A><P><!-- extra space --></P>    <A NAME="auto1035"></A><LI>ensures that flyweights are shared properly.    When a client requests a flyweight, the FlyweightFactory object supplies    an existing instance or creates one, if none exists.</UL><A NAME="auto1036"></A><P></P><A NAME="auto1037"></A><LI><B>Client</B></LI><A NAME="auto1038"></A><P></P><UL>    <A NAME="auto1039"></A><LI>maintains a reference to flyweight(s).</LI>    <A NAME="auto1040"></A><P><!-- extra space --></P>    <A NAME="auto1041"></A><LI>computes or stores the extrinsic state of flyweight(s).</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="auto1042"></A><LI>State that a flyweight needs to function must be characterized aseither intrinsic or extrinsic. Intrinsic state is stored in theConcreteFlyweight object; extrinsic state is stored or computed byClient objects. Clients pass this state to the flyweight whenthey invoke its operations.</LI><A NAME="auto1043"></A><P></P><A NAME="auto1044"></A><LI>Clients should not instantiate ConcreteFlyweights directly. Clientsmust obtain ConcreteFlyweight objects exclusively from theFlyweightFactory object to ensure they are shared properly.</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="auto1045"></A><P>Flyweights may introduce run-time costs associated with transferring,finding, and/or computing extrinsic state, especially if it wasformerly stored as intrinsic state. However, such costs are offset byspace savings, which increase as more flyweights are shared.</P><A NAME="auto1046"></A><P>Storage savings are a function of several factors:</P><UL><A NAME="auto1047"></A><LI>the reduction in the total number of instances that comes fromsharing</LI><A NAME="auto1048"></A><P></P><A NAME="auto1049"></A><LI>the amount of intrinsic state per object</LI><A NAME="auto1050"></A><P></P><A NAME="auto1051"></A><LI>whether extrinsic state is computed or stored.</LI></UL><A NAME="auto1052"></A><P>The more flyweights are shared, the greater the storage savings.  Thesavings increase with the amount of shared state.  The greatestsavings occur when the objects use substantial quantities of bothintrinsic and extrinsic state, and the extrinsic state can be computedrather than stored.  Then you save on storage in two ways: Sharingreduces the cost of intrinsic state, and you trade extrinsic state forcomputation time.</P><A NAME="flywt-w-compst"></A><P>The Flyweight pattern is often combined with the<A HREF="pat4cfs.htm" TARGET="_mainDisplayFrame">Composite (163)</A> pattern to represent a hierarchicalstructure as a graph with shared leaf nodes.  A consequence of sharingis that flyweight leaf nodes cannot store a pointer to their parent.Rather, the parent pointer is passed to the flyweight as part of itsextrinsic state.  This has a major impact on how the objects in thehierarchy communicate with each other.</P><A NAME="implementation"></A><H2><A HREF="#samplecode"><IMG SRC="gifsb/down3.gif" BORDER=0 ALT="next: Sample Code"></A> Implementation</H2> <A NAME="auto1053"></A><P>Consider the following issues when implementing the Flyweight pattern:</P><OL><A NAME="auto1054"></A><LI><EM>Removing extrinsic state.</EM>The pattern's applicability is determined largely by how easy it is toidentify extrinsic state and remove it from shared objects.  Removingextrinsic state won't help reduce storage costs if there are as manydifferent kinds of extrinsic state as there are objects beforesharing. Ideally, extrinsic state can be computed from a separateobject structure, one with far smaller storage requirements.<A NAME="auto1055"></A><P>In our document editor, for example, we can store a map of typographicinformation in a separate structure rather than store the font andtype style with each character object. The map keeps track of runs ofcharacters with the same typographic attributes. When a characterdraws itself, it receives its typographic attributes as a side-effectof the draw traversal. Because documents normally use just a fewdifferent fonts and styles, storing this information externally toeach character object is far more efficient than storing itinternally.</P>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99国产精品视频免费观看| 欧美岛国在线观看| 99免费精品在线| 国产成人精品一区二区三区四区 | 欧美一区二区三区精品| 欧美日韩精品三区| 在线观看免费一区| 欧美天堂一区二区三区| 欧美性videosxxxxx| 欧美视频精品在线观看| 911精品产国品一二三产区| 7799精品视频| 日韩欧美激情四射| 欧美不卡一二三| 久久这里只精品最新地址| 久久久亚洲精华液精华液精华液| 久久蜜桃香蕉精品一区二区三区| 26uuu另类欧美亚洲曰本| 久久精品亚洲乱码伦伦中文| 国产精品视频一二三| 亚洲日本在线a| 夜夜嗨av一区二区三区网页| 午夜国产精品一区| 麻豆精品新av中文字幕| 国产精品一区二区在线观看不卡 | 日韩av一区二| 国产美女在线精品| 99精品视频一区二区| 精品视频在线免费看| 欧美一区二区视频在线观看 | 日本vs亚洲vs韩国一区三区二区 | 成人激情综合网站| 在线观看日韩电影| 精品日韩一区二区三区| 日本一区二区免费在线观看视频 | 亚洲视频精选在线| 亚洲国产成人高清精品| 精品无码三级在线观看视频| 成人禁用看黄a在线| 精品视频资源站| 久久久一区二区三区| 亚洲综合色噜噜狠狠| 精品一区二区三区不卡| 91色综合久久久久婷婷| 91精品国产欧美一区二区18| 国产欧美日韩在线看| 亚洲亚洲精品在线观看| 国产一区二区三区香蕉| 在线观看av一区二区| 欧美本精品男人aⅴ天堂| 中文字幕中文字幕在线一区 | 国产在线不卡一卡二卡三卡四卡| 国产69精品久久777的优势| 欧美三区在线视频| 亚洲国产精品二十页| 日韩综合一区二区| 99精品视频在线免费观看| 日韩美女在线视频| 一区二区三区四区高清精品免费观看| 久久草av在线| 欧洲一区在线电影| 久久亚洲综合av| 亚洲第一激情av| 不卡一区中文字幕| 精品国产污网站| 一级日本不卡的影视| 国产福利91精品一区二区三区| 欧美午夜一区二区三区| 国产精品亲子伦对白| 久久99热这里只有精品| 欧美三级日本三级少妇99| 欧美激情一区在线观看| 裸体歌舞表演一区二区| 在线观看一区二区精品视频| 国产精品理论片在线观看| 天使萌一区二区三区免费观看| 不卡的av网站| 久久婷婷色综合| 日本中文在线一区| 精品视频1区2区3区| 国产精品久久久久久久久久久免费看 | 欧美日韩国产美女| 自拍偷拍欧美激情| 国产成人综合网| 精品少妇一区二区三区视频免付费| 亚洲一区二区精品久久av| 波多野洁衣一区| 国产视频亚洲色图| 韩国精品久久久| 日韩精品一区在线| 日本亚洲免费观看| 欧美亚洲动漫另类| 亚洲嫩草精品久久| a4yy欧美一区二区三区| 国产精品久久久久天堂| 大尺度一区二区| 久久九九久久九九| 国产伦精品一区二区三区在线观看 | 日韩视频一区二区| 石原莉奈一区二区三区在线观看| 欧美亚洲一区三区| 一区二区三区久久| 91福利国产成人精品照片| 亚洲视频一区二区在线| 91色.com| 亚洲二区在线视频| 4438x亚洲最大成人网| 日韩成人免费看| 日韩欧美成人一区| 久久成人免费网站| 久久影院电视剧免费观看| 国产成人精品在线看| 日本一区二区视频在线观看| 成人久久久精品乱码一区二区三区| 国产日本欧美一区二区| 99久久99久久久精品齐齐| 亚洲乱码精品一二三四区日韩在线| 色久优优欧美色久优优| 亚洲制服丝袜在线| 欧美喷潮久久久xxxxx| 蜜臀a∨国产成人精品| 精品不卡在线视频| 国产99久久久久久免费看农村| 国产精品国产成人国产三级 | 久久无码av三级| 成人性色生活片免费看爆迷你毛片| 国产精品美女视频| 91美女片黄在线| 日韩精品一级中文字幕精品视频免费观看 | 亚洲gay无套男同| 日韩一区二区三区四区五区六区| 久久国产夜色精品鲁鲁99| 精品裸体舞一区二区三区| 福利一区在线观看| 亚洲综合色婷婷| 精品欧美一区二区久久 | 精品久久久久99| 懂色av一区二区三区免费观看| 最近日韩中文字幕| 欧美日韩成人一区| 国产激情一区二区三区四区| 一区二区三区在线影院| 日韩精品中午字幕| 91丨porny丨蝌蚪视频| 日韩精品每日更新| 国产欧美久久久精品影院| 欧美日韩一区二区不卡| 国产精品一区二区在线观看不卡 | 99久久国产综合精品色伊| 亚洲成人在线网站| 欧美国产欧美综合| 在线电影一区二区三区| 国产成人综合视频| 天堂成人国产精品一区| 国产精品免费看片| 制服丝袜中文字幕亚洲| 成人高清在线视频| 日韩国产欧美一区二区三区| 亚洲欧美一区二区在线观看| 欧美一区二区三区爱爱| youjizz国产精品| 蜜桃视频免费观看一区| 亚洲欧洲中文日韩久久av乱码| 日韩欧美一级精品久久| 色综合视频在线观看| 激情欧美一区二区| 亚洲香肠在线观看| 国产精品乱码妇女bbbb| 精品少妇一区二区三区| 欧美日韩三级视频| 成人av手机在线观看| 国内精品久久久久影院一蜜桃| 亚洲尤物在线视频观看| 国产欧美精品一区二区色综合朱莉 | 在线视频你懂得一区| 国产精品亚洲成人| 日本一不卡视频| 亚洲自拍另类综合| 1区2区3区国产精品| 欧美mv日韩mv国产网站| 91.麻豆视频| 欧美色图免费看| 色综合中文字幕国产 | 色屁屁一区二区| 国产suv精品一区二区883| 麻豆中文一区二区| 亚洲成年人影院| 亚洲一区二区三区视频在线播放 | 亚洲理论在线观看| 亚洲欧美综合在线精品| 中文字幕av资源一区| 久久精品水蜜桃av综合天堂| 日韩精品中文字幕一区二区三区 | 欧美色老头old∨ideo| 91一区二区在线观看| 成人久久久精品乱码一区二区三区| 国产九九视频一区二区三区| 精品一区二区av| 蜜臀久久久久久久| 日韩二区三区在线观看|