📄 swarm.simtools.qsort.protocol.html
字号:
<HTML><HEAD><TITLE>QSort</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="Simtools Library"HREF="swarm.simtools.sgml.reference.html"><LINKREL="PREVIOUS"TITLE="OutFile [Deprecated]"HREF="swarm.simtools.outfile.protocol.html"><LINKREL="NEXT"TITLE="UName"HREF="swarm.simtools.uname.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.simtools.outfile.protocol.html">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Reference VI. Simtools Library</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="swarm.simtools.uname.protocol.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><H1><ANAME="SWARM.SIMTOOLS.QSORT.PROTOCOL">QSort</A></H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN16279"></A><H2>Name</H2>QSort -- A class to sort a collection.</DIV><DIVCLASS="REFSECT1"><ANAME="AEN16282"></A><H2>Description</H2><P> QSort is simply a "wrapper" for the C native "qsort" function, as applied to a Swarm collection. The values will appear in ascending order by default. Reversing the order of a collection can be made by calling reverseOrderOf. All these methods modify the underlying collection, so any indexes should always be regenerated. </P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN16285"></A><H2>Protocols adopted by QSort</H2><P> <AHREF="swarm.objectbase.swarmobject.protocol.html">SwarmObject</A> <AHREF="swarm.defobj.creatable.protocol.html">CREATABLE</A></P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN16290"></A><H2>Methods</H2><DIVCLASS="REFSECT2"><ANAME="AEN16292"></A><H3>Phase: Using</H3><P></P><UL><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.SIMTOOLS.QSORT.METHOD.PU.M73"></A><P></P>+ (void)<BCLASS="FUNCPROTOTYPE">sortObjectsIn:</B> <VARCLASS="PDPARAM">aCollection</VAR> <BR> The sortObjectsIn: method will sort the objects in the collection with the "compare' function for the object. If the objects don't provide a compare function, sortObjectsIn uses the default from the defobj library. <P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.SIMTOOLS.QSORT.METHOD.PU.M74"></A><P></P>+ (void)<BCLASS="FUNCPROTOTYPE">sortObjectsIn:</B> <VARCLASS="PDPARAM">aCollection</VAR> <BCLASS="FUNCPROTOTYPE">using:</B> (SEL)<VARCLASS="PDPARAM">aSelector</VAR> <BR> The sortObjectsIn:using: method will sort the objects in the collection with the specified comparison function for the object.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.SIMTOOLS.QSORT.METHOD.PU.M71"></A><P></P>+ (void)<BCLASS="FUNCPROTOTYPE">sortNumbersIn:</B> <VARCLASS="PDPARAM">aCollection</VAR> <BR> The sortNumbersIn: method performs integer comparisons on the objects in the collection using the default "compare" function. The default assumes that the numbers should be monotonically increasing.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.SIMTOOLS.QSORT.METHOD.PU.M72"></A><P></P>+ (void)<BCLASS="FUNCPROTOTYPE">sortNumbersIn:</B> <VARCLASS="PDPARAM">aCollection</VAR> <BCLASS="FUNCPROTOTYPE">using:</B> (int (*) (const void*, const void*))<VARCLASS="PDPARAM">comp_fun</VAR> <BR> The sortNumbersIn:using: method performs integer comparisons on the objects in the collection with the specified comparison function for the object.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.SIMTOOLS.QSORT.METHOD.PU.M64"></A><P></P>+ (void)<BCLASS="FUNCPROTOTYPE">reverseOrderOf:</B> <VARCLASS="PDPARAM">aCollection</VAR> <BR> The reverseOrderOf: method reverses the current order of a collection. To make a "reversed" sort, simply call one of the appropriate "sort" methods on a collection then call this function on the same collection.<P></P></DIV></LI></UL></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.simtools.outfile.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.simtools.uname.protocol.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">OutFile [Deprecated]</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="swarm.simtools.sgml.reference.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">UName</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -