/// <summary> /// Implementation of CompareTo for Graph Literals /// </summary> /// <param name="other">Node to compare to</param> /// <returns></returns> /// <remarks> /// Graph Literal Nodes are greater than Blank Nodes, Uri Nodes, Literal Nodes and Nulls /// </remarks> public override int CompareTo(INode other) { if (ReferenceEquals(this, other)) { return(0); } if (other == null) { //Everything is greater than a null //Return a 1 to indicate this return(1); } else if (other.NodeType != NodeType.GraphLiteral) { //Graph Literal Nodes are greater than Blank, Variable, Uri and Literal Nodes //Return a 1 to indicate this return(1); } else if (other.NodeType == NodeType.GraphLiteral) { return(ComparisonHelper.CompareGraphLiterals(this, (IGraphLiteralNode)other)); } else { //Anything else is Greater Than us 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(IGraphLiteralNode other) { return(ComparisonHelper.CompareGraphLiterals(this, (IGraphLiteralNode)other)); }