Class ApproximationLine

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable

    public class ApproximationLine
    extends java.lang.Object
    implements java.io.Externalizable
    Provides an approximation for knn-distances line consisting of incline m, axes intercept t and a start value for k.
    Since:
    0.1
    Author:
    Elke Achtert
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int k_0
      The start value for k.
      private double m
      The incline.
      private static long serialVersionUID  
      private double t
      The axes intercept.
    • Constructor Summary

      Constructors 
      Constructor Description
      ApproximationLine()
      Empty constructor for serialization purposes.
      ApproximationLine​(int k_0, double m, double t)
      Provides an approximation for knn-distances line consisting of incline m, axes intercept t and a start value for k.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)
      Returns true if this object is the same as the o argument; false otherwise.
      double getApproximatedKnnDistance​(int k)
      Returns the approximated knn-distance at the specified k.
      int getK_0()
      Returns the start value for k.
      double getM()
      Returns the incline.
      double getT()
      Returns the axes intercept.
      double getValueAt​(int k)
      Returns the function value of the approximation line at the specified k.
      int hashCode()
      Returns a hash code value for this object
      void readExternal​(java.io.ObjectInput in)
      The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.
      java.lang.String toString()
      Returns a string representation of the object.
      void writeExternal​(java.io.ObjectOutput out)
      The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • m

        private double m
        The incline.
      • t

        private double t
        The axes intercept.
      • k_0

        private int k_0
        The start value for k.
    • Constructor Detail

      • ApproximationLine

        public ApproximationLine()
        Empty constructor for serialization purposes.
      • ApproximationLine

        public ApproximationLine​(int k_0,
                                 double m,
                                 double t)
        Provides an approximation for knn-distances line consisting of incline m, axes intercept t and a start value for k.
        Parameters:
        k_0 - the start value for k
        m - the incline
        t - the axes intercept
    • Method Detail

      • getM

        public double getM()
        Returns the incline.
        Returns:
        the incline
      • getT

        public double getT()
        Returns the axes intercept.
        Returns:
        the axes intercept
      • getK_0

        public int getK_0()
        Returns the start value for k.
        Returns:
        the start value for k
      • getValueAt

        public double getValueAt​(int k)
        Returns the function value of the approximation line at the specified k.
        Parameters:
        k - the value for which the function value of the approximation line should be returned
        Returns:
        the function value of the approximation line at the specified k
      • getApproximatedKnnDistance

        public double getApproximatedKnnDistance​(int k)
        Returns the approximated knn-distance at the specified k.
        Parameters:
        k - the value for which the knn-distance should be returned
        Returns:
        the approximated knn-distance at the specified k
      • writeExternal

        public void writeExternal​(java.io.ObjectOutput out)
                           throws java.io.IOException
        The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
        Specified by:
        writeExternal in interface java.io.Externalizable
        Parameters:
        out - the stream to write the object to
        Throws:
        java.io.IOException
      • readExternal

        public void readExternal​(java.io.ObjectInput in)
                          throws java.io.IOException
        The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.
        Specified by:
        readExternal in interface java.io.Externalizable
        Parameters:
        in - the stream to read data from in order to restore the object
        Throws:
        java.io.IOException
      • equals

        public boolean equals​(java.lang.Object o)
        Returns true if this object is the same as the o argument; false otherwise.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - the reference object with which to compare.
        Returns:
        true if this object is the same as the obj argument; false otherwise.
      • hashCode

        public int hashCode()
        Returns a hash code value for this object
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hash code value for this object.
      • toString

        public java.lang.String toString()
        Returns a string representation of the object.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of the object.