÷ƒ’À;è TeX output 1998.01.28:1946‹ÿÿÿÿ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:ŸIyóÓߌ˜¼j ptmb7t½Collections‘/LibraryŽŸq'‘0„¤ŽŽ¤ ïhtml:ï html:Ÿ›¢‘0óÓߌ˜ ptmb7t¿Documentation–and“Implementation“StatusŽŸ‘0„¤ŽŽ©G®ïhtml:ï html:Ÿñ¦óÓߌ˜G® ptmb7tÀOv•ÓÅer“viewŽŸ“qó3{Ù ptmr7t¼The–€Åobject“types“of“the“collections“library“establish“a“general-purpose“foundation“to“maintain“object“references“orŽ¡other–MavÀalues“as“members“of“structured“collections.‘¸Customization“options“consolidate“a“wide“range“of“basic“collectionŽ¡structures–üÍinto“a“feÀw“core“types“(Array‘ÿY ,–List,“Set,“Map).‘These–üÍtypes“are“de ned“strictly“by“their“interfægace,‘not“theirŽ¡internal–Fimplementation.‘ jSpecialized“options,›"×ho•Àwe“vÙ er™Ÿ,˜gi“všÙ e–Fcontrol“and“ e˜xibility“for“ecient,‘"×lo•Àw-le“v˜el–Fuse“(suchŽ¡as–€implementing“other“libraries).ŽŸ ˆmïhtml:ï html:ŸÕÈ‘0„¤ŽŽ¦ïhtml:ï html:Ÿñ¦ÀDocumentationޤ“q¼The–€collections“library“folloÀws“the“ïhtml:ï html:óßêï html:Ž¡(defobj/library.html)ޤ 5<¼.‘˜It–€has“folloÀwing“standard“sections“of“documentation:ŽŸ*8ïhtml:ï html:Ÿ ïhtml:ï html:©ïhtml:ï html:Ÿ ‘0ïcolor push Blackó\ùð pzdrÁlï color popŽŽ‘:ïhtml:ï html:¾Usage‘?ýGuideïhtml:ï html:Ž¡‘0(collections/guide.html)ŽŸ8äïhtml:ï html:Ÿ üX‘0ïcolor push BlackÁlï color popŽŽ‘:ïhtml:ï html:¾Advanced–?ýUsage“Guideïhtml:ï html:Ž¡‘0(collections/adv.html)ŽŸ ÕSïhtml:ï html:¦ïhtml:ï html:© _é‘0ïcolor push BlackÁlï color popŽŽ‘:ïhtml:ï html:¾Interface‘?ýReferenceïhtml:ï html:Ž¡‘0(collections/ref.html)ŽŸÕSïhtml:ï html:¦‘0ïcolor push BlackÁlï color popŽŽ‘:ïhtml:ï html:¾Subclassing‘?ýReferenceïhtml:ï html:Ž¡‘0(collections/subclass.html)ŽŸ ÕSïhtml:ï html:Ÿïhtml:ï html:¦‘0ïcolor push BlackÁlï color popŽŽ‘:ïhtml:ï html:¾Interface–?ýDesign“Notesïhtml:ï html:Ž¡‘0(collections/design.html)ŽŸ8äïhtml:ï html:© üX‘0ïcolor push BlackÁlï color popŽŽ‘:ïhtml:ï html:¾Implementation‘?ýNotesïhtml:ï html:Ž¡‘0(collections/impl.html)ŽŸ 8äïhtml:ï html:¦‘0óßêï html:‘¼rïhtml:ï html:Ž¡‘0(mailto:mgd@santafe.edu)ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹* “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:Ÿ ‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹  “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:ŸIy½Collections–/Library:‘m™Documentation“andŽŸâ Implementation‘/StatusŽŸq'‘0„¤ŽŽŸ ïhtml:ï html:© ¤‘0¾The–?ýcollections“library“has“an“almost“complete“set“of“Interface“Reference“documents,ޤ ‘0and–?ýthe“design“of“the“interface“is“almost“entirely“final.‘ úThe“implementation“of“theŽ¡‘0collections–?ýlibrary,“however,“doesn't“yet“implement“many“of“the“more“advanced“featuresŽ¡‘0of–?ýthis“interface.ŽŸïhtml:ï html:¦‘0Collections–?ýlibrary“development“has“concentrated“on“the“specific“features“needed“byŽ¡‘0the–?ýactivity“library.‘ úThis“library“uses“collections“for“its“underlying“support“ofŽ¡‘0actions–?ýto“be“executed“in“schedules.‘ úThe“collections“library“itself“is“still“beingŽ¡‘0completed–?ýfor“use“as“a“general-purpose“library.Ž©8äïhtml:ï html:Ÿ ÎÀ‘0The–?ýArray“and“List“types“have“all“basic“capability“fully“implemented.‘ úSet“and“MapŽ¡‘0have–?ýbasic“messages“defined,“but“currently“rely“on“a“crude“implementation“based“onŽ¡‘0sorted–?ýlists.‘ ú(This“implementation“is“more“than“adequate“for“the“usually“small“andŽ¡‘0relatively–?ýstatic“schedule“structures“in“the“activity“library,“and“is“the“most“forgivingŽ¡‘0when–?ýchange“does“take“place“within“members“being“traversed.)‘ úMuch“more“efficientŽ¡‘0implementations–?ýbased“on“both“balanced“trees“and“hash“tables“are“in“the“works.ަïhtml:ï html:Ÿ ÎÀ‘0OrderedSet–?ýis“currently“supported“only“with“the“low-level“option“for“an“internal“memberŽ¡‘0slot,–?ýand“the“implemented“messages“do“not“match“the“ones“documented“in“the“InterfaceŽ¡‘0Reference.‘ úSupport–?ýfor“groups“of“duplicate“members“is“missing“from“both“Set“and“Map.ަïhtml:ï html:Ÿ ÎÀ‘0None–?ýof“the“special“options“for“restricted“usage“modes“on“any“type“of“collection“(e.g.,Ž¡‘0read-only–?ýrestriction)“has“been“implemented.‘ úStack“and“Queue“are“not“implemented,Ž¡‘0but–?ýare“nothing“more“than“restricted“uses“of“a“List.‘ úThere“is“no“support“for“anyŽ¡‘0member–?ýtype“except“id“or“smaller“(other“member“types“will“depend“on“a“data“type“facilityŽ¡‘0to–?ýbe“supplied“by“defobj).ަïhtml:ï html:Ÿ ÎÀ‘0Even–?ýthough“incomplete,“the“portion“of“capability“that“is“implemented“has“been“exercisedŽ¡‘0very–?ýheavily.‘ úThe“interfaces“to“Set“and“Map“structures“will“remain“the“same“evenŽ¡‘0as–?ýtheir“underlying“implementations“improve,“so“there“is“no“harm“in“using“them.‘ úSeeŽ¡‘0the–?ýïhtml:ï html:GridTurtle“test“programsïhtml:ï html:ޤ ¤‘0(../grid.html)Ž¡‘0for–?ýthe“most“complete“examples“of“collections“usage.ަïhtml:ï html:Ÿ ÎÀ‘0The–?ýcollections“library“follows“the“documentation“structure“suggested“by“the“ïhtml:ï html:libraryŽ© ‘0interface‘?ýconventionsïhtml:ï html:Ž¡‘0(../defobj/library.html)Ž¡‘0of–?ýthe“defobj“library.‘ úThere“are“placeholders“at“least“for“each“section“of“documentationަ‘0(some–?ýof“which“merely“indicate“that“the“section“is“not“available“yet)“so“that“allަ‘0links–?ýshould“at“least“link“up“with“something,“whether“or“not“there's“anything“there.ޤ8äïhtml:ï html:Ÿ ÎÀ‘0Throughout–?ýthe“documentation,“a“parenthesized“comment“that“starts“with“(..‘ úindicatesަ‘0an–?ýeditorial“comment“on“the“current“status“of“implementation“or“documentation.Ž¡ïhtml:ï html:Ÿ ÎÀ‘0The–?ýdocumentation“priority“for“all“libraries“is“to“complete“at“least“their“interfaceަ‘0reference–?ýdocuments,“so“that“there“is“the“equivalent“of“Unix“"man“pages"“that“summarizeŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹ - “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýБ/ºâ¾all–?ýbasic“capability.‘ úA“second“priority“is“to“complete“the“complementary“"Usage“Guide"ޤ ‘/ºâdocuments.‘ úUnlike–?ýthe“reference“documents,“the“Usage“Guide“will“have“a“task-orientedŽ¡‘/ºâorganization,–?ýand“will“lead“the“initial“user“through“actual“code“examples“in“the“roughŽ¡‘/ºâorder–?ýa“typical“user“is“likely“to“need“them.‘ úIt“will“serve“the“role“of“a“tutorialŽ¡‘/ºâon–?ýeach“library.Žºâ©8äïhtml:ï html:Ÿ Ç‘0The–?ýUsage“Guide“code“examples“have“not“yet“been“developed.‘ úFor“the“time“being,“aŽ¡‘0directory–?ýof“test“programs“(ïhtml:ï html:GridTurtle“test“programsïhtml:ï html:Ž¡‘0(../grid.html)Ž¡‘0,–?ýcontained“within“the“documentation“release“directory)“provides“code“examples“ofŽ¡‘0many–?ýof“the“basic“features“of“the“defobj,“collections,“and“activity“libraries.‘ úTheseŽ¡‘0code–?ýexamples“also“help“indicate“the“portions“of“the“libraries“which“are“fully“implementedŽ¡‘0and–?ýworking,“since“they“are“run“on“each“new“release“of“these“libraries.ަïhtml:ï html:ŸÇ‘0„¤ŽŽŸ ïhtml:ï html:¡‘0ÂMarcus–?ýG.“Daniels“ïhtml:ï html:‘¼rïhtml:ï html:Ž¡‘0(mailto:mgd@santafe.edu)ަïhtml:ï html:Ÿ Ç‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹Œ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:ŸIy½Collections–/Library:‘m™Usage“GuideŽŸq'‘0„¤ŽŽ© ïhtml:ï html:¤ ‘0¾This–?ýsection“of“documentation“is“not“yet“available.‘ úIn“the“meantime,“see“the“ïhtml:ï html:GridTurtleŽ¡‘0test‘?ýprogramsïhtml:ï html:Ž¡‘0(../grid.html)Ž¡‘0for–?ýthe“most“complete“examples“of“collections“library“usage.‘ úIf“you“can't“find“anŽ¡‘0example–?ýthere“that“exercises“a“message“or“option“that“you“want“to“use,“chances“areŽ¡‘0it's–?ýnot“implemented.ŽŸ8äïhtml:ï html:ŸÇ‘0„¤ŽŽ¦ïhtml:ï html:¡‘0ÂMarcus–?ýG.“Daniels“ïhtml:ï html:‘¼rïhtml:ï html:Ž¡‘0(mailto:mgd@santafe.edu)ŽŸ8äïhtml:ï html:Ÿ Ç‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹"­ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:ŸIy½Collections–/Library:‘m™AdvÊìanced“Usage“GuideŽŸq'‘0„¤ŽŽ¤ ïhtml:ï html:© ‘0¾(This–?ýsection“of“documentation“is“not“yet“available.)ŽŸ8äïhtml:ï html:ŸÇ‘0„¤ŽŽ¡ïhtml:ï html:¦‘0ÂMarcus–?ýG.“Daniels“ïhtml:ï html:‘¼rïhtml:ï html:ަ‘0(mailto:mgd@santafe.edu)ŽŸ8äïhtml:ï html:Ÿ Ç‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹&× “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:ŸIy½Collections–/Library:‘m™Interface“Refer |enceŽŸq'‘0„¤ŽŽ©G®ïhtml:ï html:ŸýÀDependenciesŽŸŸJ¾Following–?ýare“the“other“header“files“imported“by“:ŽŸ —ïhtml:ï html:Ÿïhtml:ï html:Ÿ 1‘0ó0ˆÛ pcrr7tÃ#import‘ffޤ A¾The–?ýcollections“library“follows“the“ïhtml:ï html:library“interface“conventionsïhtml:ï html:Ž¡(../defobj/library.html)Ž¡of–?ýthe“ïhtml:ï html:defobj“libraryïhtml:ï html:Ž¡(../defobj.html)Ž¡.› úIt–?ýalso“depends“on“standard“supertypes“and“classes“defined“by“this“library.˜Initializationޤ of–?ýthe“collections“library“automatically“initializes“the“defobj“library“as“well.‘ úSince“defobjŽ¡also–?ýrequires“the“collections“library,“both“must“always“be“linked“into“an“application“together.ŽŸ8äïhtml:ï html:ŸÇ‘0„¤ŽŽ¦ïhtml:ï html:ŸýÀObject–QëT‘þ¸¦ypes“(with“links“to“r•°gefer“ence‘Qëpages)ŽŸ âcïhtml:ï html:ïhtml:ï html:Ÿ¼ç‘0ÃCollectionïhtml:ï html:ޤ A‘5ff(Collection.html)Ž¡‘eÿüïhtml:ï html:Stringïhtml:ï html:Ž¡‘5ff(String.html)Ž¡‘Pfdïhtml:ï html:OutputStreamïhtml:ï html:Ž¡‘5ff(Stream.html)Ž¡‘@32ïhtml:ï html:Indexïhtml:ï html:Ž¡‘5ff(Index.html)Ž¡¡‘Jÿþ/‘%ÌÊ|‘0™–\Ž¡‘E™˜/‘+30|‘5ÿü\Ž¡‘5ffïhtml:ï html:Arrayïhtml:ï html:Ž¡‘5ff(Array.html)Ž¡‘Jÿþïhtml:ï html:List,ïhtml:ï html:Ž¡‘5ff(List.html)Ž¡‘kfbïhtml:ï html:KeyedCollection,ïhtml:ï html:Ž¡‘5ff(KeyedCltn.html)Ž¡¡‘v3.ïhtml:ï html:ListIndexïhtml:ï html:Ž¡‘5ff(List.html)Ž¡‘UÌÊïhtml:ï html:KeyedIndexïhtml:ï html:Ž¡‘5ff(KeyedCltn.html)Ž¡ŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹)¦ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýБ?îÃ/‘%ÌÊ\‘+30/‘;fb\ŽºâŸ¸Mïhtml:ï html:Ÿ T ‘0Stackïhtml:ï html:ޤ V‘5ff(Stack.html)Ž¡‘E™˜ïhtml:ï html:Queueïhtml:ï html:Ž¡‘5ff(Stack.html)Ž¡‘E™˜ïhtml:ï html:Set,ïhtml:ï html:Ž¡‘5ff(Set.html)Ž¡‘`™–ïhtml:ï html:Map,ïhtml:ï html:Ž¡‘5ff(Map.html)Ž¡¡‘pÌÈïhtml:ï html:SetIndexïhtml:ï html:Ž¡‘5ff(Set.html)Ž¡‘Jÿþïhtml:ï html:MapIndexïhtml:ï html:Ž¡‘5ff(Map.html)Ž¡¡’Ç3(|Ž¡‘eÿüïhtml:ï html:OrderedSetïhtml:ï html:Ž¡‘5ff(OrderedSet.html)Ž¡¾(need–?ýa“graphic“with“image“map,“but“this“will“do“for“now)ŽŸ8äïhtml:ï html:ŸÇ‘0„¤ŽŽŸG®ïhtml:ï html:ŸÈÀÀContents:ŽŸ ¢Âïhtml:ï html:Ÿïhtml:ï html:Ÿ ÇÉ‘0ïcolor push BlackÁlï color popŽŽ‘:ïhtml:ï html:¾Collectionïhtml:ï html:Ž¡‘0(Collection.html)Ž©ÕSïhtml:ï html:Ÿ 7‘0ïcolor push BlackÁlï color popŽŽ‘:ïhtml:ï html:¾Indexïhtml:ï html:Ž¡‘0(Index.html)ަïhtml:ï html:Ÿ 7‘0ïcolor push BlackÁlï color popŽŽ‘:ïhtml:ï html:¾Arrayïhtml:ï html:Ž¡‘0(Array.html)ŽŸ8äïhtml:ï html:Ÿ Ór‘0ïcolor push BlackÁlï color popŽŽ‘:ïhtml:ï html:¾Listïhtml:ï html:Ž¡‘0(List.html)ަïhtml:ï html:Ÿ 7‘0ïcolor push BlackÁlï color popŽŽ‘:ïhtml:ï html:¾Stackïhtml:ï html:Ž¡‘0(Stack.html)ަïhtml:ï html:Ÿ 7‘0ïcolor push BlackÁlï color popŽŽ‘:ïhtml:ï html:¾Queueïhtml:ï html:Ž¡‘0(Stack.html)ަïhtml:ï html:Ÿ 7‘0ïcolor push BlackÁlï color popŽŽ‘:ïhtml:ï html:¾KeyedCollectionïhtml:ï html:Ž¡‘0(KeyedCltn.html)ŽŸ8äïhtml:ï html:Ÿ Ór‘0ïcolor push BlackÁlï color popŽŽ‘:ïhtml:ï html:¾Setïhtml:ï html:Ž¡‘0(Set.html)ަïhtml:ï html:Ÿ 7‘0ïcolor push BlackÁlï color popŽŽ‘:ïhtml:ï html:¾OrderedSetïhtml:ï html:Ž¡‘0(OrderedSet.html)ަïhtml:ï html:ŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹ 2u “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýБ/ºâïcolor push BlackÁlï color popŽŽ‘9ºâïhtml:ï html:¾Mapïhtml:ï html:ޤ ‘/ºâ(Map.html)Žºâ©8äïhtml:ï html:Ÿ Ç‘0ïcolor push BlackÁlï color popŽŽ‘:ïhtml:ï html:¾Stringïhtml:ï html:Ž¡‘0(String.html)ަïhtml:ï html:Ÿ Ç‘0ïcolor push BlackÁlï color popŽŽ‘:ïhtml:ï html:¾OutputStreamïhtml:ï html:Ž¡‘0(Stream.html)ŽŸ‘0„¤ŽŽŸ ïhtml:ï html:¡‘0ÂMarcus–?ýG.“Daniels“ïhtml:ï html:‘¼rïhtml:ï html:Ž¡‘0(mailto:mgd@santafe.edu)ަïhtml:ï html:Ÿ Ç‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹ = “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:Ÿ žâÀNameŽŸªóïhtml:ï html:ŸœýóÓߌ˜ff ptmb7tÅCollection–™™-“supertype“of“all“collection“typesŽ©‘0„¤ŽŽŸG®ïhtml:ï html:ŸVFÀSynopsisŽŸ âcïhtml:ï html:Ÿ ®‘0Ã//ޤ ™Ü‘0//–ffCollection“--“supertype“of“all“collection“typesŽ¡‘0//Ž¡‘0@deftype–ffCollection“CREATINGŽ¡‘0-–ff(void)“setMemberType:“aDataType;Ž¡‘0-–ff(void)“setIndexSafety:“indexSafety;Ž¡‘0-–ff(void)“setIndexUpdateHandler:“(func_t)handler“:“(void“*)arg;Ž¡‘0-–ff(void)“setReplaceOnly:“(BOOL)replaceOnly;Ž¡‘0USINGŽ¡‘0-‘ffgetMemberType;Ž¡‘0-‘ffgetIndexSafety;Ž¡‘0-–ff(func_t)“getIndexUpdateHandler:“(void“*)arg;Ž¡‘0-–ff(BOOL)“getReplaceOnly;Ž¡¡‘0-–ff(int)“getCount;Ž¡¡‘0-–ffatOffset:“(int)offset;Ž¡‘0-–ffatOffset:“(int)offset“put:“anObject;Ž¡¡‘0-‘ffgetFirst;Ž¡‘0-‘ffgetLast;Ž¡¡‘0-–ff(BOOL)“contains:“aMember;Ž¡‘0-–ffremove:“aMember;Ž¡‘0-–ff(void)“removeAll;Ž¡¡‘0-–ffbegin:“aZone;Ž¡¡‘0-–ff(void)“forEach:“(SEL)aSelector;Ž¡‘0-–ff(void)“forEach:“(SEL)aSelector“:“arg1;Ž¡‘0-–ff(void)“forEach:“(SEL)aSelector“:“arg1“:“arg2;Ž¡‘0-–ff(void)“forEach:“(SEL)aSelector“:“arg1“:“arg2“:“arg3;Ž¡‘0@endަ‘0„¤ŽŽŸG®ïhtml:ï html:ŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹ @Å “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýÑçåºâÀDescriptionŽŸ7 ºâ¾A–?ýcollection“is“a“grouping“of“object“references“or“other“data“values“which“are“assigned“explicitlyޤ ºâas–?ýmembers“of“the“collection.‘ úDepending“on“the“subtype,“collection“members“may“also“be“maintainedŽ¡ºâin–?ývarious“associations“with“each“other,“such“as“an“ordering“of“members“or“an“association“ofŽ¡ºâmembers–?ýwith“identifying“key“values.‘ úMajor“Collection“subtypes“include“Array,“List,“Set“andŽ¡ºâMap.‘ úThe–?ýCollection“supertype“establishes“common“conventions“(and“associated“messages)“supportedŽ¡ºâby–?ýall“types“of“collections.ŽºâŸ —ïhtml:ï html:© Ÿñ‘0All–?ýcollections“support“traversal“over“their“members“using“a“separate“object“calledŽ¡‘0an–?ýIndex.‘ úAll“collections“also“follow“common“rules“regarding“the“types“of“data“valuesŽ¡‘0which–?ýmay“be“added“as“members.‘ úThe“next“two“subsections“summarize“these“basic“featuresŽ¡‘0of–?ýall“collections.ŽŸïhtml:ï html:Ÿffïhtml:ï html:Ÿ ƒÅIndex‘™™objectsŽŸ|¬¾An–?ýindex“is“a“special“type“of“object“that“references“a“current“position“in“an“enumeration“sequenceŽ¡over–?ýa“collection.‘ úAn“enumeration“sequence“contains“every“member“of“a“collection“exactly“once.Ž¡Every–?ýcollection“defines“an“associated“type“of“object“for“its“index.‘ úThe“index“type“of“a“collectionŽ¡defines–?ýadditional“ways“in“which“the“members“of“a“collection“may“be“processed“beyond“any“messagesŽ¡available–?ýdirectly“on“the“collection.‘ úOften“the“operations“of“an“index“provide“the“most“basicŽ¡and–?ýflexible“means“for“manipulating“individual“members“of“a“collection.‘ úAn“index“object“intoŽ¡a–?ýcollection“may“be“created“at“any“time.‘ úAn“index“is“the“basic“means“to“traverse“through“allŽ¡members–?ýof“a“collection.‘ úMultiple“indexes“on“the“same“collection“may“all“exist“at“the“sameŽ¡time–?ýand“may“reference“the“same“or“different“positions.‘ úDepending“on“the“collection“type,Ž¡it–?ýmay“be“possible“to“modify“a“collection“through“its“indexes.ŽŸ Ü»ïhtml:ï html:¦‘0Once–?ýan“index“is“created,“the“sequence“of“members“in“its“enumeration“sequence“is“guaranteedŽ¡‘0to–?ýremain“the“same,“provided“that“no“new“members“are“added“to“the“underlying“collection,Ž¡‘0or–?ýexisting“members“removed.‘ úIf“a“member“is“located“once“at“a“particular“position,Ž¡‘0it–?ýis“guaranteed“to“remain“at“that“position“as“long“as“the“index“itself“remains.ŽŸ8äïhtml:ï html:¦‘0Many–?ýcollection“types“define“an“explicit“ordering“over“their“members.‘ úFor“such“collections,Ž¡‘0the–?ýsequence“of“members“referred“to“by“an“index“will“always“be“consistent“with“thisŽ¡‘0ordering.‘ úAn–?ýexplicit,“total“ordering“also“guarantees“that“all“indexes“of“the“sameŽ¡‘0collection–?ýhave“the“same“member“sequence.ŽŸ8äïhtml:ï html:¦‘0If–?ýno“such“ordering“is“defined,“however,“some“particular“sequence“of“all“the“collectionŽ¡‘0still–?ýbecomes“associated“with“each“created“index.‘ úAll“collection“members“are“guaranteedŽ¡‘0to–?ýbe“contained“somewhere“in“the“enumeration“sequence“for“any“particular“index,“butŽ¡‘0two–?ýindexes“on“the“same“collection“are“not“guaranteed“to“have“the“same“sequence.ŽŸ8äïhtml:ï html:¦‘0The–?ýIndex“type“corresponds“to“the“iterator“types“defined“as“part“of“many“other“object-orientedŽ¡‘0libraries.‘ úThe–?ýname“Index“is“shorter“and“emphasizes“the“more“abstract“and“multi-functionŽ¡‘0role–?ýof“these“basic“support“objects“for“any“collection.‘ úFor“more“background“on“designŽ¡‘0of–?ýindexes“and“iterators,“see“the“Interface“Design“Notes“for“the“collections“library.ŽŸ8äïhtml:ï html:Ÿffïhtml:ï html:ŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹ FÏ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýкâÅMember‘™™typesŽŸ,`ºâ¾The–?ýdefault“member“type“of“any“collection“is“the“id“type“defined“by“Objective“C.“All“messagesޤ ºâwhich–?ýadd,“remove,“or“access“members“declare“their“member“value“with“the“id“type.‘ úNone“ofŽ¡ºâthe–?ýcollection“types,“however,“requires“that“the“member“value“actually“point“to“a“valid“object.Ž¡ºâThe–?ýmember“values“of“any“collection“may“contain“an“arbritrary“bit“pattern,“provided“these“bitsŽ¡ºâfit–?ýin“the“space“available“within“an“id“pointer.ŽºâŸ Ü»ïhtml:ï html:© O¥‘0In–?ýthe“few“cases“when“default“operations“assume“that“a“member“points“to“a“valid“object,Ž¡‘0there–?ýare“alternate“ways“to“avoid“these“defaults“and“use“an“arbritrary“bit“patternŽ¡‘0as–?ýa“member“value“instead.‘ úWhen“using“an“arbritrary“bit“pattern,“the“member“valueŽ¡‘0must–?ýbe“cast“to“or“from“the“id“type“when“adding“or“retrieving“it“from“the“collection.Ž¡‘0By–?ýïhtml:ï html:global“portability“assumptionsïhtml:ï html:ޤ ˆ‰‘0(../global-port.html)Ž¡‘0,–?ýthe“number“of“bits“in“an“id“value“may“be“safely“assumed“to“be“at“least“as“largeޤ ‘0as–?ýan“int“(signed“or“unsigned),“but“not“necessarily“as“large“as“a“long.ŽŸ8äïhtml:ï html:¦‘0There–?ýis“also“an“option“to“override“the“default“member“type“so“that“it“can“be“largerŽ¡‘0than–?ýa“id“pointer.‘ úUse“of“this“option,“however,“changes“the“way“member“values“mustŽ¡‘0be–?ýpassed“to“or“from“a“collection.‘ úMore“information“is“given“with“the“MemberTypeŽ¡‘0option‘?ýbelow.Ž©8äïhtml:ï html:ŸÇ‘0„¤ŽŽŸffïhtml:ï html:ŸÐ7ÅInherited‘™™beha£×viorŽŸÜ÷ïhtml:ï html:Ÿ Oi‘0Ã@deftype–ffCollection“ŽŸ ˆ‰¾(..‘ úSetInitialValue–?ýand“Copy“behavior“is“currently“implemented“for“Array“and“List,“but“notŽ¡for–?ýSet“or“Map.)ަïhtml:ï html:Ÿ O¥‘0The–?ýCollection“type“inherits“standard“messages“from“the“defobj“library“for“creatingŽ¡‘0and–?ýcustomizing“objects.‘ úThese“messages“are“defined“as“part“of“the“defobj“CreateŽ¡‘0supertype.‘ úThe–?ýonly“collection“types“which“are“directly“creatable,“however,“are“thoseŽ¡‘0directly–?ýtagged“as“such“(with“the“CREATABLE“type“tag).ަïhtml:ï html:Ÿ O¥‘0In–?ýaddition“to“the“standard“create“messages“inherited“from“the“defobj“Create“supertype,Ž¡‘0Collection–?ýinherits“the“SetIntialValue,“Copy,“and“Drop“types“(also“from“defobj).‘ úCopyingŽ¡‘0or–?ýdropping“a“collection“has“no“effect“on“objects“which“might“have“be“contained“inŽ¡‘0a–?ýcollection“as“members;“only“the“references“to“objects“contained“in“the“collectionŽ¡‘0are–?ýcopied“or“freed.ަïhtml:ï html:Ÿ O¥‘0SetInitialValue–?ýdefines“special“create“messages“to“load“the“initial“members“of“a“newlyŽ¡‘0created–?ýcollection“from“an“existing“collection,“and“optionally“to“make“the“membersŽ¡‘0of–?ýa“collection“read-only“after“this“initialization.‘ úIf“the“members“of“a“collectionŽ¡‘0are–?ýread-only,“all“collection“messages“which“add,“replace,“or“remove“members“willŽ¡‘0raise–?ýan“InvalidOperation“error.‘ úEven“if“a“collection“was“not“initially“created“withŽ¡‘0ReadOnly–?ýstatus,“this“status“may“also“be“set“later.‘ úIf“a“collection“is“created“withŽ¡‘0the–?ýReadOnly“restriction“set,“however,“this“restriction“cannot“later“be“unset.ަïhtml:ï html:Ÿ O¥‘0A–?ýcollection“used“as“an“initial“value“need“not“have“the“same“type“as“a“collectionŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹ V= “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýБ/ºâ¾being–?ýcreated.‘ úMembers“(and“keys,“too,“if“applicable)“are“added“to“the“new“collectionޤ ‘/ºâin–?ýthe“same“order“as“defined“by“traversing“the“initial“value“collection“with“a“localŽ¡‘/ºâtemporary–?ýindex.‘ úCreate-time“options“are“also“applied“as“noted“under“SetInitialValue.Ž¡‘/ºâSome–?ýcollection“subtypes“may“have“further“special“rules“for“initial“values;“if“so,Ž¡‘/ºâthese–?ýare“documented“with“the“subtype.ŽºâŸ8äïhtml:ï html:© X‹‘0[aCollection–?ýcopy:› úaZone]“is“equivalent“to“[[aCollection“getType]“create:˜aZoneŽ¡‘0setInitialValue:‘ úaCollection].ŽŸÕSïhtml:ï html:Ÿ*­‘0„¤ŽŽŸffïhtml:ï html:ŸÙÅCr½«eate-time‘™™optionsŽŸ ‘ýïhtml:ï html:Ÿ £I‘0ÃCREATINGޤ ‘o‘0-–ff(void)“setMemberType:“aDataType;Ž¡‘0-–ff(void)“setIndexSafety:“indexSafety;Ž¡‘0-–ff(void)“setIndexUpdateHandler:“(handler_t)handler“:“(void“*)arg;Ž¡‘0SETTINGŽ¡‘0-–ff(void)“setReplaceOnly:“(BOOL)replaceOnly;Ž¡‘0USINGŽ¡‘0-‘ffgetMemberType;Ž¡‘0-‘ffgetIndexSafety;Ž¡‘0-–ff(handler_t)“getIndexUpdateHandler:“(void“*)arg;Ž¡‘0-–ff(BOOL)“getReplaceOnly;ŽŸ bÌïhtml:ï html:Ÿ• ‘0¿MemberT‘ÿ¬ypeŽŸÄ¢¾(..‘ úThis–?ýoption“is“not“currently“implemented“for“any“collection“types.)ŽŸ lïhtml:ï html:¦‘0The–?ýMemberType“option“may“be“used“to“declare“the“type“of“member“which“a“collectionޤ ‘0contains.‘ úIts–?ývalue“must“be“an“objec“having“one“of“the“ValueType“types“defined“inŽ¡‘0defobj.‘ ú(..Currently–?ýno“ValueType“objects“are“implemented,“so“MemberType“is“not“supported.)ŽŸ8äïhtml:ï html:¦‘0The–?ýmember“type“defaults“to“the“Symbol“value“Unknown.‘ úSpecifying“a“member“type“hasŽ¡‘0no–?ýeffect“on“the“collection“if“the“storage“size“of“the“data“type“is“no“larger“thanŽ¡‘0a–?ýpointer“of“id“type.‘ úThe“member“type,“however,“may“be“helpful“as“documentation,Ž¡‘0and–?ýmembers“can“be“checked“for“conformance“to“the“type“as“part“of“debug“options.‘ úIfŽ¡‘0the–?ýdata“type“has“a“size“greater“than“id,“the“collection“automatically“allocates“andŽ¡‘0frees–?ýspace“for“the“member“value“whenever“member“values“are“added“or“removed.‘ úForŽ¡‘0such–?ýa“collection,“all“member“values“must“be“passed“to“the“collection“not“as“the“valueŽ¡‘0itself,–?ýbut“as“a“pointer“to“the“value“(cast“to“id“as“necessary).‘ úIf“a“new“memberŽ¡‘0is–?ýbeing“added,“the“value“will“be“copied“to“a“new“member“location“contained“withinŽ¡‘0the–?ýcollection.‘ úMember“values“returned“by“the“collection“will“be“returned“as“pointersŽ¡‘0to–?ýthis“internal“value,“not“as“the“value“itself.‘ úIn“the“case“of“member“values“removedŽ¡‘0from–?ýthe“collection,“a“nil“pointer“is“returned.ŽŸ8äïhtml:ï html:¡ïhtml:ï html:ŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹dõ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýБ/ºâ¿IndexSafetyŽŸ ¬ºâ¾(..‘ úThis–?ýoption“is“not“currently“implemented“for“any“collection“types.)ŽºâŸ lïhtml:ï html:¤ •‘0The–?ýIndexSafety“option“has“one“of“the“following“values:Ž©8äïhtml:ï html:Ÿïhtml:ï html:¡‘0Ãid–ff‘ ÌÌUnsafe,“UnsafeAtMember,“SafeAlways;ŽŸ Öy¾If–?ýnot“specified,“the“default“value“depends“on“the“specific“collection“subtype.‘ úIn“typicalޤ cases,–?ýthe“default“value“is“Unsafe.‘ úA“non-default“value“is“required“for“indexes“to“have“aŽ¡guarantee–?ýof“safety“when“independent“modifications“to“the“underlying“collection“are“also“performed.ަïhtml:ï html:Ÿ •‘0Without–?ýa“guarantee“of“index“safety,“the“effect“of“any“operation“which“modifies“theŽ¡‘0underlying–?ýcollection“(adding,“removing,“or“replacing“members)“could“be“to“disruptŽ¡‘0the–?ýposition“assumed“by“any“existing“index.‘ úThe“effect“of“such“disruption“is,“inŽ¡‘0general,–?ýcompletely“unpredictable:‘ úit“could“be“an“immediate“crash,“a“wrong“sequenceŽ¡‘0of–?ýmembers,“or“other“difficult-to-debug“conditions.‘ úTo“avoid“such“unpredictability,Ž¡‘0several–?ýmeans“for“assuring“the“safety“of“indexes“under“independent“collection“updateŽ¡‘0are‘?ýprovided.ަïhtml:ï html:Ÿ •‘0The–?ýsimplest“way“to“guarantee“index“safety“is“to“set“the“IndexSafety“option“to“theŽ¡‘0value–?ýSafeAlways“when“a“collection“is“created.‘ úWith“the“value“of“SafeAlways,“anyŽ¡‘0active–?ýindex“on“the“collection“will“be“updated“automatically“to“reflect“any“changeŽ¡‘0to–?ýthe“underlying“collection“whenever“such“a“change“occurs.‘ úThis“automatic“updateŽ¡‘0continues–?ýto“occur“throughout“the“lifetime“of“any“index“on“the“collection;“it“ceasesŽ¡‘0to–?ýoccur“only“after“an“index“is“dropped.‘ úThis“is“the“easiest“option“to“use,“but“consumesŽ¡‘0extra–?ýresources“to“accomplish“(both“time“and“space“within“the“collection),“so“is“mostŽ¡‘0suitable–?ýwhen“the“extra“resource“usage“deesn't“matter“or“there's“no“better“way.ަïhtml:ï html:Ÿ •‘0With–?ýan“IndexSafety“value“of“SafeAlways,“there“is“also“an“additional“option“to“declareŽ¡‘0an–?ýexternal“index“update“handler.‘ úThe“handler“is“specified“using“the“setIndexUpdateHandler::Ž¡‘0message.‘ úIf–?ýan“IndexUpdateHandler“is“specified,“the“value“for“IndexSafety“is“alsoŽ¡‘0automatically–?ýset“to“SafeAlways.ަïhtml:ï html:Ÿ •‘0The–?ýfirst“argument“of“setIndexUpdateHandler::‘ úspecifies“a“function“which“is“calledŽ¡‘0whenever–?ýa“modification“to“the“underlying“collection“occurs“which“could“require“anŽ¡‘0update–?ýto“existing“indexes.‘ úThe“second“argument“establishes“a“pointer“value“whichŽ¡‘0the–?ýhandler“function“may“use“to“identify“the“indexes“which“need“to“be“updated,“orŽ¡‘0any–?ýother“information“needed“for“the“update.ަïhtml:ï html:Ÿ •‘0(..‘ úExact–?ýcall“conventions“for“the“IndexUpdateHandler“are“still“being“established,Ž¡‘0but–?ýthe“activity“library“will“soon“be“converted“to“use“this“technique,“so“the“conventionsŽ¡‘0will–?ýbe“resolved“during“that“conversion.)ަïhtml:ï html:Ÿ •‘0Besides–?ýthe“extreme“values“of“Unsafe“and“SafeAlways,“another“valid“value“for“IndexSafetyŽ¡‘0is–?ýUnsafeAtMember.‘ úThis“value“indicates“that“the“only“modification“of“the“collectionŽ¡‘0which–?ýcould“disrupt“existing“indexes“is“to“remove“the“member“contained“at“the“currentŽ¡‘0index–?ýposition,“or“to“change“the“member“on“either“side“of“an“index“positioned“betweenŽ¡‘0members.‘ úFor–?ýsome“collection“subtypes,“this“level“of“safety“is“automatically“assured,Ž¡‘0and–?ýfor“others“it“can“be“requested“with“less“overall“resource“impact“than“SafeAlways.ަïhtml:ï html:¡ïhtml:ï html:ŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹pà “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýБ/ºâ¿ReplaceOnlyŽŸÓ ºâ¾(..‘ úThis–?ýoption“is“not“currently“implemented“for“any“collection“types.)ŽºâŸ lïhtml:ï html:Ÿ g‰‘0This–?ýboolean-valued“option“restricts“valid“usage“of“a“collection“by“excluding“allޤ ‘0operations–?ýwhich“add“or“remove“members.‘ úFor“some“collection“subtypes,“a“replace-onlyŽ¡‘0restriction–?ýcan“obtain“many“of“the“same“performance“advantages“as“a“read-only“collection,Ž¡‘0but–?ýwithout“disabling“replace“operations“as“well.‘ úJust“like“the“ReadOnly“option,Ž¡‘0the–?ýReplaceOnly“option“may“be“reset“after“a“collection“is“created,“provided“it“wasŽ¡‘0not–?ýoriginally“set“to“true.Ž©8äïhtml:ï html:ŸÇ‘0„¤ŽŽŸffïhtml:ï html:ŸèÅCollection‘™™beha£×viorŽŸÜ÷ïhtml:ï html:Ÿ gM‘0Ã-–ff(int)“getCount;ŽŸ  m¾getCount–?ýreturns“the“integer“number“of“members“currently“contained“in“the“collection.‘ úAllŽ¡collections–?ýmaintain“their“count“internally“so“that“no“traversal“of“collection“members“is“requiredŽ¡simply–?ýto“return“this“value.ަïhtml:ï html:Ÿïhtml:ï html:Ÿ g‰‘0Ã-–ffatOffset:“(int)offset;ޤ  m‘0-–ffatOffset:“(int)offset“put:“anObject;Ž¡¡‘0-‘ffgetFirst;Ž¡‘0-‘ffgetLast;Ž¡¾An–?ýoffset“is“an“integer“value“that“gives“relative“position“of“a“member“in“the“enumeration“sequenceޤ of–?ýa“collection.‘ úOffsets“start“the“count“of“the“first“member“at“zero,“just“like“C“array“indexing.ަïhtml:ï html:Ÿ g‰‘0Offsets–?ýprovide“an“alternate“means“to“access“the“members“of“a“collection,“withoutŽ¡‘0creating–?ýa“separate“index“object.‘ úSome“collection“subtypes“(such“as“Array)“supportŽ¡‘0fast,–?ýdirect“access“by“integer“member“offset,“while“others“support“member“offsetsŽ¡‘0only–?ýas“a“shorthand“for“sequential“access“through“every“preceding“member.‘ úAccessŽ¡‘0by–?ýoffsets“is“supported“on“all“collections“regardless“of“whether“its“speed“on“a“particularŽ¡‘0collection‘?ýtype.ަïhtml:ï html:Ÿ g‰‘0The–?ýatOffset:› úmessage“returns“the“member“at“a“particular“member“offset.˜The“atOffset:Ž¡‘0put:‘ úmessage–?ýreplaces“the“member“at“a“particular“offset“with“a“new“value,“and“returnsŽ¡‘0the–?ýprevious“member“value“at“this“offset.‘ úBoth“these“messages“raise“the“error“OffsetOutOfRangeŽ¡‘0if–?ýthe“offset“is“less“than“zero“or“greater“than“or“equal“to“the“count“of“members“inŽ¡‘0the‘?ýcollection.ŽŸïhtml:ï html:Ÿ  m‘0The–?ýgetFirst“message“is“equivalent“to“[aCollection“atOffset:‘ ú0],“and“the“getLastŽ¡‘0message–?ýis“equivalent“to“[aCollection“atOffset:‘ ú[aCollection“getCount]“-“1].ަïhtml:ï html:Ÿïhtml:ï html:Ÿ g‰‘0Ã-–ff(BOOL)“contains:“aMember;ޤ  m‘0-–ffremove:“aMember;Ž¡‘0-–ff(void)“removeAll;Ž¡¾The–?ýcontains:‘ úmessage“returns“true“if“the“collection“contains“any“member“value“which“matchesŽŸ the–?ývalue“passed“as“its“argument.‘ úDepending“on“the“collection“subtype,“this“may“require“traversingŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹€² “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýкâ¾sequentially–?ýthrough“all“members“of“the“collection“until“a“matching“member“is“found.‘ úFor“otherޤ ºâsubtypes,–?ýsome“form“of“direct“indexing“from“the“member“value“may“be“supported.‘ úThe“messageŽ¡ºâis–?ýsupported“regardless“of“its“speed.Žºâ©8äïhtml:ï html:Ÿ Ç‘0The–?ýremove:‘ úmessage“removes“the“first“member“in“the“collection“with“a“value“matchingŽ¡‘0the–?ývalue“passed“as“its“argument.‘ úIf“there“is“no“such“member,“a“nil“value“is“returned.Ž¡‘0As–?ýwith“the“contains:‘ úmessage,“the“speed“of“this“operation“may“vary“from“very“lowŽ¡‘0to–?ýlinear“in“the“number“of“members,“depending“on“the“collection“subtype.ަïhtml:ï html:Ÿ Ç‘0The–?ýremoveAll“message“removes“all“existing“members“of“a“collection“and“sets“its“memberŽ¡‘0count–?ýto“zero.‘ úThe“collection“then“remains“valid“for“further“members“to“be“added.Ž¡‘0This–?ýmessage“has“no“effect“on“the“objects“which“might“be“referenced“by“any“removedŽ¡‘0member–?ývalues.‘ úIf“resources“consumed“by“these“objects“also“need“to“be“released,“suchŽ¡‘0release–?ýoperations“(such“as“drop“messages)“can“be“performed“prior“to“removing“theŽ¡‘0member‘?ývalues.ޤïhtml:ï html:¡ïhtml:ï html:¤ ‘0Ã-–ffbegin:“aZone;Ž¡¾The–?ýbegin:‘ úmessage“is“the“standard“method“for“creating“a“new“index“for“traversing“the“elementsŽ¡of–?ýa“collection.‘ úAll“further“information“about“indexes“is“documented“under“the“Index“type.ަïhtml:ï html:Ÿïhtml:ï html:Ÿ Ç‘0Ã-–ff(void)“forEach:“(SEL)aSelector;Ž¡‘0-–ff(void)“forEach:“(SEL)aSelector“:“arg1;Ž¡‘0-–ff(void)“forEach:“(SEL)aSelector“:“arg1“:“arg2;Ž¡‘0-–ff(void)“forEach:“(SEL)aSelector“:“arg1“:“arg2“:“arg3;Ž¡¾The–?ýforEach“messages“supply“a“convenient“shorthand“for“repeatedly“performing“the“same“messageŽ¡on–?ýall“objects“contained“as“members“in“a“collection.‘ úThe“message“to“be“sent“is“identifiedŽ¡by–?ýthe“argument“aSelector.‘ úThis“selector“must“define“the“same“number“of“arguments“as“containedŽ¡in–?ýany“remaining“argument“slots“of“the“forEach“message.‘ úThe“argument“types“of“the“messageŽ¡to–?ýbe“sent“must“be“either“the“id“type,“or“some“other“type“that“will“fit“in“the“same“numberŽ¡of–?ýbits“as“the“id“type.‘ úBy“global“portability“assumptions,“the“argument“type“could“be“as“largeŽ¡as–?ýan“int“(signed“or“unsigned),“but“not“necessarily“as“large“as“a“long.‘ úTo“use“the“message,Ž¡any–?ýnon-id“value“must“be“cast“to“the“id“type“as“part“of“the“call“expression.ަïhtml:ï html:Ÿ Ç‘0The–?ýforEach:‘ úmessages“are“implemented“by“a“simple“loop“through“all“members“of“a“collection,Ž¡‘0using–?ýan“internal,“temporary“index.‘ úIf“any“operation“more“complex“than“a“simple“messageŽ¡‘0send–?ýis“required,“this“operation“should“just“be“coded“directly“using“a“loop“that“traversesŽ¡‘0its–?ýown“index.ŽŸïhtml:ï html:Ÿ‘0„¤ŽŽŸ ïhtml:ï html:¡‘0ÂMarcus–?ýG.“Daniels“ïhtml:ï html:‘¼rïhtml:ï html:Ž¡‘0(mailto:mgd@santafe.edu)ަïhtml:ï html:Ÿ Ç‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹Š “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:Ÿ žâÀNameŽŸªóïhtml:ï html:Ÿ†ÅIndex–™™{“r•½«efer“ence–™™into“an“enumeration“sequence“f£×or“a“collectionŽŸ‘0„¤ŽŽŸG®ïhtml:ï html:ŸËÏÀSynopsisŽŸ âcïhtml:ï html:Ÿ‹7‘0Ã//ޤ e‘0//–ffIndex“--“reference“into“an“enumeration“sequence“for“a“collectionŽ¡‘0//Ž¡‘0@deftype–ffIndex“-“getCollection;Ž¡¡‘0-‘ffnext;Ž¡‘0-‘ffprev;Ž¡‘0-–fffindNext:“anObject;Ž¡‘0-–fffindPrev:“anObject;Ž¡¡‘0-‘ffget;Ž¡‘0-–ffput:“anObject;Ž¡‘0-‘ffremove;Ž¡¡‘0-‘ffgetLoc;Ž¡‘0-–ff(void)“setLoc:“locSymbol;Ž¡‘0-–ff(int)“getOffset;Ž¡‘0-–ffsetOffset:“(int)offset;Ž¡¡‘0-–ff(int)“compare:“anIndex;Ž¡‘0@endŽŸdwïhtml:ï html:Ÿ¯ÀDescriptionŽŸmš¾An–?ýindex“is“a“reference“into“an“enumeration“sequence“of“a“collection.‘ úSuch“an“enumerationޤ sequence–?ýcontains“all“members“of“the“collection“in“some“order.‘ úThis“order“will“always“be“consistentŽ¡with–?ýordering“of“members“in“the“collection,“assuming“there“is“such“an“ordering.‘ úOtherwise,Ž¡the–?ýsequence“will“still“contain“all“members“in“some“order“that“remains“fixed“provided“thatŽ¡new–?ýmembers“are“not“added“or“removed“from“the“collection.ŽŸ ^5ïhtml:ï html:Ÿ e‘0An–?ýindex“is“created“by“a“begin:› úor“createIndex:˜message“against“a“collection.˜EachŽ¡‘0major–?ýcollection“type“has“its“own“corresponding“index“type,“which“supports“specializedŽ¡‘0types–?ýof“processing“against“the“valid“contents“of“that“kind“of“collection.‘ úOnce“created,Ž¡‘0an–?ýindex“is“a“separate“object“from“the“collection“itself,“but“it“remains“valid“onlyŽ¡‘0so–?ýlong“as“the“collection“itself“still“exists.‘ úMultiple“indexes“may“exist“at“theŽ¡‘0same–?ýtime“against“the“same“collection,“and“each“index“maintains“its“own“position“withinŽ¡‘0an–?ýenumeration“sequence“for“the“collection.ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹šö “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:Ÿ ‘0¾Many–?ýindexes“provde“the“ability“modify“the“collection“they“refer“to,“in“addition“toޤ ‘0simply–?ýtraversing“members.‘ úAn“index“often“provides“the“complete“means“for“maintainingŽ¡‘0the–?ýcontents“of“a“collection,“more“than“could“otherwise“be“performed“on“the“collectionŽ¡‘0itself.‘ úThe–?ýposition“or“other“status“of“the“index“is“automatically“updated“to“reflectŽ¡‘0any–?ýchanges“made“through“the“index“itself.Ž©8äïhtml:ï html:Ÿ $ ‘0If–?ýchanges“to“a“collection“are“made“while“other“indexes“exist,“those“other“indexesŽ¡‘0could–?ýbe“affected“in“potentially“catastrophic“ways.‘ úEach“collection“type“documentsŽ¡‘0which–?ýkinds“of“changes“can“be“made“without“affecting“or“invalidating“existing“indexes.Ž¡‘0The–?ýIndexSafety“option“of“Collection“provides“additional“ways“to“protect“indexes“againstŽ¡‘0possible–?ýeffects“of“independent“updates.ަïhtml:ï html:ŸÇ‘0„¤ŽŽŸffïhtml:ï html:Ÿ¤²ÅInherited‘™™beha£×viorŽŸÜ÷ïhtml:ï html:Ÿ #ä‘0Ã@deftype–ffIndex“ŽŸ ]¾Each–?ýindex“is“a“stand-alone“object“allocated“within“a“zone“passed“as“an“argument“in“the“messageŽ¡that–?ýcreated“it.› úThis“zone“need“not“match“the“zone“of“a“collection.˜It“is“common“for“indexŽ¡lifetimes–?ýto“be“shorter“than“their“collection.‘ úFor“example,“indexes“can“be“created“in“a“temporaryŽ¡scratch–?ýzone“for“use“only“within“a“local“loop.ަïhtml:ï html:Ÿ $ ‘0Because–?ýmessages“to“a“collection“are“the“only“valid“way“to“create“an“index,“createŽ¡‘0messages–?ýand“create-time“options“are“not“used“with“index“types.‘ úAll“valid“processingŽ¡‘0on–?ýan“index“is“determined“by“characteristics“of“the“collection“from“which“it“is“created.Ž¡‘0Index–?ýtypes“are“typically“named“after“the“type“of“collection“they“are“created“from,Ž¡‘0and–?ýserve“principally“to“define“the“specific“messages“valid“for“an“index“on“that“typeŽ¡‘0of‘?ýcollection.ŽŸïhtml:ï html:Ÿ ]‘0Index–?ýobjects“support“the“universal“messages“of“the“top-level“DefinedObject“supertype,Ž¡‘0along–?ýwith“the“standard“drop:› úand“getZone“messages.˜Even“though“they“cannot“be“createdŽ¡‘0except–?ýfrom“a“collection,“new“index“objects“can“be“created“from“an“existing“indexŽ¡‘0using–?ýthe“standard“copy:– úmessage.“Each–?ýcopy“refers“to“the“same“collection“as“theŽ¡‘0initial–?ýindex,“and“starts“at“the“same“position“in“its“enumeration“sequence.‘ úIn“allŽ¡‘0other–?ýrespects,“however,“the“new“copy“is“an“independent“index“that“maintains“its“ownŽ¡‘0position–?ýunder“any“further“processing.ަïhtml:ï html:ŸÇ‘0„¤ŽŽŸffïhtml:ï html:Ÿ¤²ÅIndex‘™™beha£×viorŽŸÜ÷ïhtml:ï html:Ÿ #ä‘0Ã-‘ffgetCollection;ŽŸ ]¾getCollection–?ýreturns“the“collection“referred“to“by“an“index.‘ úThis“collection“never“changesŽ¡during–?ýthe“lifetime“of“the“index.ަïhtml:ï html:Ÿïhtml:ï html:Ÿ $ ‘0Ã-‘ffnext;ޤ ]‘0-‘ffprev;Ž¡¾The–?ýnext“and“prev“messages“are“the“basic“means“to“traverse“through“the“members“of“a“collection.ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹£^ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýкâ¾The–?ýnext“message“positions“the“index“to“the“next“valid“member“after“its“current“position,“orޤ ºâto–?ýa“special“position“after“the“end“of“all“valid“members.‘ úThe“prev“message“works“similarly,Ž¡ºâbut–?ýpositions“to“a“valid“member“preceding“the“current“position,“or“to“a“special“position“precedingŽ¡ºâall–?ývalid“members.‘ úIn“addition“to“repositioning“the“index,“both“messages“return“the“new“memberŽ¡ºâvalue–?ýto“which“they“are“positioned,“or“nil“if“there“is“no“such“member.Žºâ©8äïhtml:ï html:Ÿ ÕU‘0Following–?ýis“a“standard“form“of“loop“which“may“be“used“to“enumerate“the“members“ofŽ¡‘0a–?ýcollection“using“an“index:ަïhtml:ï html:Ÿ ÕU‘0Ãindex–ff=“[aCollection“begin:“aZone];ޤ 9‘:ÌÌwhile–ff(“(member“=“[index“next])“)“ó©±Ê cmsy9ÆfŽ¡‘E™˜Ã//–ffdo“something“with“member“...Ž¡‘:ÌÌÆgŽ¡¾When–?ýfirst“created,“the“current“position“of“an“index“is“always“set“to“the“special“positionޤ preceding–?ýall“valid“members.‘ úFrom“this“initial“position,“this“loop“accesses“each“succeedingŽ¡member–?ýin“turn.‘ úIt“assigns“each“member“value“to“a“local“variable“("member"“in“this“example)Ž¡until–?ýa“nil“value“is“returned.ޤïhtml:ï html:¡ïhtml:ï html:¤ 9‘0Ã-–fffindNext:“anObject;Ž¡‘0-–fffindPrev:“anObject;Ž¡¾findNext:– úand›?ýfindPrev:“repeatedly˜perform˜next˜or˜prev˜until˜the˜member˜value˜of˜the˜indexޤ matches–?ýtheir“argument.‘ únil“is“returned“if“the“index“reaches“the“end“of“valid“members“withoutŽ¡matching–?ýthe“argument.‘ úThey“are“only“convenience“shorthands“for“loops“which“could“otherwiseŽ¡be–?ýprogrammed“using“next“or“prev.ަïhtml:ï html:©ïhtml:ï html:Ÿ ÕU‘0Ã-‘ffget;ޤ 9‘0-–ffput:“anObject;Ž¡‘0-‘ffremove;Ž¡¾get–?ýreturns“the“member“value“at“which“the“index“is“currently“positioned,“or“nil“if“the“indexޤ is–?ýnot“positioned“at“a“member“The“put:‘ úmessage“replaces“the“member“value“at“the“current“indexŽ¡position–?ýwith“its“argument.‘ úNeither“of“these“messages“changes“the“current“position“of“theŽ¡index.ަïhtml:ï html:Ÿ 9‘0The–?ýget“message“provides“an“alternate“way“to“obtain“the“current“member“value“in“aŽ¡‘0loop–?ýthat“traverses“a“collection;“its“return“value“is“the“same“as“next“or“prev“wouldŽ¡‘0return–?ýwhen“first“positioning“to“a“new“member.ŽŸ8äïhtml:ï html:Ÿ ÕU‘0The–?ýremove“message“removes“the“member“at“the“current“location“of“an“index,“and“returnsŽ¡‘0the–?ýmember“value“removed.‘ úThe“index“position“is“set“to“a“special“position“betweenŽ¡‘0the–?ýmembers“which“previously“preceded“and“followed“the“removed“member.‘ úIf“there“isŽ¡‘0no–?ýpreceding“or“following“member,“the“index“is“set“to“the“special“location“beforeŽ¡‘0the–?ýstart“or“after“the“end“of“all“members.‘ úAfter“a“current“member“is“removed,“thereŽ¡‘0is–?ýno“member“at“the“current“index“location,“but“a“subsequent“next“or“prev“messageŽ¡‘0will–?ýcontinue“with“the“same“member“that“would“have“been“accessed“had“the“current“memberŽ¡‘0not–?ýbeen“removed.ަïhtml:ï html:Ÿ 9‘0Both–?ýput:‘ úand“remove“raise“the“InvalidIndexLoc“error“if“the“index“is“not“positionedŽ¡‘0at–?ýa“current“member.ަïhtml:ï html:¦ïhtml:ï html:¤ 9‘0Ã-‘ffgetLoc;Ž¡‘0-–ff(void)“setLoc:“locSymbol;ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹°Ó “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýкâ¾The–?ýgetLoc“message“returns“a“symbol“constant“which“indicates“the“type“of“location“at“whichޤ ºâan–?ýindex“is“currently“positioned.‘ úThis“index“location“symbol“has“one“of“the“following“values:Žºâ©8äïhtml:ï html:Ÿ Ç‘0Ãextern–ffid“‘ ÌÌStart,“End,“Between,“Member;ŽŸ ¾The–?ýStart“symbol“indicates“the“special“position“preceding“all“members“in“the“enumeration“sequenceŽ¡for–?ýthe“collection.‘ úThis“is“the“location“at“which“an“index“is“positioned“when“it“is“firstŽ¡created.‘ úThe–?ýEnd“symbol“indicates“the“special“position“following“all“members“in“the“collection.Ž¡This–?ýis“the“location“at“which“an“index“is“positioned“just“after“a“next“message“has“returnedŽ¡nil,–?ýas“a“result“of“moving“beyond“the“last“member.‘ úThe“Between“symbol“indicates“the“specialŽ¡position–?ýbetween“two“other“members,“at“which“an“index“is“positioned“after“a“current“member,Ž¡between–?ýtwo“other“members,“is“removed.‘ úThe“Member“symbol“indicates“that“the“index“is“positionedŽ¡at–?ýsome“current“member“in“the“enumeration“sequence“of“a“collection.ަïhtml:ï html:Ÿ Ç‘0The–?ýgetLoc“message“is“needed“to“traverse“a“collection“which“could“contain“nil“valuesŽ¡‘0for–?ýits“members.‘ úWithout“getLoc,“there“would“be“no“way“to“distinguish“a“nil“valueŽ¡‘0returned–?ýby“next“as“either“a“valid“member“value“or“the“special“value“returned“at“theŽ¡‘0end–?ýof“members.‘ úWith“getLoc,“a“loop“that“traverses“a“collection“can“test“specificallyŽ¡‘0for–?ýthe“end“(or“start)“of“members.‘ úFollowing“is“a“simple“loop“which“illustrates“suchŽ¡‘0usage:› úindex–?ý=“[aCollection“begin:˜aZone];“do“ó !",š cmsy10¸f“¾member“=“[index“next];“//“do“somethingŽ¡‘0with–?ýmember“...› ú¸g“¾while“(“[index“getLoc]“==“Member“);“The“setLoc:˜message“may“beŽ¡‘0used–?ýto“reset“the“current“location“of“an“index“to“either“Start“or“End.‘ úIt“may“beŽ¡‘0used–?ýto“reprocess“a“collection“using“an“existing“index“after“some“other“location“hasŽ¡‘0already–?ýbeen“reached.‘ úIt“may“also“be“used“to“position“an“index“at“the“end“of“allŽ¡‘0members–?ýprior“to“traversing“members“in“reverse“order“using“prev.ަïhtml:ï html:Ÿ Ç‘0Besides–?ýStart“and“End,“setLoc:‘ úaccepts“the“special“argument“values“of“BetweenAfterŽ¡‘0and–?ýBetweenBefore,“which“are“also“defined“symbols.‘ úThese“argument“values“are“onlyŽ¡‘0valid–?ýif“the“index“is“positioned“at“a“current“member.‘ úThey“reposition“the“index“toŽ¡‘0the–?ýspecial“location“between“the“current“member“and“its“immediately“following“or“precedingŽ¡‘0member.ޤïhtml:ï html:¡ïhtml:ï html:¤ ‘0Ã-–ff(int)“getOffset;Ž¡‘0-–ffsetOffset:“(int)offset;Ž¡¾Provided–?ýthere“is“no“major“computational“cost,“an“index“also“maintains“the“integer“offset“ofޤ its–?ýcurrent“member“within“the“enumeration“sequence“of“the“collection.‘ úThese“integer“offsetŽ¡values–?ýhave“the“same“definition“as“in“the“atOffset:› úmessages“of“Collection.˜The“getOffsetŽ¡message–?ýreturns“this“current“offset“value.‘ úIf“the“index“is“current“positioned“at“the“StartŽ¡or–?ýEnd“location,“getOffset“returns“-1.‘ úIf“the“index“is“positioned“at“a“Between“location,“getOffsetŽ¡returns–?ýthe“offset“of“the“immediately“preceding“member.‘ úIf“the“offset“is“not“currently“availableŽ¡from–?ýthe“index,“getOffset“returns“the“special“value“UnknownOffset.‘ úThis“value“is“defined“byŽ¡a–?ýmacro“as“the“maximally“negative“value“of“a“32-bit,“2's-complement“integer.ަïhtml:ï html:Ÿ Ç‘0An–?ýoffset“is“always“available“from“an“index“if“its“current“position“has“been“reachedŽ¡‘0by–?ýrepeated“operations“from“an“initial“Start“or“End“position,“and“there“has“been“noŽ¡‘0other–?ýmodification“to“the“underlying“collection.‘ úSome“forms“of“direct“member“accessŽ¡‘0operations–?ýsupported“by“some“index“types,“however,“may“result“in“an“integer“offsetŽ¡‘0not–?ýbeing“available.‘ úThese“restrictions“are“noted“with“the“individual“index“type.ަïhtml:ï html:Ÿ Ç‘0Using–?ýthe“setOffset:‘ úmessage,“an“index“may“be“positioned“directly“to“a“member“usingŽ¡‘0the–?ýoffset“of“the“member“within“its“enumeration“sequence.‘ úThe“speed“of“this“operationŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹¾÷ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýБ/ºâ¾depends–?ýon“the“specific“type“of“the“collection,“just“as“noted“for“the“atOffset:‘ úmessageޤ ‘/ºâon–?ýCollection.‘ úIn“the“worst“case,“this“operation“is“linear“in“the“magnitude“of“theŽ¡‘/ºâoffset.Žºâ¤ïhtml:ï html:¡ïhtml:ï html:¤ ‘0Ã-–ff(int)“compare:“anIndex;Ž¡¾The–?ýcompare:‘ úmessage“compares“the“current“location“of“one“index“with“the“current“locationŽ¡of–?ýanother“index“passed“as“its“argument.‘ úIf“the“two“indexes“have“the“same“location,“compare:Ž¡returns–?ýzero.› úOtherwise,“compare:˜returns“+1“or“-1“according“to“whether“the“argument“indexŽ¡precedes–?ýor“follows“the“receiver“index“in“the“enumeration“sequence“of“the“collection.‘ úIf“eitherŽ¡of–?ýthe“two“indexes“has“an“unknown“offset,“and“the“location“of“the“other“index“is“anything“otherŽ¡than–?ýStart“or“End“or“an“immediately“adjacent“member,“compare:‘ úreturns“the“UnknownOffset“integerŽ¡value.ŽŸïhtml:ï html:Ÿ‘0„¤ŽŽŸ ïhtml:ï html:¡‘0ÂMarcus–?ýG.“Daniels“ïhtml:ï html:‘¼rïhtml:ï html:Ž¡‘0(mailto:mgd@santafe.edu)ŽŸ8äïhtml:ï html:Ÿ Ç‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹Ðj “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:Ÿ žâÀNameŽŸªóïhtml:ï html:ŸƒçÅArray–™™{“collection“supporting“access“to“ xed“gr½«oup“of“membersŽ©‘0„¤ŽŽŸG®ïhtml:ï html:Ÿ=0ÀSynopsisŽŸ âcïhtml:ï html:Ÿü˜‘0Ã//ޤ €Æ‘0//–ffArray“--“collection“supporting“access“to“fixed“group“of“membersŽ¡‘0//Ž¡‘0@deftype–ffArray“CREATINGŽ¡‘0+–ffcreate:“aZone“setCount:“(int)count;Ž¡‘0+–ffcreate:“aZone“setMemberBlock:(id“*)members“setCount:(int)count;Ž¡‘0SETTINGŽ¡‘0-–ff(void)“setCount:“(int)count;Ž¡‘0-–ff(void)“setDefaultMember:“memberValue;Ž¡¡‘0-–ff(void)“setMemberBlock:“(id“*)members“setCount:“(int)count;Ž¡‘0USINGŽ¡‘0-‘ffgetDefaultMember;Ž¡‘0-–ff(id“*)“getMemberBlock;Ž¡‘0@endަ‘0„¤ŽŽŸG®ïhtml:ï html:Ÿ=0ÀDescriptionŽŸÞû¾An–?ýarray“is“a“collection“of“members“that“are“all“created“as“members“of“the“collection“at“theޤ same–?ýtime.‘ úExisting“member“values“may“be“replaced“with“new“values,“but“the“members“themselvesŽ¡are–?ýfixed“at“constant“offsets“within“the“collection.‘ úThe“fixed“structure“of“an“array“permitsŽ¡very–?ýfast“access“to“members“by“integer“offset“positions,“since“the“location“of“each“memberŽ¡may–?ýbe“directly“calculated.ŽŸ —ïhtml:ï html:© Gâ‘0The–?ýArray“type“is“one“of“the“simplest“collection“types“in“the“collections“library,Ž¡‘0and–?ýthe“closest“to“a“data“structure“directly“supported“in“C.“Unlike“C“arrays,“theŽ¡‘0group–?ýof“members“belonging“to“the“array“is“not“necessarily“fixed“for“the“lifetimeŽ¡‘0of–?ýthe“array,“but“may“be“dynamically“resized“to“contain“a“different“number“of“members.Ž¡‘0When–?ýan“array“is“dynamically“resized,“existing“member“values“are“preserved“as“muchŽ¡‘0as‘?ýpossible.ŽŸ8äïhtml:ï html:¦‘0The–?ýArray“type“adds“few“messages“to“the“generic“messages“inherited“from“Collection.Ž¡‘0This–?ýtype“is“provided“partly“so“that“a“fixed-structure“array“can“be“accessed“withŽ¡‘0the–?ýsame“uniform“set“of“basic“messages“as“any“other“kind“of“object“collection.‘ úItŽ¡‘0also–?ýhandles“all“required“memory“allocation“within“the“collection.‘ úAs“an“option,ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹Ö “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýБ/ºâ¾however,–?ýthe“Array“type“can“be“used“to“wrap“an“existing“C“array“for“external“accessޤ ‘/ºâas–?ýan“object“collection.‘ úIt“can“also“provide“access“to“an“internal“C“array“for“directŽ¡‘/ºâmanipulation–?ýusing“C“expressions.‘ úThese“forms“of“low-level“access“support“hybridŽ¡‘/ºâmodes–?ýof“use“in“which“advantages“of“both“low-level“manipulation“and“external“objectŽ¡‘/ºâaccess–?ýcan“be“combined.ŽºâŸïhtml:ï html:Ÿ‘0„¤ŽŽŸffïhtml:ï html:Ÿk8ÅInherited‘™™beha£×viorŽŸÜ÷ïhtml:ï html:Ÿ êj‘0Ã@deftype–ffArray“ŽŸ #оThe–?ýArray“type“is“directly“creatable,“and“supports“all“standard“messages“of“Collection“exceptŽ¡removal–?ýof“individual“members.‘ úThe“messages“based“on“an“integer“offset,“either“on“the“collectionŽ¡(atOffset:,–?ýatOffset:put:),“or“an“index“(setOffset:)› úall“execute“in“fast“constant“time.˜MembersŽ¡of–?ýan“array“are“fully“ordered“according“to“these“integer“offsets.‘ úSequential“access“to“membersŽ¡through–?ýits“members“is“also“fully“supported.‘ úThe“Array“type“disables“the“remove“message“inheritedŽ¡from–?ýCollection;“the“message“is“defined,“but“any“attempt“to“remove“a“member“will“raise“an“errorŽ¡that–?ýthe“operation“is“not“supported.Ž©8äïhtml:ï html:Ÿ ꦑ0While–?ýthe“IndexSafety“option“of“an“Array“defaults“to“Unsafe,“indexes“are“inherentlyŽ¡‘0safe–?ýunder“all“operations“with“the“exception“of“resizing“an“array“or“resetting“itsŽ¡‘0member–?ýallocation.‘ ú(The“only“individual“member“operation“which“modifies“contentsŽ¡‘0of–?ýan“array“is“replacing“a“member“value,“and“this“does“not“affect“existing“indexes.)Ž¡‘0The–?ýUnsafeAtMember“value“of“IndexSafety“is“not“supported“since“individual“membersŽ¡‘0cannot–?ýbe“added“or“removed.‘ úA“value“of“SafeAlways“makes“existing“indexes“safe“evenŽ¡‘0under–?ýresizing“or“reallocation.‘ úIf“an“existing“index“referred“to“a“member“locationŽ¡‘0that–?ýis“no“longer“contained“in“the“array,“the“index“location“is“reset“to“the“End“location.ަïhtml:ï html:¤ ꦑ0The–?ýdefault“value“of“the“ReplaceOnly“option“is“true,“and“cannot“be“overridden.ަïhtml:ï html:¡‘0The–?ýtype“of“index“returned“by“begin:› úon“an“array“is“simply“Index.˜There“is“no“specialޤ ‘0index–?ýtype“for“Array“because“there“are“no“additional“messages“beyond“those“alreadyŽ¡‘0defined–?ýby“Index.ަïhtml:ï html:ŸÇ‘0„¤ŽŽŸffïhtml:ï html:Ÿk8ÅCr½«eate-time‘™™optionsŽŸ ‘ýïhtml:ï html:Ÿ 5d‘0ÃSETIINGޤ #Š‘0-–ff(void)“setCount:“(int)count;Ž¡‘0-–ff(void)“setDefaultMember:“memberValue;Ž¡¡‘0-–ff(void)“setMemberBlock:“(void“*)members“setCount:“(int)count;Ž¡‘0USINGŽ¡‘0-–ff(void)“setDefaultMember:“memberValue;Ž¡‘0-‘ffgetDefaultMember;Ž¡¡‘0-–ff(void)“setMemberBlock:“(void“*)members“setCount:“(int)count;ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹ß– “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýБ/ºâÃ-–ff(void“*)“getMemberBlock;ŽŸ Bºâ¾All–?ýthe“Array“create-time“options“can“also“be“set“after“the“array“is“already“created,“subjectޤ ºâto–?ýrestrictions“noted“below.ŽºâŸïhtml:ï html:¡ïhtml:ï html:Ÿ¨ö‘0¿CountŽ©uþThe–?ýCount“option“sets“the“number“of“members“which“belong“to“the“collection.‘ úAny“non-negativeŽ¡value–?ýincluding“zero“is“valid.‘ úIf“the“array“already“exists,“the“any“existing“members“up“toŽ¡the–?ýnew“count“will“preserve“their“existing“values.‘ úIf“the“new“count“is“greater“than“the“existingŽ¡count,–?ýor“a“new“array“is“being“created,“all“members“will“be“assigned“an“initial“default“valueŽ¡of–?ýeither“nil,“or“a“value“previously“specified“for“DefaultMember.ŽŸ lïhtml:ï html:Ÿ ¬‘0The–?ýinherited“getCount“message“of“Collection“obtains“the“current“value“set“for“thisŽ¡‘0option.‘ úThere–?ýis“no“way“to“add“or“remove“members“of“an“array“except“using“the“setCount:Ž¡‘0message‘?ýdirectly.ŽŸ8äïhtml:ï html:¡ïhtml:ï html:Ÿ p‘0¿DefaultMemberަ¾When–?ýthis“option“is“set,“the“initial“value“of“all“new“members“will“be“set“to“the“member“valueŽ¡given–?ý(otherwise“the“default“is“nil).‘ úThis“option“gives“a“convenient“way“to“distinguish“membersŽ¡which–?ýhave“never“been“set“from“any“other“valid“member“value,“which“could“include“nil.‘ úThisŽ¡option–?ýmay“be“reset“after“array“creation“only“if“some“setting“for“the“option“was“given“at“createŽ¡time.‘ ú(The–?ýinitial,“explicitly“set“value“can“still“be“the“default“nil,“but“a“value“must“beŽ¡set–?ýexplicitly“for“the“option“to“be“resettable“later).‘ úThe“get“message“for“this“option“alwaysŽ¡retrieves–?ýthe“current“setting,“but“this“value“has“no“effect“except“when“the“count“of“an“arrayŽ¡is–?ýincreased,“so“that“new“members“need“to“be“initialized.ŽŸ–Àïhtml:ï html:¡ïhtml:ï html:Ÿ Ei‘0¿MemberBlockަ¾This–?ýoption“provides“a“means“to“wrap“an“existing“C“array“for“access“as“an“object“collection.Ž¡If–?ýthis“option“is“given,“dynamic“resizing“is“not“supported.‘ úThe“current“C“array“being“wrapped,Ž¡however,–?ýcan“be“replaced“by“giving“a“new“setting“for“MemberBlock“after“an“array“already“exists.Ž¡A–?ýnew“setting“can“be“given“only“if“some“setting“was“initially“given“at“create“time.ŽŸ lïhtml:ï html:© ¬‘0Even–?ýif“a“setting“was“not“given“for“MemberBlock“at“create“time,“the“get“message“forŽ¡‘0MemberBlock–?ýalways“returns“a“pointer“to“whatever“internal“memory“array“is“currentlyŽ¡‘0being–?ýused“by“the“array“object.‘ úIf“a“MemberBlock“setting“was“given,“the“pointer“returnedŽ¡‘0will–?ýbe“the“same“as“the“one“previously“given.‘ úIn“either“case,“the“pointer“returnedŽ¡‘0may–?ýbe“used“to“manipulate“member“values“in“any“way“desired“using“native“C“expressions.Ž¡‘0After–?ýan“array“has“been“created,“there“is“no“way“to“determine“whether“the“MemberBlockŽ¡‘0pointer–?ýwas“established“externally“or“by“internal“allocation.‘ úIf“the“pointer“wasŽ¡‘0established–?ýby“internal“allocation,“however,“the“external“program“must“make“no“attemptŽ¡‘0to–?ýfree“or“otherwise“reallocate“this“memory.ŽŸ8äïhtml:ï html:¦‘0A–?ýcount“must“always“be“supplied“with“an“external“member“allocation,“using“the“setCount:Ž¡‘0argument–?ýof“the“compound“message.‘ úIf“an“external“allocation“is“being“used,“the“onlyŽ¡‘0way–?ýto“reset“the“count“is“also“to“reset“MemberBlock;“any“attempt“to“use“the“setCount:Ž¡‘0message–?ýby“itself“will“raise“an“error.‘ úWhenever“an“external“member“allocation“isŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹ëì “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýБ/ºâ¾being–?ýused,“the“external“program“is“entirely“responsible“for“assuring“that“the“MemberBlockޤ ‘/ºâvalue–?ýis“a“pointer“to“valid“allocated“memory“containing“at“least“the“number“of“memberŽ¡‘/ºâslots–?ýgiven“by“setCount:.Žºâ©8äïhtml:ï html:Ÿ Ç‘0With–?ýan“external“member“allocation,“the“array“itself“will“not“attempt“to“either“allocateŽ¡‘0this–?ýmemory“or“free“it“when“the“array“is“dropped.‘ úDropping“the“array“only“removesŽ¡‘0its–?ýreference“to“the“external“allocation.ŽŸïhtml:ï html:¡‘0The–?ýpointer“to“allocated“memory“is“given“as“a“pointer“to“id“type,“but“if“a“data“typeŽ¡‘0given–?ýas“MemberType“has“size“greater“than“id,“the“pointer“must“actually“point“to“anŽ¡‘0array–?ýof“slots“each“of“which“has“the“size“of“the“data“type.ަïhtml:ï html:Ÿ Ç‘0Since–?ýan“array“neither“allocates“nor“frees“an“external“member“allocation,“the“sameŽ¡‘0region–?ýof“allocated“memory“may“be“referenced“by“multiple“arrays,“including“overlappingŽ¡‘0member–?ýranges“each“defined“by“starting“location“and“count.‘ úThis“flexibility“enablesŽ¡‘0alternate–?ýsubrange“views“of“a“single,“contiguous“initial“allocation“by“means“of“separatelyŽ¡‘0created–?ýexternal“collections.ŽŸïhtml:ï html:Ÿ‘0„¤ŽŽŸffïhtml:ï html:ŸG®ÅCr½«eate–™™combination“messagesŽŸ ‘ýïhtml:ï html:Ÿ Ú‘0ÃCREATINGŽ¡‘0+–ffcreate:“aZone“setCount:“(int)count;Ž¡‘0+–ffcreate:“aZone“setMemberBlock:(id“*)members“setCount:(int)count;Ž¡¾In–?ýaddition“to“the“standard“inherited“create“messages,“the“Array“type“supports“two“forms“ofŽ¡combination–?ýmessages“which“both“create“the“array“and“set“its“initial“options.‘ úThese“are“providedŽ¡both–?ýfor“convenience“and“to“provide“the“fastest“possible“array“creation“for“simple“cases“inŽ¡which–?ýspeed“might“be“important.‘ úThe“two“cases“supported“are“creating“an“array“with“a“memberŽ¡count–?ýfor“its“internal“members“already“set,“and“creating“an“array“which“refers“to“an“externalŽ¡member–?ýallocation.‘ úIf“any“more“options“than“these“are“needed,“the“normal“method“of“settingŽ¡options–?ýbetween“createBegin:‘ úand“createEnd“messages“should“be“used“instead.ަïhtml:ï html:ŸÇ‘0„¤ŽŽŸ ïhtml:ï html:¡‘0ÂMarcus–?ýG.“Daniels“ïhtml:ï html:‘¼rïhtml:ï html:Ž¡‘0(mailto:mgd@santafe.edu)ަïhtml:ï html:Ÿ Ç‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹úÕ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:Ÿ žâÀNameŽŸªóïhtml:ï html:ŸUBÅList,–™™ListIndex“{“collection“of“members“in“linear“sequenceŽ©‘0„¤ŽŽŸG®ïhtml:ï html:Ÿ‹ÀSynopsisŽŸ âcïhtml:ï html:ŸÍó‘0Ã//ޤ R!‘0//–ffList“-“collection“of“members“in“linear“sequenceŽ¡‘0//Ž¡‘0@deftype–ffList“CREATINGŽ¡‘0-–ff(void)“setEndsOnly:“(BOOL)endsOnly;Ž¡‘0USINGŽ¡‘0-–ff(BOOL)“getEndsOnly;Ž¡¡‘0-–ff(void)“addFirst:“anObject;Ž¡‘0-–ff(void)“addLast:“anObject;Ž¡¡‘0-‘ffremoveFirst;Ž¡‘0-‘ffremoveLast;Ž¡‘0@endŽ¡¡‘0//Ž¡‘0//–ffListIndex“--“index“with“insertion“capability“at“any“point“in“listŽ¡‘0//Ž¡‘0@deftype–ffListIndex“-“(void)“addAfter:“anObject;Ž¡‘0-–ff(void)“addBefore:“anObject;Ž¡‘0@endަ‘0„¤ŽŽŸG®ïhtml:ï html:Ÿ‹ÀDescriptionŽŸ°V¾A–?ýlist“is“a“collection“of“members“that“are“all“maintained“at“some“externally“assigned“positionޤ in–?ýa“linear“sequence“of“all“members.‘ úThe“sequence“is“established“by“the“position“at“whichŽ¡members–?ýare“added:‘ úmembers“can“be“added“at“the“start“of“list,“at“the“end,“or“at“any“pointŽ¡in–?ýthe“middle.ŽŸ ^5ïhtml:ï html:Ÿ R!‘0A–?ýlist“is“also“one“of“the“most“dynamic“of“basic“collections,“in“that“the“cost“of“addingŽ¡‘0and–?ýremoving“members“is“very“low.‘ úMembers“can“be“removed“from“any“position“just“asŽ¡‘0easily–?ýas“they“can“be“added.‘ úA“list“automatically“grows“and“shrinks“to“reflect“theŽ¡‘0number–?ýof“members“at“any“one“time,“and“there“is“no“fixed“capacity“which“limits“theŽ¡‘0size–?ýto“which“a“list“may“grow.ŽŸ8äïhtml:ï html:ŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹Ÿ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýБ/ºâ„¤ŽŽºâŸffïhtml:ï html:ŸÅInherited‘™™beha£×viorŽŸÜ÷ïhtml:ï html:Ÿ ™N‘0Ã@deftype–ffList“ŽŸ Òn¾The–?ýList“type“is“supports“all“messages“of“Collection.‘ úIf“created“with“default“options,“itޤ provides–?ýno“special“speedup“of“accesses“by“integer“offset.Ž©8äïhtml:ï html:Ÿ ™Š‘0Unless–?ýthe“EndsOnly“option“is“specified,“the“default“value“of“IndexSafety“is“UnsafeAtMember.Ž¡‘0This–?ýmeans“that“indexes“are“inherently“safe“under“all“operations“except“those“whichŽ¡‘0affect–?ýthe“member“at“an“index“or“immediately“adjacent“to“an“index“between“members.Ž¡‘0If–?ýthe“EndsOnly“option“is“specified,“the“default“value“of“IndexSafety“is“Unsafe.‘ úInŽ¡‘0this–?ýcase,“indexes“could“be“invalidated“by“any“operation“that“adds“or“removes“members.Ž¡‘0The–?ýSafeAlways“can“be“specified“for“any“case“to“get“a“guarantee“of“full“index“safety.ަïhtml:ï html:Ÿ ™Š‘0ListIndex–?ýis“a“special“index“type“just“for“list“collections.‘ úIt“provides“the“onlyŽ¡‘0method–?ýto“add“members“within“the“interior“of“a“list.ŽŸïhtml:ï html:©ffïhtml:ï html:ŸÅCr½«eate-time‘™™optionsŽŸ ‘ýïhtml:ï html:Ÿ äH‘0ÃCREATINGޤ Òn‘0-–ff(void)“setEndsOnly:“(BOOL)endsOnly;Ž¡‘0USINGŽ¡‘0-–ff(BOOL)“getEndsOnly;ŽŸ bÌïhtml:ï html:Ÿ Ö‘0¿EndsOnlyŽŸ¡¾(..› úThis–?ýoption“is“not“implemented“yet.)˜The“EndsOnly“option“restricts“a“list“so“that“membersޤ can–?ýbe“added“or“removed“only“at“either“end.‘ úThis“restriction“permits“an“alternate“implementationŽ¡that–?ýboth“reduces“memory“usage“and“enables“fast,“direct“access“to“members“by“integer“offset.Ž¡It–?ýobtains“key“performance“advantages“of“an“array“while“preserving“the“dynamic“extendabilityŽ¡of–?ýa“list.ŽŸ33ïhtml:ï html:¦ïhtml:ï html:ŸÅList‘™™beha£×viorŽŸÜ÷ïhtml:ï html:Ÿ ™N‘0Ã-–ff(void)“addFirst:“anObject;ޤ Òn‘0-–ff(void)“addLast:“anObject;Ž¡¾The–?ýaddFirst:› úand“addLast:˜messages“add“a“new“member“to“either“end“of“a“list.˜With“addFirst:,Ž© the–?ýnew“member“becomes“the“first“member“of“the“array.‘ úWith“addLast:,“it“becomes“the“last“member.ŽŸ8äïhtml:ï html:Ÿïhtml:ï html:Ÿ ™Š‘0Ã-‘ffremoveFirst;Ž¡‘0-‘ffremoveLast;Ž¡¾removeFirst–?ýand“removeLast“remove“either“the“first“or“last“member“of“a“list.‘ úThey“each“returnަthe–?ývalue“of“the“member“just“removed.ŽŸ8äïhtml:ï html:Ÿffïhtml:ï html:ŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹  “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýкâÅListIndex‘™™beha£×viorŽºâŸÜ÷ïhtml:ï html:Ÿ Æà‘0Ã//ޤ ‘0//–ffListIndex“--“index“with“insertion“capability“at“any“point“in“listŽ¡‘0//Ž¡‘0@deftype–ffListIndex“-“(void)“addAfter:“anObject;Ž¡‘0-–ff(void)“addBefore:“anObject;Ž¡‘0@endŽ¡¾The–?ýaddAfter:› úand“addBefore:˜messages“add“members“at“a“particular“point“in“the“sequence“ofŽ¡members–?ýmaintained“by“a“list.‘ úThe“current“location“of“an“index“determines“the“point“at“whichŽ¡a–?ýnew“member“will“be“added.› úThe“addAfter:˜message“adds“a“member“at“the“list“position“immediatelyŽ¡following–?ýthe“current“index“location.– úaddBefore:“adds–?ýa“member“to“the“immediately“precedingŽ¡location.‘ úNeither–?ýmessage“changes“the“current“location“of“the“index,“except“that“an“indexŽ¡can–?ýchange“from“a“Start“or“End“location“to“a“location“of“Between.Ž©8äïhtml:ï html:Ÿ Ç‘0Since–?ýan“index“may“be“positioned“to“any“location“in“a“list,“these“messages“enableŽ¡‘0the–?ýconstruction“of“any“desired“sequence“of“members.‘ úSince“the“current“index“locationŽ¡‘0remains–?ýunchanged,“multiple“members“may“all“be“inserted“successively“at“some“pointŽ¡‘0in–?ýa“list;“previously“added“members“are“just“pushed“out“one-by-one“as“new“membersŽ¡‘0are‘?ýadded.ŽŸïhtml:ï html:¡‘0An–?ýindex“with“a“location“of“Start,“End,“or“Between“is“just“as“valid“a“location“forŽ¡‘0addAfter:– úor›?ýaddBefore:“as˜an˜index˜positioned˜at˜a˜member.“In˜these˜cases,˜thereŽ¡‘0is–?ýno“member“at“the“current“location“of“the“index,“so“the“new“member“is“just“insertedŽ¡‘0directly–?ýat“the“current“index“location,“and“the“index“is“left“positioned“between“theŽ¡‘0new–?ýmember“and“the“member“that“was“previously“adjacent“in“the“opposite“direction.Ž¡‘0If–?ýthe“previous“location“was“Start“and“the“message“addAfter:,“or“the“location“wasŽ¡‘0End–?ýand“the“message“addBefore:,“the“index“location“remains“Start“or“End.ަïhtml:ï html:Ÿ Ç‘0If–?ýeither“the“addAfter:› úor“addBefore:˜message“is“requested“with“the“EndsOnly“option,Ž¡‘0and–?ýthe“index“location“is“not“Start“or“End,“or“if“remove“is“requested“on“an“indexŽ¡‘0that–?ýis“not“positioned“at“either“the“first“or“last“member,“an“invalid“operation“errorŽ¡‘0is‘?ýraised.ŽŸïhtml:ï html:Ÿ‘0„¤ŽŽŸ ïhtml:ï html:¡‘0ÂMarcus–?ýG.“Daniels“ïhtml:ï html:‘¼rïhtml:ï html:Ž¡‘0(mailto:mgd@santafe.edu)ަïhtml:ï html:Ÿ Ç‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹* “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:Ÿ žâÀNameŽŸªóïhtml:ï html:ŸËÅStack,–™™Queue“{“r½«estricted“f£×orms“of“listsŽŸ 3üïhtml:ï html:Ÿ Š…‘0¾(..› úNeither–?ýof“these“types“is“currently“implemented.˜They“are“nothing“more“thanŽŸ ‘0restricted–?ýcases“of“a“List,“so“if“you“need“them“use“a“List“instead.)ŽŸ8äïhtml:ï html:ŸÇ‘0„¤ŽŽ©G®ïhtml:ï html:Ÿ×ÀSynopsisŽŸ âcïhtml:ï html:Ÿ–|‘0Ã//–ffStack“--“form“of“list“with“add/remove“both“at“start“of“listޤ ª‘0//Ž¡‘0@deftype–ffStack“-“(void)“push:“anObject;Ž¡‘0-‘ffpop;Ž¡‘0@endŽ¡¡‘0//Ž¡‘0//–ffQueue“--“form“of“list“with“add“at“start“of“list“and“remove“at“lastŽ¡‘0//Ž¡‘0@deftype–ffQueue“-“(void)“enqueue:“anObject;Ž¡‘0-‘ffdequeue;Ž¡‘0@endŽŸ‘0„¤ŽŽ¦ïhtml:ï html:Ÿ×ÀDescriptionŽŸxß¾A–?ýStack“is“a“subtype“of“List“which“restricts“the“addition“and“removal“of“members“to“the“startޤ of–?ýa“list.‘ úQueue“is“a“subtype“of“List“which“restricts“addition“of“members“to“the“start“ofŽ¡the–?ýlist“and“removal“to“the“end.‘ úBoth“types“define“specially“named“messages“to“reflect“theŽ¡specialized–?ýusage“of“their“resulting“add“and“remove“operations.ŽŸ —ïhtml:ï html:ŸÇ‘0„¤ŽŽ¦ïhtml:ï html:Ÿ×ÀInterface‘QëRefer°genceŽŸªóïhtml:ï html:ŸËÅInherited‘™™beha£×viorŽŸÜ÷ïhtml:ï html:Ÿ ኑ0Ã@deftype–ffStack“@deftype“Queue“ŽŸ ª¾...ŽŸïhtml:ï html:Ÿffïhtml:ï html:ŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹#) “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýкâÅStack‘™™beha£×viorŽºâŸÜ÷ïhtml:ï html:Ÿ Æà‘0Ã-–ff(void)“push:“anObject;ޤ ‘0-‘ffpop;Ž¡¾...Ž©ïhtml:ï html:Ÿffïhtml:ï html:ŸG®ÅQueue‘™™beha£×viorŽŸ 3üïhtml:ï html:Ÿ oÛ‘0Ã-–ff(void)“enqueue:“anObject;Ž¡‘0-‘ffdequeue;Ž¡¾...ަïhtml:ï html:Ÿ‘0„¤ŽŽŸ ïhtml:ï html:¡‘0ÂMarcus–?ýG.“Daniels“ïhtml:ï html:‘¼rïhtml:ï html:Ž¡‘0(mailto:mgd@santafe.edu)ŽŸ8äïhtml:ï html:Ÿ Ç‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹*\ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:Ÿ žâÀNameŽŸªóïhtml:ï html:Ÿ3ÅK•£×eyšÛ$edCollection,‘™™K“ey˜edIndex–™™{“supertype“of“Set“and“Map“typesŽŸ‘0„¤ŽŽŸG®ïhtml:ï html:Ÿ¾|ÀSynopsisŽŸ âcïhtml:ï html:Ÿ}ä‘0Ã//ޤ ‘0//–ffKeyedCollection“--“supertype“of“Set“and“Map“typesŽ¡‘0//Ž¡‘0@deftype–ffKeyedCollection“CREATINGŽ¡‘0-–ff(void)“setDuplicatesOption:“duplicatesOption;Ž¡‘0-–ff(void)“setGroupType:“aCollectionType;Ž¡‘0-–ff(void)“setSingletonGroups:“(BOOL)singletonGroups;Ž¡¡‘0-–ff(void)“setSorted:“(BOOL)sorted;Ž¡‘0-–ff(void)“setCompareFunction:“(idXid_t)aFunction;Ž¡‘0-ŽŸ ‘0(void)‘+30setBucketFunction:–ff(bucket_t)aFunction“setBucketCount:“(int)n;Ž¡¡‘0-–ff(void)“setPartiallyOrdered:“(BOOL)partiallyOrdered;Ž¡‘0-–ff(void)“setMemberSlot:“(int)byteOffset;Ž¡‘0SETTINGŽ¡‘0-–ff(void)“setPartialOrderContext:“aKeyedCollectionCollection;Ž¡‘0USINGŽ¡‘0-‘ffgetDupOption;Ž¡‘0-‘ffgetGroupType;Ž¡‘0-–ff(BOOL)“getSingletonGroups;Ž¡¡‘0-–ff(BOOL)“getSorted;Ž¡‘0-–ff(int(*)())“getCompareFunction;Ž¡‘0-–ff(int(*)())“getBucketFunction;Ž¡‘0-–ff(int)“getMaxBuckets;Ž¡¡‘0-–ff(BOOL)“getPartiallyOrdered;Ž¡‘0-‘ffgetPartialOrderContext;Ž¡¡‘0-–ff(int)“getMemberSlot;Ž¡¡‘0-–ffat:“aKey;Ž¡‘0-–ff(BOOL)“containsKey:“aKey;Ž¡‘0-–ff(int)“getCountAtKey:“aKey;Ž¡¡‘0-–ffremoveKey:“aKey;Ž¡ŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹ -¢ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýБ/ºâÃ-–ffcreateIndex:“aZone“at:“aKey;ޤ ’‘/ºâ-–ffcreateIndex:“aZone“setMember:“aMember;Ž¡¡‘/ºâ-–ff(void)“getPredecessors:“aMember;Ž¡‘/ºâ-–ff(void)“getSuccessors:“aMember;Ž¡‘/ºâ-–ff(void)“getCostarts:“aMember;Ž¡‘/ºâ-–ff(void)“getCoends:“aMember;Ž¡‘/ºâ@endŽ¡¡‘/ºâ//Ž¡‘/ºâ//–ffKeyedIndex“--“index“behavior“shared“by“Set“and“Map“typesŽ¡‘/ºâ//Ž¡‘/ºâ@deftype–ffKeyedIndex“Ž¡‘/ºâ-–ff(int)“getCurrentLevel;Ž¡‘/ºâ-–ffgetIndexAtLevel:“(int)level;Ž¡¡‘/ºâ-–ffat:“aKey;Ž¡¡‘/ºâ-–ffsetMember:“aMember;Ž¡‘/ºâ@endŽŸ‘/ºâ„¤ŽŽºâŸG®ïhtml:ï html:ŸÐüÀDescriptionŽŸrǾA–?ýkeyed“collection“is“a“collection“in“which“each“member“can“be“compared“with“some“other“valueޤ that–?ýidentifies“the“member.› úThis“value“is“referred“to“as“the“member“key.˜The“key“value“mayŽ¡be–?ýdetermined“either“by“the“member“value“itself,“which“defines“a“Set,“or“by“external“associationŽ¡with–?ýthe“member“when“the“member“is“first“added,“which“defines“a“Map.ŽŸ —ïhtml:ï html:© Û®‘0The–?ýkeyed“collection“type“establishes“the“common“behavior“shared“by“both“Set“and“Map.Ž¡‘0Standard–?ýoptions“are“provided“to“declare“ordering“of“members“in“the“collection,“whichŽ¡‘0can–?ýbe“based“either“on“an“inherent“ordering“of“the“key“values“(a“sorted“collection)Ž¡‘0or–?ýexternal“maintenance“of“a“total“or“partial“order.‘ úAdditionally,“options“are“providedŽ¡‘0to–?ýdeclare“whether“duplicate“key“values“should“be“permitted,“and“if“so,“how.ŽŸ8äïhtml:ï html:¦‘0The–?ýoptions“for“handling“of“duplicate“keys“provide“considerable“flexibility.‘ úEntireŽ¡‘0structures–?ýof“nested“collections“can“be“created“that“subdivide“the“key“space“throughŽ¡‘0progressive–?ýlevels.‘ úBy“accepting“duplicate“keys,“and“organizing“members“of“the“sameŽ¡‘0identity–?ýinto“subgroups,“keyed“collections“support“the“abstract“data“type“known“asŽ¡‘0a–?ýbag“or“multiset.‘ úThe“index“on“a“keyed“collection“includes“the“ability“to“traverseŽ¡‘0throughout–?ýthe“contents“of“any“of“these“nested“collections.ŽŸ8äïhtml:ï html:ŸÇ‘0„¤ŽŽŸffïhtml:ï html:ŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹!4 “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýкâÅInherited‘™™beha£×viorŽºâŸÜ÷ïhtml:ï html:Ÿ ¨Ý‘0Ã@deftype–ffKeyedCollection“ŽŸ áý¾The–?ýKeyedCollection“type“inherits“all“standard“behavior“of“Collection.‘ úThe“KeyedCollectionޤ type–?ýis“not“itself“creatable;“it“only“serves“as“a“common“supertype“for“Set“and“Map“collectionŽ¡types.Ž©8äïhtml:ï html:Ÿ ©‘0The–?ýdefault“value“of“IndexSafety“for“a“KeyedCollection“is“Unsafe,“but“values“of“eitherŽ¡‘0UnsafeAtMember–?ýor“SafeAlways“can“be“requested“to“guarantee“a“higher“level“of“safety.ަïhtml:ï html:Ÿffïhtml:ï html:ŸðÇÅCr½«eate-time‘™™optionsŽŸ…Ô¾(..‘ úNone–?ýof“these“options“is“implemented“yet,“except“for“CompareFunction.)ŽŸ Ü»ïhtml:ï html:Ÿïhtml:ï html:Ÿ ©‘0ÃCREATINGޤ áý‘0-–ff(void)“setDupOption:“dupOption;Ž¡‘0-–ff(void)“setGroupType:“aCollectionType;Ž¡‘0-–ff(void)“setSingletonGroups:“singletonGroups;Ž¡¡‘0-–ff(void)“setSorted:“(BOOL)sorted;Ž¡‘0-–ff(void)“setCompareFunction:“(idXid_t)aFunction;Ž¡¡‘0-–ff(void)“setPartiallyOrdered:“(BOOL)partiallyOrdered;Ž¡¡‘0-–ff(void)“setMemberSlot:“(int)byteOffset;Ž¡‘0SETTINGŽ¡‘0-ŽŸ ‘0(void)‘+30setBucketFunction:–ff(bucket_t)aFunction“setBucketCount:“(int)n;Ž¡‘0-–ff(void)“setPartialOrderContext:“aKeyedCollection;Ž¡‘0USINGŽ¡‘0-‘ffgetDupOption;Ž¡‘0-‘ffgetGroupType;Ž¡‘0-–ff(BOOL)“getSingletonGroups;Ž¡¡‘0-–ff(BOOL)“getSorted;Ž¡‘0-–ff(int(*)())“getCompareFunction;Ž¡¡‘0-–ff(BOOL)“getPartiallyOrdered;Ž¡‘0-‘ffgetPartialOrderContext;Ž¡¡‘0-–ff(int)“getMemberSlot;Ž¡¡‘0-–ff(int(*)())“getBucketFunction;Ž¡‘0-–ff(int)“getBucketCount;ŽŸ bÌïhtml:ï html:ŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹"=R “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýБ/ºâ¿DupOptionŽŸ.vºâ¾The–?ývalue“of“DupOption“specifies“how“duplicate“key“values“are“to“be“handled“within“a“keyedޤ ºâcollection.‘ úThis–?ýoption“has“one“of“the“following“values:ŽºâŸ lïhtml:ï html:© Â_‘0Ãid–ff‘ ÌÌDupIsError,“DupRejected,“KeepDuplicates,“KeepCountOnly;ŽŸ ûC¾If–?ýthe“DupIsError“value“is“specified,“any“attempt“to“insert“a“duplicate“key“is“an“error,“andŽ¡effects–?ýof“such“an“attempt“depend“on“the“level“of“debug“checking.‘ úIf“debug“checking“for“thisŽ¡error–?ýis“turned“on,“the“collection“will“check“whether“any“new“key“duplicates“an“existing“one,Ž¡and–?ýraise“a“DuplicateKey“error“if“it“does.‘ úIf“debug“checking“is“turned“off,“there“is“no“guaranteeŽ¡that–?ýany“check“will“be“made,“and“the“effects“could“be“unpredictable“in“or“catastrophic“or“insidiousŽ¡ways.ŽŸ8äïhtml:ï html:¦‘0With–?ýa“value“of“DupRejected,“attempts“to“insert“a“duplicate“key“are“always“detected,Ž¡‘0and–?ýthe“attempt“rejected.‘ ú(All“insert“messages“return“a“boolean“flag“as“to“whetherŽ¡‘0a–?ýduplicate“occurred.)ŽŸ8äïhtml:ï html:¦‘0With–?ýa“value“of“KeepDuplicates,“attempts“to“insert“a“duplicate“key“are“always“accepted,Ž¡‘0and–?ýall“members“having“the“same“key“are“retained“in“a“specially“created“internal“collectionŽ¡‘0containing–?ýjust“the“members“that“all“have“that“same“key.‘ úThis“collection“then“becomesŽ¡‘0the–?ýsingle“member“internally“associated“with“the“key“value.ŽŸ8äïhtml:ï html:¦‘0With–?ýa“value“of“KeepCountOnly,“duplicate“members“are“not“retained.‘ úInstead,“onlyŽ¡‘0a–?ýcount“of“the“net“number“of“insertions“and“removals“at“that“key“value“are“retainedŽ¡‘0within–?ýthe“collection.‘ úWith“this“value,“member“values“cannot“be“retrieved“from“theŽ¡‘0collection,–?ýbut“only“a“count“of“members“for“a“given“key“value,“using“different“messages.Ž¡‘0This–?ývalue“is“accepted“only“for“the“Set“subtype“of“a“KeyedCollection.ŽŸ8äïhtml:ï html:¡ïhtml:ï html:Ÿ (Å‘0¿GrȹoupT‘ÿ¬ypeŽŸ.v¾The–?ýGroupType“option“specifies“the“type“of“internal“collection“to“be“created“for“members“thatŽ¡all–?ýhave“the“same“key.‘ úThis“option“is“valid“only“if“DupOption“is“also“set“to“a“value“of“KeepDuplicates.ŽŸ lïhtml:ï html:¦‘0Without–?ýthis“option,“the“type“of“internal“collection“created“for“members“with“theŽ¡‘0same–?ýkey“depends“on“the“specific“subtype.‘ úThis“option“allows“an“external“programŽ¡‘0to–?ýcustomize“the“type“of“internal“collection“permitted.‘ úThe“argument“must“be“a“previouslyŽ¡‘0created–?ýsubtype“of“Collection.‘ úTypically,“the“argument“is“a“customized“version“ofŽ¡‘0one–?ýof“the“standard“collection“types“such“as“List,“Set,“or“Map;“the“argument“wouldŽ¡‘0be–?ýthe“type“object“returned“by“customizeEnd“after“a“customizeBegin:‘ úsequence.ŽŸ8äïhtml:ï html:¦‘0More–?ýinformation“about“all“the“ways“this“option“can“be“interpreted“is“provided“withŽ¡‘0each‘?ýsubtype.ŽŸ8äïhtml:ï html:¡ïhtml:ï html:Ÿ (Å‘0¿SingletonGrȹoupsŽŸ.v¾If–?ýthis“option“is“true,“the“type“of“collection“created“for“members“with“duplicate“keys“is“alsoŽ¡created–?ýeven“when“there“is“only“member“for“a“particular“key.‘ úThis“option“can“be“convenientŽ¡to–?ýassure“uniformity“of“a“keyed“collection“with“nested“structure.‘ úThis“option“is“valid“onlyŽ¡if–?ýDupOption“is“also“set“to“a“value“of“KeepDuplicates.ŽŸ lïhtml:ï html:ŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹#Dü “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:Ÿ ‘0¿SortedŽ©ë…¾If–?ýthis“option“is“true,“the“immediate“members“of“a“keyed“collection“(included“collections“ofޤ duplicate–?ýmembers,“if“any)“are“totally“ordered“according“to“an“ordering“relation“defined“onŽ¡key–?ývalues.› úThe“default“order“for“sorting“is“determined“by“a“standard“compare:˜message“onŽ¡a–?ýkey“value“to“be“added“vs.› úexisting“keys“of“the“collection.˜This“default“method“to“establishŽ¡order–?ýcan“be“overridden“using“the“CompareFunction“option.ŽŸ lïhtml:ï html:Ÿ n‘0The–?ýdefault“for“the“Sorted“function“is“true,“unless“a“value“is“also“given“for“theŽ¡‘0option‘?ýBucketFunction.ŽŸ8äïhtml:ï html:¡ïhtml:ï html:Ÿ åÔ‘0¿ComparȹeFunctionަ¾Use–?ýthe“function“pointed“to“by“the“argument“as“the“method“for“determining“whether“two“membersŽ¡have–?ýthe“same“key“value,“and“also“for“ordering“the“keys“of“the“collection“if“the“Sorted“optionŽ¡is–?ýtrue.‘ úThe“argument“is“declared“with“the“following“function“pointer“type:ŽŸ lïhtml:ï html:© n‘0Ãtypedef–ffint“(*idXid_t)(“id,“id“);ŽŸ ¸R¾The–?ýfunction“given“will“be“called“whenever“one“key“value“needs“to“be“compared“with“another.Ž¡Multiple–?ýcalls“to“the“function“typically“occur“whenever“members“are“added“or“removed“from“theŽ¡collection,–?ýuntil“the“correct“member“for“insertion“or“removal“is“determined.ŽŸcïhtml:ï html:Ÿ TÅ‘0The–?ýcompare“function“accepts“two“key“values“as“its“arguments.‘ úLike“member“types,Ž¡‘0key–?ýtypes“declared“with“the“id“pointer“type,“but“may“contain“any“type“of“value“(suchŽ¡‘0as–?ýan“integer)“up“to“the“size“of“an“id.‘ úAn“explicit“compare“function“can“supportŽ¡‘0any–?ýtype“of“value“as“a“key,“regardless“of“whether“it“is“an“object“that“supports“aŽ¡‘0standard‘?ýcompare:‘ úmessage.ŽŸ8äïhtml:ï html:¦‘0The–?ýcompare“function“is“called“repeatedly“by“the“collection“to“compare“two“key“values.Ž¡‘0The–?ýfunction“should“return“zero“if“the“key“values“are“equal,“-1“for“the“first“keyŽ¡‘0argument–?ýless“than“the“second,“and“+1“for“the“first“greater“than“the“second.‘ úIf“aŽ¡‘0keyed–?ýcollection“is“not“sorted,“either“-1“or“+1“may“be“returned“for“unequal“keys,Ž¡‘0regardless–?ýof“whether“one“might“be“taken“as“greater“or“less“than“the“other.ŽŸ8äïhtml:ï html:¡ïhtml:ï html:Ÿ åÔ‘0¿BuckáIetFunctionŽŸë…¾The–?ýBucketFunction“option“specifies“a“function“that“is“called“whenever“a“member“of“an“unsortedŽ¡collection–?ýis“added“or“removed.‘ úIt“may“also“be“used“for“a“sorted“collection“to“provide“fasterŽ¡insertion–?ýand“removal“of“members.‘ úThe“responsibility“of“a“"bucket“function"“is“to“assign“theŽ¡key–?ývalue“to“some“integer“in“a“range“from“zero“up“to“some“maximum“value.‘ úThese“integers“identifyŽ¡"buckets"–?ýto“which“the“same“key“value“will“also“be“assigned“whenever“passed“to“the“function.Ž¡If–?ýthe“collection“is“unsorted,“these“buckets“represent“hash“buckets,“and“for“speed“should“beŽ¡relatively–?ýsparse“(few“keys“likely“in“any“one“bucket,“given“the“expected“size“of“the“collection).Ž¡If–?ýthe“collection“is“sorted,“these“buckets“represent“ordered“buckets“to“which“the“same“rangeŽ¡of–?ýkey“values“will“always“be“assigned.‘ úSuch“sorted“buckets“can“speed“up“the“search“for“a“keyŽ¡location–?ýwithin“a“sorted“collection.‘ úSorted“buckets“can“also“be“sparse“to“minimize“the“needŽ¡for–?ýfurther“sorting“within“each“bucket.‘ úIf“many“keys“end“up“in“the“same“sorted“bucket,“theŽ¡sorting–?ýprocess“normally“used“without“buckets“is“still“used,“so“there“is“less“performance“impactŽ¡than–?ýwith“hash“keys“of“an“unsorted“collection.ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹$S“ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:Ÿ ‘0¾A–?ýbucket“function“accepts“a“single“key“value“as“its“argument,“and“return“an“integerޤ ‘0that–?ýidentifies“a“bucket.‘ úAs“with“a“compare“function,“the“key“value“is“declared“asŽ¡‘0an–?ýid“pointer“type,“but“may“actually“contain“whatever“kind“of“value“is“used“withinŽ¡‘0the–?ýcollection.‘ úFollowing“is“the“type“of“the“bucket“function“pointer:Ž©8äïhtml:ï html:Ÿïhtml:ï html:Ÿ jb‘0Ãtypedef–ffint“(*bucket_t)(“id“);ŽŸ£F¾A–?ýnew“bucket“function“may“be“established“any“time“during“the“lifetime“of“a“collection.‘ úA“newŽ¡bucket–?ýfunction“can“ensure“that“keys“remain“suitably“distributed“to“buckets“as“the“total“numberŽ¡of–?ýkeys“in“a“collection“grows“or“shrinks.ަïhtml:ï html:¡ïhtml:ï html:©ÐÈ‘0¿BuckáIetCountŽŸÖy¾A–?ývalue“for“MaxBuckets“must“be“given“in“the“same“message“that“sets“a“bucket“function.‘ úItsŽ¡value–?ýspecifies“the“number“of“buckets“to“which“a“bucket“function“assigns“its“keys.‘ úThe“maximumŽ¡value–?ýreturned“by“a“bucket“function“should“be“one“less“than“this“value.ŽŸ lïhtml:ï html:¡ïhtml:ï html:¦‘0¿PáIartiallyOrderȹedŽŸÖy¾A–?ýpartially“ordered“collection“supports“the“maintenance“of“individual“ordering“relations“amongŽ¡its–?ýmembers.‘ úEach“such“relation“is“an“assertion“that“one“member“should“always“precede“anotherŽ¡in–?ýthe“enumeration“sequence“of“the“collection.‘ úWhen“an“index“traverses“the“collection,“itŽ¡will–?ýguarantee“that“all“the“predecessors“of“a“member“have“already“been“visited“before“the“memberŽ¡itself–?ýis“reached.ŽŸ33ïhtml:ï html:Ÿ£F‘0If–?ýtrue,“PartiallyOrdered“specifies“that“messages“for“maintaining“a“partial“orderŽ¡‘0are–?ýenabled“on“the“collection.‘ úAn“error“will“be“raised“if“individual“members“do“notŽ¡‘0have–?ýa“unique“identity“within“the“innermost“collection“within“which“they“are“contained.Ž¡‘0This–?ýmeans“that“if“duplicate“keys“are“permitted“by“the“collection,“a“collection“typeŽ¡‘0must–?ýalso“be“specified“for“GroupType“which“does“not“itself“accept“duplicates.‘ úEveryŽ¡‘0member–?ýin“a“partial“order“must“have“a“unique“identity“so“that“the“member“itself“isŽ¡‘0sufficient–?ýto“identify“it“within“the“network“of“partial“orders.ŽŸ8äïhtml:ï html:¡ïhtml:ï html:¦‘0¿P•áIartialOrderContext:‘¸PaK³3ey“edCollectionCollectionŽŸÖy¾Ordering–?ýrelations“may“be“maintained“not“only“between“members“belonging“to“the“same“collection,Ž¡but–?ýbetween“members“and“other“collections,“as“long“as“all“participants“in“an“ordering“are“containedŽ¡somewhere–?ýwithin“a“larger“common“collection.‘ úAn“ordering“relation“with“a“nested“collectionŽ¡specifies–?ýthat“all“members“in“the“collection“are“successors“or“predecessors“of“the“other“member.Ž¡Ordering–?ýrelations“can“also“be“established“between“members“of“a“larger,“containing“collection,Ž¡and–?ýindividual“members“of“a“nested“collection.ŽŸ33ïhtml:ï html:Ÿ£F‘0The–?ýkeyed“collection“specified“as“the“value“for“PartialOrderContext“must“specify“anotherŽ¡‘0collection–?ýin“which“the“local“collection“is“maintained.‘ úIt“is“an“error“if“the“PartialOrderContextŽ¡‘0collection–?ýdoes“not“actually“contain“the“local“collection.ŽŸ8äïhtml:ï html:¡ïhtml:ï html:ŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹%bä “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýБ/ºâ¿getMemberSlotŽŸ¦@ºâ¾The–?ýMemberSlot“option“indicates“that“space“has“been“reserved“within“each“member“that“allowsޤ ºâit–?ýto“contain“a“link“directly“to“its“position“in“the“enumeration“for“a“collection.‘ úIf“suchŽ¡ºâspace–?ýhas“been“reserved,“special“messages“can“be“used“that“rapidly“position“an“index“directlyŽ¡ºâto–?ýthe“member.‘ úOperations“to“remove“members“are“also“much“faster.ŽºâŸ lïhtml:ï html:© :)‘0The–?ývalue“of“MemberSlot“specifies“the“offset“in“bytes“from“the“start“of“each“memberŽ¡‘0where–?ýthe“space“for“its“position“link“has“been“reserved.‘ úThe“following“typedefs“areŽ¡‘0provided–?ýto“declare“the“space“required“for“a“position“link“within“a“member“allocation:ŽŸ8äïhtml:ï html:Ÿïhtml:ï html:¦‘0Ãtypedef–ffstruct“memberData“Æf“Ãvoid“*memberData[2];“Æg‘@ÌÈÃmember_t;ޤ s ‘0typedef–ffstruct“memberData“Æf“Ãvoid“*memberData[2];“id“owner;“Æg‘ ÌÌÃdupmember_t;Ž¡¾The–?ýfirst“type“declares“the“required“space“for“a“position“link“in“a“collection“that“does“notޤ accept–?ýduplicate“key“values.‘ úThe“second“type“is“required“if“duplicate“keys“are“permitted.ŽŸ8äïhtml:ï html:¦‘0The–?ýoffset“of“the“position“link“from“the“start“of“a“member“may“be“either“positiveŽ¡‘0or–?ýnegative,“in“the“range“of“-2048“to“+2047.‘ úThe“default“value“of“MemberSlot“is“UnknownOffsetŽ¡‘0(a–?ýlarge“negative“value),“which“specifies“that“no“slot“for“an“internal“position“linkŽ¡‘0is–?ýavailable“within“each“member.ŽŸïhtml:ï html:Ÿ s ‘0If–?ýa“member“slot“is“defined,“a“memory“pointer“of“some“kind“must“always“be“used“forŽ¡‘0the–?ývalue“of“every“member.‘ úThese“members“may“be“object“id“pointers,“but“other“typesŽ¡‘0of–?ýmemory“pointers“are“acceptable“as“well.ŽŸ8äïhtml:ï html:¦‘0The–?ýcontents“of“the“first“two“words“of“position“link“vary“according“to“the“positionŽ¡‘0of–?ýa“member“in“a“collection.‘ úThe“third“word“of“a“dupmember_t“link“contains“the“idŽ¡‘0of–?ýthe“collection“in“which“a“member“is“directly“contained.‘ úThis“collection“is“eitherŽ¡‘0an–?ýinternally“created“collection“containing“members“with“duplicate“keys,“or“the“collectionŽ¡‘0to–?ýwhich“the“member“was“added“if“there“is“no“other“member“with“the“same“key.ŽŸ8äïhtml:ï html:ŸÇ‘0„¤ŽŽŸffïhtml:ï html:Ÿº»ÅK•£×eyÛ$edCollection‘™™beha“viorŽŸä¾(..‘ úNone–?ýof“the“messages“or“other“behavior“relating“to“duplicate“key“values“are“currentlyŽ¡implemented.)ŽŸ Ü»ïhtml:ï html:¦‘0Ã-–ffat:“aKey;ޤ s ‘0-–ff(BOOL)“containsKey:“aKey;Ž¡‘0-–ff(int)“getCountAtKey:“aKey;‘ ÌÌ//“unimplementedŽ¡¡‘0-–ffremoveKey:“aKey;Ž¡¾The–?ýat:‘ úmessage“returns“the“existing“member“of“the“collection“which“matches“the“key“valueޤ passed–?ýas“its“argument,“or“nil“if“there“is“no“key“value“in“the“collection“which“matches.‘ úIfŽ¡duplicate–?ýentries“for“this“key“exist,“the“entire“collection“of“duplicate“members“created“forŽ¡the–?ýkey“value“is“returned“instead.ŽŸ8äïhtml:ï html:¦‘0The–?ýcontainsKey:‘ úmessage“returns“true“if“the“key“value“passed“as“its“argument“isŽ¡‘0contained–?ýin“the“collection,“and“false“otherwise.‘ úThe“getCountAtKey“message“returnsŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹&q  “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýБ/ºâ¾the–?ýnumber“of“member“entries“which“are“all“associated“with“its“key“value“argument.ޤ ‘/ºâThis–?ýnumber“is“zero“if“the“key“value“is“not“contained“in“the“collection,“and“willŽ¡‘/ºânever–?ýexceed“one“one“unless“a“collection“accepts“duplicate“entries“for“a“key.Žºâ©8äïhtml:ï html:Ÿ ÛØ‘0The–?ýremoveKey:‘ úmessage“removes“a“member“matching“a“key“value“from“the“collection,Ž¡‘0and–?ýreturns“the“member“just“removed.‘ úIt“returns“nil“if“there“is“no“key“value“in“theŽ¡‘0collection–?ýwhich“matches.‘ úIf“more“than“one“entry“was“present“for“the“key“value,“itŽ¡‘0removes–?ýand“returns“the“first“member“in“the“internal“collection“created“for“duplicateŽ¡‘0members.ޤïhtml:ï html:¡ïhtml:ï html:¤ ¼‘0Ã-–ffcreateIndex:“aZone“at:“aKey;Ž¡‘0-–ffcreateIndex:“aZone“setMember:“aMember;Ž¡¾(..‘ úNeither–?ýof“these“messages“is“currently“implemented.)ަïhtml:ï html:Ÿ ÛØ‘0The–?ýcreateIndex:at:‘ úmessage“creates“a“new“index“on“the“collection“and“also“sets“itsޤ ‘0current–?ýposition“to“the“first“member“matching“the“key“value“given“as“its“final“argument.Ž¡‘0It–?ýreturns“the“index“just“created.ަïhtml:ï html:Ÿ ÛØ‘0The–?ýcreateIndex:at:‘ úmessage“creates“a“new“index“on“the“collection“and“also“sets“itsŽ¡‘0current–?ýposition“to“the“member“passed“as“its“final“argument.‘ úThis“message“is“validŽ¡‘0only–?ýif“an“internal“member“slot“was“defined“for“the“collection“with“the“MemberSlotŽ¡‘0option.ަïhtml:ï html:Ÿïhtml:ï html:Ÿ ÛØ‘0Ã-–ff(void)“getPredecessors:“aMember;ޤ ¼‘0-–ff(void)“getSuccessors:“aMember;Ž¡‘0-–ff(void)“getCostarts:“aMember;Ž¡‘0-–ff(void)“getCoends:“aMember;Ž¡¾(..› úNone–?ýof“these“messages“is“currently“implemented.)˜These“messages“maintain“the“orderingŽŸ relations–?ýwithin“a“partially“ordered“collection.ަïhtml:ï html:Ÿffïhtml:ï html:Ÿ#†ÅK•£×eyÛ$edIndex‘™™beha“viorŽŸ ‘ýïhtml:ï html:Ÿ &–‘0Ã-–ff(int)“getCurrentLevel;Ž¡‘0-–ffgetIndexAtLevel:“(int)level;Ž¡¾An–?ýindex“to“a“keyed“collection“traverses“all“members“of“the“collection,“regardless“of“whetherޤ these–?ýmembers“belong“to“collections“of“members“entered“under“duplicate“key“values.‘ úInternally,Ž¡however,–?ýan“index“keeps“track“of“any“specific“subcollection“it“is“currently“processing.‘ úTheŽ¡getCurrentLevel–?ýmessage“returns“the“level“of“nesting,“within“collections“of“duplicate“entriesŽ¡for–?ýa“current“key“value,“to“which“the“current“position“of“an“index“belongs.‘ úThe“level“returnedŽ¡is–?ýan“integer“that“starts“at“zero“for“the“top-level“collection,“and“increases“by“one“for“eachŽ¡level–?ýof“nested“collection“that“is“currently“active.ަïhtml:ï html:Ÿ ÛØ‘0While–?ýprocessing“any“nested“collections,“the“index“for“a“keyed“collection“actuallyŽ¡‘0maintains–?ýa“separate,“internal“index“for“each“level“of“collection“that“is“currentlyŽ¡‘0active.› úThe–?ýindex“at“each“level“may“be“retrieved“using“the“getIndexAtLevel:˜message.ަïhtml:ï html:Ÿïhtml:ï html:Ÿ ÛØ‘0Ã-–ffat:“aKey;ŽŸ ¼¾The–?ýat:‘ úmessage“repositions“the“index“to“the“first“member“that“matches“the“key“value“passedŽ¡as–?ýits“argument.ަïhtml:ï html:ŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹'~Ñ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:© ‘0Ã-–ffsetMember:“aMember;ޤ ¾(..› úThis–?ýmessage“is“not“currently“implemented.)˜The“setMember:˜message“repositions“the“indexŽ¡to–?ýthe“member“passed“as“its“argument.‘ úThis“message“is“valid“only“if“an“internal“member“slotŽ¡was–?ýdefined“for“the“collection“with“the“MemberSlot“option.ŽŸ8äïhtml:ï html:ŸÇ‘0„¤ŽŽ¦ïhtml:ï html:¡‘0ÂRoger–?ýBurkhart“ïhtml:ï html:‘¼rïhtml:ï html:Ž¡‘0(mailto:rmb@santafe.edu)ŽŸ8äïhtml:ï html:Ÿ Ç‘0¾Last–?ýmodified:‘ ú1997-12-19“(mgd)ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹(ŒÖ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:Ÿ žâÀNameŽŸªóïhtml:ï html:ŸŠÅSet–™™{“collection“of“members“each“ha£×ving“a“de ned“identityŽ©‘0„¤ŽŽŸG®ïhtml:ï html:ŸÑÓÀSynopsisŽŸ âcïhtml:ï html:Ÿ‘;‘0Ã//ޤ i‘0//–ffSet“--“collection“of“members“each“having“a“defined“identityŽ¡‘0//Ž¡‘0@deftype–ffSet“CREATINGŽ¡‘0-–ff(void)“setKeyFunction:“(id“(*)(id))aFunction;Ž¡‘0USINGŽ¡‘0-–ff(id“(*)(id))“getKeyFunction;Ž¡¡‘0-–ff(BOOL)“add:“anObject;Ž¡‘0-–ff(BOOL)“add:“anObject“setIndex:“anIndex;Ž¡‘0-–ffreplace:“anObject;Ž¡‘0@endަ‘0„¤ŽŽŸG®ïhtml:ï html:ŸÑÓÀDescriptionŽŸsž¾Set–?ýis“a“subtype“of“KeyedCollection“in“which“the“key“value“associated“with“each“member“is“determinedޤ by–?ýthe“member“value“itself.‘ úThe“key“value“may“be“identical“to“the“member“itself,“or“may“beŽ¡defined–?ýas“a“a“function“of“the“member“using“a“create-time“option.ŽŸ —ïhtml:ï html:©ffïhtml:ï html:Ÿ$3ÅInherited‘™™beha£×viorŽŸÜ÷ïhtml:ï html:Ÿ ÜI‘0Ã@deftype–ffSet“ŽŸ i¾The–?ýSet“type“inherits“most“of“its“interface“from“the“KeyedCollection“supertype.‘ úSet“definesŽ¡no–?ýcreate-time“options“beyond“those“already“defined“by“KeyedCollection.‘ úIf“a“custom“compareŽ¡or–?ýbucket“function“is“specified,“the“member“value“is“passed“as“the“key“value“arguments“of“theseŽ¡functions.‘ úThese–?ýfunctions“determine“what“part“of“the“member“value“is“part“of“the“key“value,Ž¡by–?ýdetermining“which“key“values“will“compare“equal“to“any“member.ŽŸ8äïhtml:ï html:¦ïhtml:ï html:Ÿ$3ÅSet‘™™beha£×viorŽŸÜ÷ïhtml:ï html:Ÿ ÜI‘0Ã-–ff(BOOL)“add:“anObject;ޤ i‘0-–ff(BOOL)“add:“anObject“setIndex:“anIndex;Ž¡‘0-–ffreplace:“anObject;ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹)) “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýБ/ºâÃ@endޤ ºâ¾The–?ýadd:› úmessage“adds“a“new“member“to“a“set.˜It“returns“true“if“member“added“matched“theŽ¡ºâkey–?ýof“any“member“already“contained“in“the“Set.‘ úWhether“or“not“the“member“was“actually“addedŽ¡ºâto–?ýthe“collection“or“not“depends“on“the“setting“of“DupOption.Žºâ©8äïhtml:ï html:Ÿ Ç‘0The–?ýadd:setIndex:‘ úmessage“adds“a“new“member“to“a“set“just“like“add:,“but“also“hasŽ¡‘0a–?ýside“effect“of“setting“the“position“of“the“index“passed“as“the“setIndex:‘ úargumentŽ¡‘0to–?ýthe“member“which“was“just“added.‘ úIf“an“index“positioned“to“the“new“member“is“neededŽ¡‘0anyway,–?ýsetting“the“index“in“the“same“operation“avoids“repeating“a“search“for“theŽ¡‘0position–?ýat“which“the“member“key“belongs.ަïhtml:ï html:Ÿ Ç‘0The–?ýreplace:‘ úmessage“replaces“a“member“stored“at“a“given“key“with“another“memberŽ¡‘0value–?ýthat“matches“the“same“key.‘ úThe“new“value“to“replace“the“existing“one“is“passedŽ¡‘0as–?ýthe“argument.– úreplace:“returns–?ýthe“member“value“that“was“replaced,“or“nil“ifŽ¡‘0the–?ýcollection“contained“no“member“with“a“matching“key.ަïhtml:ï html:ŸÇ‘0„¤ŽŽŸ ïhtml:ï html:¡‘0ÂMarcus–?ýG.“Daniels“ïhtml:ï html:‘¼rïhtml:ï html:Ž¡‘0(mailto:mgd@santafe.edu)ަïhtml:ï html:Ÿ Ç‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹*˜l “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:Ÿ žâÀNameŽŸªóïhtml:ï html:Ÿ!ÅOrder½«edSet–™™{“set“of“members“in“an“exterȽnally“assigned“linear“sequenceŽŸ ‘ýïhtml:ï html:Ÿ Ú‘0¾(..‘ úThis–?ýtype“is“currently“implemented“only“using“the“low-level“option“of“an“internalޤ ‘0member–?ýslot,“and“the“messages“for“that“option“do“not“match“the“documentation“in“KeyedCollection.Ž¡‘0If–?ýyou“need“one“of“these“objects,“then“either“use“a“List“or“wait“for“some“other“implementation.)ŽŸ8äïhtml:ï html:ŸÇ‘0„¤ŽŽ©G®ïhtml:ï html:Ÿ¼jÀSynopsisŽŸ âcïhtml:ï html:Ÿ{Ò‘0Ã//Ž¡‘0//–ffOrderedSet“--“set“of“members“in“an“externally“assigned“linear“sequenceŽ¡‘0//Ž¡‘0@deftype–ffOrderedSet“@endŽŸ‘0„¤ŽŽ¦ïhtml:ï html:Ÿ¼jÀDescriptionŽŸ^5¾An–?ýOrderedSet“is“a“totally“ordered“collection“of“members“in“which“every“member“also“has“a“distinctŽ¡identity–?ýas“defined“by“comparison“against“a“key“value.ŽŸ —ïhtml:ï html:Ÿffïhtml:ï html:ŸÊÅInherited‘™™beha£×viorŽŸÜ÷ïhtml:ï html:Ÿ Æà‘0Ã@deftype–ffOrderedSet“Ž¡¾The–?ýsequence“of“members“of“an“OrderedSet“is“established“using“the“same“messages“that“maintainŽ¡member–?ýsequence“in“a“List.‘ úAn“OrderedSet“supports“customization“and“access“by“key“as“definedŽ¡by–?ýSet“and“KeyedCollection.‘ úThe“union“of“messages“from“all“these“sources“defines“the“totalŽ¡interface–?ýof“an“OrderedSet.‘ úMembers“with“duplicate“keys,“however,“are“not“valid“for“an“OrderedSet.Ž¡Each–?ýmember“must“have“a“unique“position“within“the“member“sequenceŽ©8äïhtml:ï html:ŸÇ‘0„¤ŽŽŸ ïhtml:ï html:¡‘0ÂMarcus–?ýG.“Daniels“ïhtml:ï html:‘¼rïhtml:ï html:Ž¡‘0(mailto:mgd@santafe.edu)ަïhtml:ï html:Ÿ Ç‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹+žá “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:Ÿ žâÀNameŽŸªóïhtml:ï html:Ÿ•ÅMap–™™{“collection“of“associations“fr½«om“kÛ$ey“objects“to“member“objectsŽ©‘0„¤ŽŽŸG®ïhtml:ï html:ŸËÞÀSynopsisŽŸ âcïhtml:ï html:Ÿ‹F‘0Ã//ޤ t‘0//–ffMap“--“collection“of“associations“from“key“objects“to“member“objectsŽ¡‘0//Ž¡‘0@deftype–ffMap“CREATINGŽ¡‘0-–ff(void)“setKeyType:“aDataType;Ž¡‘0-–ff(void)“setKeySlot:“(int)byteOffset;Ž¡‘0USINGŽ¡‘0-‘0™–getKeyType;Ž¡‘0-–ff(int)“getKeySlot;Ž¡¡‘0-–ff(BOOL)“at:“aKey“insert:“anObject;Ž¡‘0-–ff(BOOL)“at:“aKey“insert:“anObject“setIndex:“anIndex;Ž¡‘0-–ffat:“aKey“replace:“anObject;Ž¡¡‘0-–ff(BOOL)“insertGroup:“aKey;Ž¡¡‘0-–ffcreateIndex:“aZone“setKey:“aKey;Ž¡‘0@endŽ¡¡‘0@deftype–ffMapIndex“-“getKey;Ž¡‘0-–ffsetKey:“aKey;Ž¡¡‘0-–ffget:“(id“*)key;Ž¡‘0-–ffnext:“(id“*)key;Ž¡‘0-–ffprev:“(id“*)key;Ž¡¡‘0-–ffreplaceKey:“aKey;Ž¡‘0endަ‘0„¤ŽŽŸG®ïhtml:ï html:ŸËÞÀDescriptionŽŸm©¾Map–?ýis“a“subtype“of“KeyedCollection“in“which“the“key“value“associated“with“each“member“is“independentޤ of–?ýthe“member“itself.‘ úWhenever“a“new“member“is“added“to“the“collection,“a“key“value“to“beŽ¡associated–?ýwith“the“member“must“be“supplied“also.‘ úA“Map“defines“a“mapping“from“key“valuesŽ¡to–?ýmember“values.ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹,§³ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:Ÿ ‘0„¤ŽŽ©ffïhtml:ï html:Ÿ³3ÅInherited‘™™beha£×viorŽŸ\¾For–?ýthe“Map“type,“key“values“are“independent“of“the“member“values“with“which“they“are“associated.ޤ Map–?ýdefines“two“additional“options“to“document“information“about“its“key“values.‘ úMap“alsoŽ¡defines–?ýits“own“messages“to“distinguish“the“key“value“from“member“value“in“any“operation“whichŽ¡involves‘?ýboth.ŽŸ£×ïhtml:ï html:Ÿïhtml:ï html:¤ k…‘0Ã@deftype–ffMap“ŽŸÉ2ïhtml:ï html:ŸPgÅCr½«eate-time‘™™optionsŽŸ ‘ýïhtml:ï html:Ÿ }_‘0ÃCREATINGŽ¡‘0-–ff(void)“setKeyType:“aDataType;Ž¡‘0-–ff(void)“setKeySlot:“(int)byteOffset;Ž¡‘0USINGŽ¡‘0-‘0™–getKeyType;Ž¡‘0-–ff(int)“getKeySlot;Ž¡¾(..None–?ýof“these“options“is“currently“implemented.)ŽŸ8äïhtml:ï html:¦ïhtml:ï html:ŸzOÅMap‘™™beha£×viorŽŸ ‘ýïhtml:ï html:Ÿ }_‘0Ã-–ff(BOOL)“at:“aKey“insert:“anObject;Ž¡‘0-–ff(BOOL)“at:“aKey“insert:“anObject“setIndex:“anIndex;Ž¡¡‘0-–ffat:“aKey“replace:“anObject;Ž¡¾at:insert:‘ úinserts–?ýan“entry“into“a“Map“containing“the“key“and“member“values“given“as“its“arguments.ޤ It–?ýreturns“true“if“the“key“was“not“previously“contained“in“the“collection.‘ úIf“the“key“wasŽ¡already–?ýpresent,“the“action“of“the“message“depends“on“the“value“in“effect“for“the“DuplicatesOption.Ž¡With–?ýdefault“options,“the“attempt“to“insert“a“duplicate“key“is“simply“rejected“and“false“isŽ¡returned.ŽŸïhtml:ï html:Ÿ k…‘0at:insert:setIndex:‘ úis–?ýsimilar“to“at:insert:,“except“that“the“index“passed“as“theŽ¡‘0final–?ýargument“is“repositioned“to“the“member“just“inserted.‘ úIf“further“operationsŽ¡‘0are–?ýrequired“on“the“entry“in“a“map“that“was“just“inserted,“an“index“provides“fasterŽ¡‘0repeated–?ýaccess“to“this“entry“than“a“message“involving“further“key“comparison,“suchŽ¡‘0as–?ýat:,“would“require.– ú(..“This–?ýmessage“is“not“currently“implemented.)Ž©8äïhtml:ï html:Ÿ 2¡‘0at:replace–?ýreplaces“an“existing“member“value“associated“with“a“key“value“by“a“newŽ¡‘0value–?ýgiven“as“its“final“argument.‘ úThe“message“returns“the“member“value“which“wasŽ¡‘0formerly–?ýassociated“with“the“key“value.‘ úThe“message“returns“nil“if“more“than“oneŽ¡‘0member–?ýis“present“with“the“same“key.ަïhtml:ï html:Ÿïhtml:ï html:Ÿ 2¡‘0Ã-–ffcreateIndex:“aZone“setKey:“aKey;ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹-® “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýкâ¾(..› úThis–?ýmessage“is“not“currently“implemented.˜It“will“eventually“give“a“fast“way“to“createŽŸG®ºâan–?ýindex“already“positioned“at“an“entry“with“a“particular“key“value.)ŽºâŸŸJïhtml:ï html:ŸÊÅMapIndex‘™™beha£×viorŽŸ ‘ýïhtml:ï html:Ÿ Ú‘0Ã-‘ffgetKey;ޤ ‘0-–ffsetKey:“aKey;Ž¡¾The–?ýgetKey“message“returns“the“key“value“associated“with“the“current“location“of“the“index.Ž¡It–?ýreturns“nil“if“the“index“is“not“currently“positioned“at“a“member.› úThe“setKey:˜messagesŽ¡repositions–?ýthe“index“to“an“entry“having“a“key“value“that“matches“its“argument.‘ úIf“there“isŽ¡more–?ýthan“one“entry“matching“this“key“value,“the“index“is“positioned“to“the“first“entry“thatŽ¡matches.ޤïhtml:ï html:¡ïhtml:ï html:¤ ‘0Ã-–ffget:“(id“*)key;Ž¡‘0-–ffnext:“(id“*)key;Ž¡‘0-–ffprev:“(id“*)key;Ž¡¾These–?ýmessages“are“similar“to“those“defined“by“the“Index“supertype,“except“that“they“combineŽ¡the–?ýreturn“of“a“member“value“with“an“output“value“for“an“associated“key“value.‘ úIn“each“case,Ž¡the–?ýkey“value“is“passed“as“an“(id“*)“output“argument.Ž©8äïhtml:ï html:Ÿïhtml:ï html:Ÿ Ç‘0Ã-–ffreplaceKey:“aKey;Ž¡¾(..‘ úThis–?ýmessage“is“not“currently“implemented.)ަïhtml:ï html:Ÿ Ç‘0replaceKey:‘ úreplaces–?ýa“key“value“with“another“key“value“that“still“compares“equalŽ¡‘0to–?ýa“key“value“already“present.‘ úIt“may“be“used“to“replace“an“allocation“of“one“object,Ž¡‘0already–?ýcontained“in“a“Map,“by“a“different“object“allocation.– úreplaceKey:“returnsŽ¡‘0nil–?ýif“no“existing“key“value“matches“its“key“value“argument;“otherwise“it“returnsŽ¡‘0the–?ýkey“value“which“was“replaced“by“its“argument.ަïhtml:ï html:ŸÇ‘0„¤ŽŽŸ ïhtml:ï html:¡‘0ÂMarcus–?ýG.“Daniels“ïhtml:ï html:‘¼rïhtml:ï html:Ž¡‘0(mailto:mgd@santafe.edu)ަïhtml:ï html:Ÿ Ç‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹.¸ñ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:Ÿ žâÀNameŽŸªóïhtml:ï html:Ÿ ¯ÅString–™™{“character“string“objectŽŸªe¾(..‘ úThis–?ýtype“will“be“more“fully“documented“when“it“is“generalized“beyond“its“current“statusŽŸ as–?ýnothing“more“than“an“object“wrapper“for“a“null-terminated“character“array.)ŽŸ Ü»ïhtml:ï html:ŸÇ‘0„¤ŽŽ©G®ïhtml:ï html:ŸÂøÀSynopsisŽŸ âcïhtml:ï html:Ÿ‚`‘0Ã//ޤ Ž‘0//–ffString“--“character“string“objectŽ¡‘0//Ž¡‘0@deftype–ffString“CREATINGŽ¡‘0+–ffcreate:“aZone“setC:“(const“char“*)cstring;Ž¡‘0SETTINGŽ¡‘0-–ff(void)“setC:“(const“char“*)cstring;Ž¡‘0USINGŽ¡‘0-–ff(const“char“*)getC;Ž¡‘0-–ff(void)“appendC:“(const“char“*)cstring;Ž¡¡‘0-–ff(int)“getCount;Ž¡‘0-–ff(int)“compare:“aString;Ž¡‘0@endŽŸ‘0„¤ŽŽ¦ïhtml:ï html:ŸÂøÀDescriptionŽŸdþThe–?ýString“object“type“packages“a“null-terminated,“C-format“character“string“into“an“object.ޤ All–?ýmemory“allocation“needed“to“hold“the“string“value“is“handled“by“the“object.‘ úThis“typeŽ¡currently–?ýdefines“only“the“most“rudimentary“operations“for“initializing“and“appending“C-formatŽ¡character–?ýstrings.‘ úThese“are“sufficient“for“its“current“limited“roles“in“places“that“needŽ¡a–?ýuniformity“between“character“strings“and“other“kinds“of“allocated“objects.ŽŸ —ïhtml:ï html:ŸÇ‘0„¤ŽŽ¤ffïhtml:ï html:ŸN<ÅInherited‘™™beha£×viorŽŸÜ÷ïhtml:ï html:Ÿ Ín‘0Ã@deftype–ffString“ŽŸ ޾...ŽŸïhtml:ï html:¡ïhtml:ï html:ŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹/Áè “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýкâÅCr½«eate-time‘™™optionsŽºâ© ‘ýïhtml:ï html:Ÿ Ú‘0ÃCREATINGޤ ‘0+–ffcreate:“aZone“setC:“(const“char“*)cstring;Ž¡‘0SETTINGŽ¡‘0-–ff(void)“setC:“(const“char“*)cstring;Ž¡¾...ŽŸïhtml:ï html:Ÿffïhtml:ï html:ŸG®ÅString‘™™beha£×viorަïhtml:ï html:Ÿ Ú‘0Ã-–ff(const“char“*)getC;Ž¡‘0-–ff(void)“appendC:“(const“char“*)cstring;Ž¡¡‘0-–ff(int)“getCount;Ž¡‘0-–ff(int)“compare:“aString;Ž¡‘0@endŽ¡¾...ŽŸïhtml:ï html:Ÿ‘0„¤ŽŽŸ ïhtml:ï html:¡‘0ÂMarcus–?ýG.“Daniels“ïhtml:ï html:‘¼rïhtml:ï html:Ž¡‘0(mailto:mgd@santafe.edu)ŽŸ8äïhtml:ï html:Ÿ Ç‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹0Ég “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:Ÿ žâÀNameŽŸªóïhtml:ï html:ŸcUÅOutputStrš½«eam–™™{“str˜eam“of“output“bytesŽŸ ¾(..‘ úThis–?ýtype“will“be“more“fully“documented“when“it“is“generalized“beyond“its“current“statusŽŸ as–?ýa“placeholder“used“only“to“direct“debuggging“output.)ŽŸ Ü»ïhtml:ï html:ŸÇ‘0„¤ŽŽ©G®ïhtml:ï html:ŸžÀSynopsisŽŸ âcïhtml:ï html:ŸÜ‘0Ã//ޤ `4‘0//–ffOutputStream“--“stream“of“output“bytesŽ¡‘0//Ž¡‘0@deftype–ffOutputStream“CREATINGŽ¡‘0+–ffcreate:“aZone“setFileStream:“(FILE“*)fileStream;Ž¡‘0-–ffsetFileStream:“(FILE“*)fileStream;Ž¡‘0USINGŽ¡‘0-–ff(FILE“*)“getFileStream;Ž¡‘0-–ff(void)“appendC:“(const“char“*)cstring;Ž¡‘0@endŽŸ‘0„¤ŽŽ¦ïhtml:ï html:ŸžÀDescriptionŽŸ¾i¾The–?ýOutputStream“type“currently“supports“only“the“writing“of“a“character“string“to“a“file.ޤ It–?ýis“a“placeholder“for“more“general“stream“types.‘ úA“stream“is“a“collection“that“supportsŽ¡only–?ýsequential“addition“of“members“(an“output“stream)“or“sequential“removal“of“members“(anŽ¡input‘?ýstream).ŽŸ —ïhtml:ï html:¤ffïhtml:ï html:ŸnþÅInherited‘™™beha£×viorŽŸÜ÷ïhtml:ï html:Ÿ '‘0Ã@deftype–ffOutputStream“Ž© `4¾...ŽŸïhtml:ï html:¡ïhtml:ï html:Ÿ§âÅCr½«eate-time‘™™optionsŽŸ ‘ýïhtml:ï html:Ÿ r‘0ÃCREATINGަ‘0-–ffsetFileStream:“(FILE“*)fileStream;ަ‘0USINGަ‘0-–ff(FILE“*)“getFileStream;ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹1Íe “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ ýкâ¾...Žºâ¤ïhtml:ï html:©ffïhtml:ï html:ŸG®ÅSpecial‘™™cr½«eate:‘vÆmessageŽŸ ‘ýïhtml:ï html:Ÿ Ú‘0Ã+–ffcreate:“aZone“setFileStream:“(FILE“*)fileStream;ŽŸ ¾...Ž¡ïhtml:ï html:¦ïhtml:ï html:ŸG®ÅOutputStr½«eam‘™™beha£×viorŽŸ ‘ýïhtml:ï html:Ÿ Ú‘0Ã-–ff(void)“appendC:“(const“char“*)cstring;ޤ ‘0@endŽ¡¾...ŽŸïhtml:ï html:Ÿ‘0„¤ŽŽŸ ïhtml:ï html:¡‘0ÂMarcus–?ýG.“Daniels“ïhtml:ï html:‘¼rïhtml:ï html:Ž¡‘0(mailto:mgd@santafe.edu)ŽŸ8äïhtml:ï html:Ÿ Ç‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹2Ô‘ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:ŸIy½Collections–/Library:‘m™Subclassing“Refer |enceŽŸq'‘0„¤ŽŽ© ïhtml:ï html:¤ ‘0¾Until–?ýthe“collections“library“has“been“fully“implemented,“subclassing“conventionsŽ¡‘0from–?ýcollections“implementation“classes“are“still“in“flux.‘ úIn“general,“these“classesŽ¡‘0will–?ýbe“among“the“most“complex“uses“of“multiple“classes“selected“to“implement“an“independentŽ¡‘0object–?ýtype.‘ ú(See“ïhtml:ï html:library“definition“conventionsïhtml:ï html:Ž¡‘0(../defobj/library.html)Ž¡‘0for–?ýa“summary“of“the“distinction“between“types“and“classes.)‘ úNew“methods“are“beingŽ¡‘0developed–?ýto“simplify“subclassing“from“such“implementations.‘ úIn“the“meantime,“ifŽ¡‘0you–?ýneed“to“use“to“a“collection“within“the“implementation“of“your“own“class,“justŽ¡‘0put–?ýan“instance“variable“in“your“class“and“put“the“collection“in“that,“and“pass“throughŽ¡‘0the–?ýmessages“of“the“collection“you“want“to“have“available“on“your“class“to“this“variable.Ž¡‘0In–?ýmany“if“not“most“cases,“this“is“better“design“anyway,“because“you“control“all“useŽ¡‘0of–?ýthe“underlying“structure.ŽŸ8äïhtml:ï html:ŸÇ‘0„¤ŽŽ¦ïhtml:ï html:¡‘0ÂMarcus–?ýG.“Daniels“ïhtml:ï html:‘¼rïhtml:ï html:Ž¡‘0(mailto:mgd@santafe.edu)ŽŸ8äïhtml:ï html:Ÿ Ç‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹3ØK “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:ŸIy½Collections–/Library:‘m™Interface“Design“NotesŽŸq'‘0„¤ŽŽŸG®ïhtml:ï html:Ÿ¼jÀDesign‘QëObjecti•ÓÅv“esŽŸ^5¾A–?ýcollections“library“is“one“of“the“most“important“foundation“services“for“object-orientedޤ programming.‘ úMost–?ýobject-oriented“systems“provide“at“least“the“start“of“a“general-purposeŽ¡collections–?ýlibrary.‘ úThe“GNUSTEP,“project,“for“example,“provides“the“libobject“library“(currentlyŽ¡in–?ýalpha“test“at“ftp://alpha.prep.ai.mit.edu/)“which“includes“a“collections“library“along“withŽ¡other–?ýservices“intended“to“parallel“those“of“the“OpenStep“framework“developed“by“Next.ŽŸ —ïhtml:ï html:© Ç‘0Swarm–?ýhas“implemented“its“own“collection“library“to“meet“the“specialized“needs“ofŽ¡‘0its–?ýagent“simulation“framework.‘ úMajor“objectives“of“the“Swarm“collections“libraryŽ¡‘0include–?ýthe“following:ޤ8äïhtml:ï html:¦‘0...– ú(..“more–?ýto“come,“obviously)Ž¡ïhtml:ï html:ŸÇ‘0„¤ŽŽŸ ïhtml:ï html:¤ ‘0ÂMarcus–?ýG.“Daniels“ïhtml:ï html:‘¼rïhtml:ï html:Ž¡‘0(mailto:mgd@santafe.edu)ŽŸ8äïhtml:ï html:¦‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒ‹4Þ÷ “ºâ ýxºâïcolor push Blackïhtml:ï html:ŸüfdŽŽŽ’Ôï color popŽŽ ^ºâ ýÆïhtml:ï html:ŸIy½Collections–/Library:‘m™Implementation“NotesŽŸq'‘0„¤ŽŽ¤ ïhtml:ï html:© ‘0¾(This–?ýsection“of“documentation“is“not“yet“available.)ŽŸ8äïhtml:ï html:ŸÇ‘0„¤ŽŽ¡ïhtml:ï html:¦‘0ÂMarcus–?ýG.“Daniels“ïhtml:ï html:‘¼rïhtml:ï html:ަ‘0(mailto:mgd@santafe.edu)ŽŸ8äïhtml:ï html:Ÿ Ç‘0¾Last‘?ýmodified:‘ ú1998-01-08ŽŽŸ*ºâïcolor push Black’Ôï color popŽŽŒøäヒÀ;è—T~Óºâ 4ó©±Ê cmsy9óÓߌ˜ff ptmb7tó0ˆÛ pcrr7tóßê