⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 swarm.defobj.customize.protocol.html

📁 set for Swarm2.1是圣菲研究院的开发人员对Swarm的特性及其使用描述的最为完备的指南性文档。从这里可以获得最细致的平台说明。
💻 HTML
字号:
<HTML><HEAD><TITLE>Customize</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.53"><LINKREL="HOME"TITLE="Documentation Set for Swarm 2.1.1"HREF="set.html"><LINKREL="UP"TITLE="Defobj Library"HREF="swarm.defobj.sgml.reference.html"><LINKREL="PREVIOUS"TITLE="CreatedClass"HREF="swarm.defobj.createdclass.protocol.html"><LINKREL="NEXT"TITLE="DefinedClass"HREF="swarm.defobj.definedclass.protocol.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">Documentation Set for Swarm 2.1.1</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="swarm.defobj.createdclass.protocol.html">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Reference I. Defobj Library</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="swarm.defobj.definedclass.protocol.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><H1><ANAME="SWARM.DEFOBJ.CUSTOMIZE.PROTOCOL">Customize</A></H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN3036"></A><H2>Name</H2>Customize&nbsp;--&nbsp; Create-phase customization.</DIV><DIVCLASS="REFSECT1"><ANAME="AEN3039"></A><H2>Description</H2><P> Some types accept create-time messages not only when creating a new instance, but to customize a new version of the type itself.  Objects created from a customized type will have all options preset that create-time messages sent to the customized type object have already set.  If many objects all need the same create-time options, it is often simpler (and can also be faster) to create a customized version of a type first, and then create further instances from that type.</P><P> Customizing a type object does not modify the original type object, but instead creates a new type object that has the customizations built-in.  A create: message on the new type object creates a new instance as if the same sequence of create-time messages had been sent to the original type object using createBegin: and createEnd. A type is customized by bracketing the sequence of create-time messages not with the createBegin: and createEnd messages used to create a new instance, but with customizeBegin: and customizeEnd messages instead.</P><P> Whether a customized version of a type can be created depends on the implementation of the type itself.  If a type does not support customization, a customizeBegin: message on the type raises an error. All types defined by an @protocol declaration may be relied on to support at least one cycle of customization to create a new type object.  Whether an already customized type object (returned by customizeEnd) supports a further cycle of customization (by another sequence of customizeBegin:/customizeEnd) depends on the implementation of the original starting type.  A type should not be relied on to support more than one cycle of customization unless it is specifically documented to do so.</P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN3044"></A><H2>Protocols adopted by Customize</H2><P>None</P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN3047"></A><H2>Methods</H2><DIVCLASS="REFSECT2"><ANAME="AEN3049"></A><H3>Phase: Creating</H3><P></P><UL><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.CUSTOMIZE.METHOD.PC.M55"></A><P></P>+ <BCLASS="FUNCPROTOTYPE">customizeBegin:</B> <VARCLASS="PDPARAM">aZone</VAR> <BR> Returns an interim value for receiving create-time messages much like createBegin:.<BR> The zone passed to customizeBegin: is the same zone from which storage for the new, finalized type object will be taken.  This zone need not be the same as any instance later created from that type, since a new zone argument is still passed in any subsequent create message on that type.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.CUSTOMIZE.METHOD.PC.M243"></A><P></P>- <BCLASS="FUNCPROTOTYPE">customizeEnd</B><BR> Returns the new, customized version of the original type.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.DEFOBJ.CUSTOMIZE.METHOD.PC.M242"></A><P></P>- <BCLASS="FUNCPROTOTYPE">customizeCopy:</B> <VARCLASS="PDPARAM">aZone</VAR> <BR> The customizeCopy: message creates a new copy of the interim object returned by customizeBegin: which may be used for further customizations that do not affect the customization already in progress.  It may be used to branch off a path of a customization in progress to create an alternate final customization. <BR> customizeCopy may be used only on an interim object returned by customizeBegin: and not yet finalized by customizeEnd.  The new version of the interim object being customized may be allocated in the same or different zone as the original version, using the zone argument required by customizeCopy:<P></P></DIV><DIVCLASS="EXAMPLE"><ANAME="SWARM.DEFOBJ.CUSTOMIZE.-CUSTOMIZECOPY.1.EXAMPLE"></A><P><B>Example defobj/Customize/-customizeCopy:/1. </B></P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="90%"><TR><TD><PRECLASS="PROGRAMLISTING"> newArrayType1 = [Array customizeBegin: aZone]; [newArrayType1 setCount: 100]; newArrayType2 = [newArrayType2 customizeCopy: aZone]; [newArrayType2 setDefaultMember: UnsetMember]; newArrayType1 = [newArrayType1 customizeEnd];  newArrayType2 = [newArrayType2 customizeEnd]; array1 = [newArrayType1 create: aZone];  // no DefaultMember option array2 = [newArrayType create: aZone];   // DefaultMember option set</PRE></TD></TR></TABLE></DIV></LI></UL></DIV></DIV><DIVCLASS="REFSECT1"><ANAME="AEN3081"></A><H2>Examples</H2><DIVCLASS="EXAMPLE"><ANAME="SWARM.DEFOBJ.CUSTOMIZE.GENERIC.2.EXAMPLE"></A><P><B>Example defobj/Customize/1. </B></P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING"> newArrayType = [Array customizeBegin: aZone]; [newArrayType setCount: 100]; newArrayType = [newArrayType customizeEnd]; array1 = [newArrayType create: aZone]; array2 = [newArrayType create: aZone]; // [array1 getCount] and [array2 getCount] are both 100</PRE></TD></TR></TABLE></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="swarm.defobj.createdclass.protocol.html">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="set.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="swarm.defobj.definedclass.protocol.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">CreatedClass</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="swarm.defobj.sgml.reference.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">DefinedClass</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -