Show / Hide Table of Contents

    Class DoubleToleranceComparer

    Double comparer that treats all numbers within tolerance as the same. This comparer doesn't use hash code as it is impossible to create a hashing algorithm that consistently returns identical values for any two points within tolerance of each other. Note that any item that is not within tolerance of other key is set as a new key. This mean that keys are not always whole number in the middle of a range.

    Inheritance
    System.Object
    DoubleToleranceComparer
    Implements
    System.Collections.Generic.IEqualityComparer<System.Double>
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Elements.Search
    Assembly: Hypar.Elements.dll
    Syntax
    public class DoubleToleranceComparer : IEqualityComparer<double>

    Constructors

    DoubleToleranceComparer(Double)

    Create a comparer.

    Declaration
    public DoubleToleranceComparer(double tolerance)
    Parameters
    Type Name Description
    System.Double tolerance

    Number tolerance

    Methods

    Equals(Double, Double)

    Check if two numbers are the same within tolerance

    Declaration
    public bool Equals(double x, double y)
    Parameters
    Type Name Description
    System.Double x

    First number

    System.Double y

    Second number

    Returns
    Type Description
    System.Boolean

    True if x should be treated the same as y.

    GetHashCode(Double)

    Hash code for number. Always returns 0.

    Declaration
    public int GetHashCode(double obj)
    Parameters
    Type Name Description
    System.Double obj

    number

    Returns
    Type Description
    System.Int32

    0

    Implements

    System.Collections.Generic.IEqualityComparer<T>