📄 swarm.collections.index.protocol.html
字号:
CLASS="FUNCSYNOPSIS"><ANAME="SWARM.COLLECTIONS.INDEX.METHOD.PU.M791"></A><P></P>- (void)<BCLASS="FUNCPROTOTYPE">setLoc:</B> (id <Symbol>)<VARCLASS="PDPARAM">locSymbol</VAR> <BR> The setLoc: message may be used to reset the current location of an index to either Start or End. It may be used to reprocess a collection using an existing index after some other location has already been reached. It may also be used to position an index at the end of all members prior to traversing members in reverse order using prev.<BR> Besides Start and End, setLoc: accepts the special argument values of BetweenAfter and BetweenBefore, which are also defined symbols. These argument values are only valid if the index is positioned at a current member. They reposition the index to the special location between the current member and its immediately following or preceding member.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.COLLECTIONS.INDEX.METHOD.PU.M443"></A><P></P>- (int)<BCLASS="FUNCPROTOTYPE">getOffset</B><BR> 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.<BR> An offset is always available from an index if its current position has been reached by repeated operations from an initial Start or End position, and there has been no other modification to the underlying collection. Some forms of direct member access operations supported by some index types, however, may result in an integer offset not being available. These restrictions are noted with the individual index type.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.COLLECTIONS.INDEX.METHOD.PU.M815"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setOffset:</B> (unsigned)<VARCLASS="PDPARAM">offset</VAR> <BR> Using the setOffset: message, an index may be positioned directly to a member using the offset of the member within its enumeration sequence. The speed of this operation 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.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.COLLECTIONS.INDEX.METHOD.PU.M198"></A><P></P>- (int)<BCLASS="FUNCPROTOTYPE">compare:</B> <VARCLASS="PDPARAM">anIndex</VAR> <BR> 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.<P></P></DIV></LI></UL></DIV></DIV><DIVCLASS="REFSECT1"><ANAME="AEN6929"></A><H2>Macros</H2><P></P><UL><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.COLLECTIONS.INDEX.MACRO.INDEXENDP"></A><P></P><P><CODE><BCLASS="FSFUNC">INDEXENDP</B>(<VARCLASS="PDPARAM">obj</VAR>)</CODE></P><BR> Predicate to test if index is at the end.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.COLLECTIONS.INDEX.MACRO.INDEXSTARTP"></A><P></P><P><CODE><BCLASS="FSFUNC">INDEXSTARTP</B>(<VARCLASS="PDPARAM">obj</VAR>)</CODE></P><BR> Predicate to test if index is at the start.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.COLLECTIONS.INDEX.MACRO.REMOVEDP"></A><P></P><P><CODE><BCLASS="FSFUNC">REMOVEDP</B>(<VARCLASS="PDPARAM">obj</VAR>)</CODE></P><BR> Predicate to test if item at index has been removed.<P></P></DIV></LI><LI><P>UndefinedOffset</P></LI></UL></DIV><DIVCLASS="REFSECT1"><ANAME="AEN6961"></A><H2>Globals</H2><P></P><DIVCLASS="VARIABLELIST"><DL><DT><ANAME="SWARM.COLLECTIONS.INDEX.GLOBAL.START">id <Symbol> Start </A></DT><DD><P> values for index location</P></DD><DT><ANAME="SWARM.COLLECTIONS.INDEX.GLOBAL.END">id <Symbol> End </A></DT><DD><P> values for index location</P></DD><DT><ANAME="SWARM.COLLECTIONS.INDEX.GLOBAL.BETWEEN">id <Symbol> Between </A></DT><DD><P> values for index location</P></DD><DT><ANAME="SWARM.COLLECTIONS.INDEX.GLOBAL.REMOVED">id <Symbol> Removed </A></DT><DD><P> values for index location</P></DD><DT><ANAME="SWARM.COLLECTIONS.INDEX.GLOBAL.MEMBER">id <Symbol> Member </A></DT><DD><P> values for index location</P></DD><DT><ANAME="SWARM.COLLECTIONS.INDEX.GLOBAL.OFFSETOUTOFRANGE">id <Error> OffsetOutOfRange </A></DT><DD><P> error types for collections</P></DD><DT><ANAME="SWARM.COLLECTIONS.INDEX.GLOBAL.NOMEMBERS">id <Error> NoMembers </A></DT><DD><P> error types for collections</P></DD><DT><ANAME="SWARM.COLLECTIONS.INDEX.GLOBAL.ALREADYATEND">id <Error> AlreadyAtEnd </A></DT><DD><P> error types for collections</P></DD><DT><ANAME="SWARM.COLLECTIONS.INDEX.GLOBAL.ALREADYATSTART">id <Error> AlreadyAtStart </A></DT><DD><P> error types for collections</P></DD><DT><ANAME="SWARM.COLLECTIONS.INDEX.GLOBAL.INVALIDINDEXLOC">id <Error> InvalidIndexLoc </A></DT><DD><P> error types for collections</P></DD><DT><ANAME="SWARM.COLLECTIONS.INDEX.GLOBAL.INVALIDLOCSYMBOL">id <Error> InvalidLocSymbol </A></DT><DD><P> error types for collections</P></DD></DL></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="swarm.collections.foreachkey.protocol.html">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="set.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="swarm.collections.inputstream.protocol.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">ForEachKey</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="swarm.collections.sgml.reference.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">InputStream</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -