/// <summary> /// Returns an Integer indicating the Ordering of this Node compared to another Node. /// </summary> /// <param name="other">Node to test against.</param> /// <returns></returns> public override int CompareTo(INode other) { if (ReferenceEquals(this, other)) { return(0); } if (other == null) { // Blank Nodes are considered greater than nulls // So we return a 1 to indicate we're greater than it return(1); } else if (other.NodeType == NodeType.Variable) { // Blank Nodes are considered greater than Variables return(1); } else if (other.NodeType == NodeType.Blank) { // Order Blank Nodes lexically by their ID return(ComparisonHelper.CompareBlankNodes(this, (IBlankNode)other)); } else { // Anything else is greater than a Blank Node // So we return a -1 to indicate we are less than the other Node return(-1); } }
/// <summary> /// Returns an Integer indicating the Ordering of this Node compared to another Node. /// </summary> /// <param name="other">Node to test against.</param> /// <returns></returns> public override int CompareTo(IBlankNode other) { if (ReferenceEquals(this, other)) { return(0); } if (other == null) { // We are always greater than nulls return(1); } else { // Order lexically on ID return(ComparisonHelper.CompareBlankNodes(this, other)); } }