php-doc-en/reference/spl/splheap/compare.xml
2011-08-16 11:38:58 +00:00

87 lines
2.5 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!-- $Revision$ -->
<refentry xml:id="splheap.compare" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>SplHeap::compare</refname>
<refpurpose>Compare elements in order to place them correctly in the heap while sifting up.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>abstract</modifier> <type>int</type><methodname>SplHeap::compare</methodname>
<methodparam><type>mixed</type><parameter>value1</parameter></methodparam>
<methodparam><type>mixed</type><parameter>value2</parameter></methodparam>
</methodsynopsis>
<para>
Compare <parameter>value1</parameter> with <parameter>value2</parameter>.
</para>
<warning>
<para>
Throwing exceptions in <methodname>SplHeap::compare</methodname> can
corrupt the Heap and place it in a blocked state. You can unblock it by
calling <methodname>SplHeap::recoverFromCorruption</methodname>.
However, some elements might not be placed correctly and it may hence
break the heap-property.
</para>
</warning>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>value1</parameter></term>
<listitem>
<para>
The value of the first node being compared.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value2</parameter></term>
<listitem>
<para>
The value of the second node being compared.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Result of the comparison, positive integer if <parameter>value1</parameter> is greater than <parameter>value2</parameter>, 0 if they are equal, negative integer otherwise.
</para>
<note>
<para>
Having multiple elements with the same value in a Heap is not recommended. They will end up in an arbitrary relative position.
</para>
</note>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->