ComparableNodeInterface

Interface that defines the comparison of nodes

Table of Contents

Methods

compareTo()  : int
Compare Node against another one

Methods

compareTo()

Compare Node against another one

public compareTo(TreeNode $other) : int

Returns: 1 if the current node is greater than the $other, -1 if $other is greater than the current node and 0 if the nodes are equal

Example

if ($this->sortValue > $other->sortValue) {
return 1;
} elseif ($this->sortValue < $other->sortValue) {
return -1;
} else {
return 0;
}
Parameters
$other : TreeNode
Return values
int

see description


        
On this page

Search results