亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
国内精品视频666| 日韩国产在线观看| heyzo一本久久综合| 国产欧美精品一区aⅴ影院| 懂色av中文一区二区三区 | 国产一本一道久久香蕉| 精品国产露脸精彩对白| 国产成a人亚洲| 夜夜嗨av一区二区三区中文字幕| 欧美曰成人黄网| 免费精品99久久国产综合精品| 欧美成人官网二区| 懂色av一区二区三区免费看| 亚洲精品欧美激情| 欧美精品在线视频| 国产一区二区三区黄视频 | 久久蜜桃av一区精品变态类天堂| 成人免费福利片| 亚洲在线免费播放| 欧美电影免费观看高清完整版 | 99国产一区二区三精品乱码| 亚洲一区二区美女| 欧美r级在线观看| 91麻豆国产在线观看| 亚洲.国产.中文慕字在线| 欧美成人a∨高清免费观看| 成人国产精品免费观看| 日韩中文字幕亚洲一区二区va在线 | 91网站视频在线观看| 亚洲国产成人91porn| 2023国产精品| 91在线免费播放| 日韩精品久久理论片| 国产精品国产成人国产三级| 欧美另类z0zxhd电影| 国产成人精品午夜视频免费 | 日本一区二区不卡视频| 欧美亚洲尤物久久| 国产91丝袜在线18| 日韩精品免费视频人成| 中文字幕欧美一区| 精品欧美一区二区久久| 一本一道久久a久久精品| 狠狠狠色丁香婷婷综合激情 | av毛片久久久久**hd| 蜜桃视频第一区免费观看| 亚洲欧洲韩国日本视频| 久久色在线观看| 91精品午夜视频| 在线观看欧美日本| 99视频在线观看一区三区| 韩国欧美国产1区| 日韩精品每日更新| 亚洲综合男人的天堂| 欧美国产欧美综合| 久久这里只精品最新地址| 欧美浪妇xxxx高跟鞋交| 欧洲精品视频在线观看| 99re热视频精品| 国产成人精品www牛牛影视| 久久99国产精品免费网站| 午夜一区二区三区在线观看| 亚洲欧美一区二区三区久本道91| 国产欧美精品区一区二区三区| 精品国精品国产| 精品国产污污免费网站入口| 欧美一级欧美一级在线播放| 欧美美女一区二区在线观看| 欧美三级视频在线| 欧美日韩在线免费视频| 欧美无乱码久久久免费午夜一区| 99久久免费视频.com| 成人妖精视频yjsp地址| 国产福利一区二区三区视频| 国产乱色国产精品免费视频| 国产一区福利在线| 国产乱人伦偷精品视频免下载| 国产乱子伦视频一区二区三区| 国产尤物一区二区在线| 国产精品系列在线观看| 国产99久久久国产精品| 99视频在线精品| 91激情五月电影| 欧美日韩国产色站一区二区三区| 欧美久久久久久蜜桃| 日韩精品中午字幕| 久久综合九色综合97婷婷| 国产日韩欧美麻豆| 国产精品福利一区| 亚洲黄色录像片| 日韩电影在线免费看| 精品综合免费视频观看| 国产成人综合亚洲91猫咪| kk眼镜猥琐国模调教系列一区二区| 成人av片在线观看| 欧美日韩精品二区第二页| 欧美一区二区三区免费视频| 久久综合色播五月| 中文字幕亚洲不卡| 亚洲成人一区二区在线观看| 美女尤物国产一区| 国产91丝袜在线观看| 日本韩国欧美一区| 欧美成人三级在线| 亚洲日本中文字幕区| 亚洲成年人影院| 国产裸体歌舞团一区二区| 99麻豆久久久国产精品免费| 欧美日韩一级黄| 国产视频一区二区三区在线观看| 一区精品在线播放| 婷婷成人综合网| 成人午夜大片免费观看| 欧美三级欧美一级| 国产亚洲一本大道中文在线| 亚洲大片精品永久免费| 国产毛片一区二区| 欧美理论片在线| 国产精品美女久久久久久久久久久 | 欧美国产激情一区二区三区蜜月| 中文字幕乱码日本亚洲一区二区| 一片黄亚洲嫩模| 国产一区二区三区综合| 欧洲av在线精品| 国产三级精品三级| 日本在线不卡视频一二三区| aaa欧美大片| 精品三级在线观看| 亚洲综合久久av| 成人深夜福利app| 精品国产一区久久| 亚洲一区二区在线免费观看视频 | 北条麻妃一区二区三区| 91精品婷婷国产综合久久| 亚洲三级在线观看| 国产麻豆精品theporn| 在线播放亚洲一区| 亚洲美女偷拍久久| 成人av电影在线| 26uuu另类欧美亚洲曰本| 性做久久久久久免费观看| 972aa.com艺术欧美| 久久精品视频网| 精品一二三四区| 91精品久久久久久久99蜜桃 | 天天影视色香欲综合网老头| 成人av影视在线观看| 欧美电影免费观看高清完整版在线 | 26uuu欧美日本| 日本一区二区三区四区在线视频| 中文字幕一区二区三区精华液| 美女视频一区二区| 欧美日韩精品免费观看视频 | 美国十次综合导航| 欧美三级日韩三级| 亚洲精品高清在线| 色综合网色综合| 日本一区二区成人| 国产98色在线|日韩| 欧美极品另类videosde| 国产一区视频在线看| 日韩你懂的在线观看| 美脚の诱脚舐め脚责91 | 精品免费日韩av| 青青草91视频| 欧美不卡在线视频| 亚洲gay无套男同| 国产成人免费视频网站高清观看视频 | 亚洲欧美日本在线| 99精品欧美一区| 五月婷婷色综合| 日本电影欧美片| 亚洲男帅同性gay1069| 91亚洲国产成人精品一区二区三| 中文字幕国产精品一区二区| 成人免费高清视频在线观看| 中文字幕一区二区三中文字幕| 91首页免费视频| 亚洲高清久久久| 欧美一区中文字幕| 国内成+人亚洲+欧美+综合在线| 日韩精品在线一区二区| 国产在线一区二区综合免费视频| 久久这里只有精品视频网| 成人综合婷婷国产精品久久蜜臀| 国产精品毛片a∨一区二区三区| 99久久久精品| 天堂在线亚洲视频| 久久久久久久精| 91福利资源站| 久久精品国产99国产精品| 久久久国际精品| 色乱码一区二区三区88| 日精品一区二区三区| 久久久影视传媒| 欧美在线一二三| 麻豆中文一区二区| 国产精品久久久久久久久免费丝袜 | 欧美自拍偷拍一区| 欧美a级理论片|