Class PSquarePercentile.Marker

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable
    Enclosing class:
    PSquarePercentile

    private static class PSquarePercentile.Marker
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Cloneable
    The class modeling the attributes of the marker of the P-square algorithm
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Serial Version ID
        See Also:
        Constant Field Values
      • index

        private int index
        The marker index which is just a serial number for the marker in the marker array of 5+1.
      • intMarkerPosition

        private double intMarkerPosition
        The integral marker position. Refer to the variable n in the original works.
      • desiredMarkerPosition

        private double desiredMarkerPosition
        Desired marker position. Refer to the variable n' in the original works.
      • markerHeight

        private double markerHeight
        Marker height or the quantile. Refer to the variable q in the original works.
      • desiredMarkerIncrement

        private double desiredMarkerIncrement
        Desired marker increment. Refer to the variable dn' in the original works.
      • next

        private transient PSquarePercentile.Marker next
        Next and previous markers for easy linked navigation in loops. this is not serialized as they can be rebuilt during deserialization.
    • Constructor Detail

      • Marker

        private Marker()
        Default constructor
      • Marker

        private Marker​(double heightOfMarker,
                       double makerPositionDesired,
                       double markerPositionIncrement,
                       double markerPositionNumber)
        Constructor of the marker with parameters
        Parameters:
        heightOfMarker - represent the quantile value
        makerPositionDesired - represent the desired marker position
        markerPositionIncrement - represent increments for position
        markerPositionNumber - represent the position number of marker
    • Method Detail

      • previous

        private PSquarePercentile.Marker previous​(PSquarePercentile.Marker previousMarker)
        Sets the previous marker.
        Parameters:
        previousMarker - the previous marker to the current marker in the array of markers
        Returns:
        this instance
      • index

        private PSquarePercentile.Marker index​(int indexOfMarker)
        Sets the index of the marker.
        Parameters:
        indexOfMarker - the array index of the marker in marker array
        Returns:
        this instance
      • updateDesiredPosition

        private void updateDesiredPosition()
        Update desired Position with increment.
      • incrementPosition

        private void incrementPosition​(int d)
        Increment Position by d.
        Parameters:
        d - a delta value to increment
      • difference

        private double difference()
        Difference between desired and actual position
        Returns:
        difference between desired and actual position
      • estimate

        private double estimate()
        Estimate the quantile for the current marker.
        Returns:
        estimated quantile
      • isEstimateBad

        private boolean isEstimateBad​(double[] y,
                                      double yD)
        Check if parabolic/nonlinear estimate is bad by checking if the ordinate found is beyond the y[0] and y[2].
        Parameters:
        y - the array to get the bounds
        yD - the estimate
        Returns:
        true if yD is a bad estimate
      • equals

        public boolean equals​(java.lang.Object o)
        This equals method checks for marker attributes and as well checks if navigation pointers (next and previous) are the same between this and passed in object
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - Other object
        Returns:
        true if this equals passed in other object o
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • readObject

        private void readObject​(java.io.ObjectInputStream anInstream)
                         throws java.lang.ClassNotFoundException,
                                java.io.IOException
        Read Object to deserialize.
        Parameters:
        anInstream - Stream Object data
        Throws:
        java.io.IOException - thrown for IO Errors
        java.lang.ClassNotFoundException - thrown for class not being found
      • clone

        public java.lang.Object clone()
        Clone this instance.
        Overrides:
        clone in class java.lang.Object
        Returns:
        cloned marker
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object