📄 swarm.collections.comparefunction.protocol.html
字号:
<HTML><HEAD><TITLE>CompareFunction</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.53"><LINKREL="HOME"TITLE="Documentation Set for Swarm 2.1.1"HREF="set.html"><LINKREL="UP"TITLE="Collections Library"HREF="swarm.collections.sgml.reference.html"><LINKREL="PREVIOUS"TITLE="Collection"HREF="swarm.collections.collection.protocol.html"><LINKREL="NEXT"TITLE="DefaultMember"HREF="swarm.collections.defaultmember.protocol.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">Documentation Set for Swarm 2.1.1</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="swarm.collections.collection.protocol.html">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Reference II. Collections Library</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="swarm.collections.defaultmember.protocol.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><H1><ANAME="SWARM.COLLECTIONS.COMPAREFUNCTION.PROTOCOL">CompareFunction</A></H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN6526"></A><H2>Name</H2>CompareFunction -- Interface for defining the compare function to use when comparing to members in a collection.</DIV><DIVCLASS="REFSECT1"><ANAME="AEN6529"></A><H2>Description</H2><P> 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.</P><P> The compare function is called repeatedly by the collection to compare two key values. The function should return zero if the key values are equal, -1 for the first key argument less than the second, and +1 for the first greater than the second. If a keyed collection is not sorted, either -1 or +1 may be returned for unequal keys, regardless of whether one might be taken as greater or less than the other.</P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN6533"></A><H2>Protocols adopted by CompareFunction</H2><P>None</P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN6536"></A><H2>Methods</H2><DIVCLASS="REFSECT2"><ANAME="AEN6538"></A><H3>Phase: Creating</H3><P></P><UL><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.COLLECTIONS.COMPAREFUNCTION.METHOD.PC.M712"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setCompareFunction:</B> (compare_t)<VARCLASS="PDPARAM">aFunction</VAR> <BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.COLLECTIONS.COMPAREFUNCTION.METHOD.PC.M711"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setCompareCStrings</B><BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.COLLECTIONS.COMPAREFUNCTION.METHOD.PC.M713"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setCompareIDs</B><BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.COLLECTIONS.COMPAREFUNCTION.METHOD.PC.M714"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setCompareIntegers</B><BR><P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.COLLECTIONS.COMPAREFUNCTION.METHOD.PC.M715"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setCompareUnsignedIntegers</B><BR><P></P></DIV></LI></UL></DIV><DIVCLASS="REFSECT2"><ANAME="AEN6582"></A><H3>Phase: Using</H3><P></P><UL><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.COLLECTIONS.COMPAREFUNCTION.METHOD.PU.M337"></A><P></P>- (compare_t)<BCLASS="FUNCPROTOTYPE">getCompareFunction</B><BR><P></P></DIV></LI></UL></DIV></DIV><DIVCLASS="REFSECT1"><ANAME="AEN6593"></A><H2>Typedefs</H2><P></P><UL><LI><P>compare_t<PRE>int (*) (id, id)</PRE></P></LI></UL></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.collection.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.defaultmember.protocol.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Collection</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="swarm.collections.sgml.reference.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">DefaultMember</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -