Struct NodeDistance<TNode>
Node-distance pair.
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Mars.Common.Collections
Assembly: Mars.Common.dll
Syntax
[Serializable]
public struct NodeDistance<TNode> : IComparable<NodeDistance<TNode>>, IEquatable<NodeDistance<TNode>>
Type Parameters
Name | Description |
---|---|
TNode | The class type for the nodes of the tree. |
Constructors
| Improve this Doc View SourceNodeDistance(TNode, Double)
Creates a new NodeDistance<TNode>.
Declaration
public NodeDistance(TNode node, double distance)
Parameters
Type | Name | Description |
---|---|---|
TNode | node | The node value. |
System.Double | distance | The distance value. |
Properties
| Improve this Doc View SourceDistance
Gets the distance of the node from the query point.
Declaration
public readonly double Distance { get; }
Property Value
Type | Description |
---|---|
System.Double |
Node
Gets the node in this pair.
Declaration
public readonly TNode Node { get; }
Property Value
Type | Description |
---|---|
TNode |
Methods
| Improve this Doc View SourceCompareTo(NodeDistance<TNode>)
Compares this instance to another node, returning an integer
indicating whether this instance has a distance that is less
than, equal to, or greater than the other node's distance.
Declaration
public int CompareTo(NodeDistance<TNode> other)
Parameters
Type | Name | Description |
---|---|---|
NodeDistance<TNode> | other |
Returns
Type | Description |
---|---|
System.Int32 |
CompareTo(Object)
Compares this instance to another node, returning an integer
indicating whether this instance has a distance that is less
than, equal to, or greater than the other node's distance.
Declaration
public int CompareTo(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Int32 |
Equals(NodeDistance<TNode>)
Determines whether the specified NodeDistance<TNode>
is equal to this instance.
Declaration
public bool Equals(NodeDistance<TNode> other)
Parameters
Type | Name | Description |
---|---|---|
NodeDistance<TNode> | other | The NodeDistance<TNode> to compare with this instance. |
Returns
Type | Description |
---|---|
System.Boolean |
true if the specified NodeDistance<TNode> is
equal to this instance; otherwise, false .
|
Equals(Object)
Determines whether the specified System.Object
is equal to this instance.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The System.Object to compare with this instance. |
Returns
Type | Description |
---|---|
System.Boolean |
true if the specified System.Object is
equal to this instance; otherwise, false .
|
Overrides
System.ValueType.Equals(System.Object)
|
Improve this Doc
View Source
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
System.ValueType.GetHashCode()
|
Improve this Doc
View Source
ToString()
Returns a System.String that represents this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
Overrides
System.ValueType.ToString()
Operators
| Improve this Doc View SourceEquality(NodeDistance<TNode>, NodeDistance<TNode>)
Implements the equality operator.
Declaration
public static bool operator ==(NodeDistance<TNode> a, NodeDistance<TNode> b)
Parameters
Type | Name | Description |
---|---|---|
NodeDistance<TNode> | a | |
NodeDistance<TNode> | b |
Returns
Type | Description |
---|---|
System.Boolean |
GreaterThan(NodeDistance<TNode>, NodeDistance<TNode>)
Implements the greater than operator.
Declaration
public static bool operator>(NodeDistance<TNode> a, NodeDistance<TNode> b)
Parameters
Type | Name | Description |
---|---|---|
NodeDistance<TNode> | a | |
NodeDistance<TNode> | b |
Returns
Type | Description |
---|---|
System.Boolean |
Inequality(NodeDistance<TNode>, NodeDistance<TNode>)
Implements the inequality operator.
Declaration
public static bool operator !=(NodeDistance<TNode> a, NodeDistance<TNode> b)
Parameters
Type | Name | Description |
---|---|---|
NodeDistance<TNode> | a | |
NodeDistance<TNode> | b |
Returns
Type | Description |
---|---|
System.Boolean |
LessThan(NodeDistance<TNode>, NodeDistance<TNode>)
Implements the lesser than operator.
Declaration
public static bool operator <(NodeDistance<TNode> a, NodeDistance<TNode> b)
Parameters
Type | Name | Description |
---|---|---|
NodeDistance<TNode> | a | |
NodeDistance<TNode> | b |
Returns
Type | Description |
---|---|
System.Boolean |
Implements
System.IComparable<T>
System.IEquatable<T>