Class Sample

  • All Implemented Interfaces:
    IMetaData, ISample

    public class Sample
    extends java.lang.Object
    implements ISample, IMetaData
    An (x,y) sample data with error.

    The error values are absolute, positive numbers. For example, a Sample with Y=5, negative Y error 1 and positive Y error 2 represents a number of 5 that could also be anywhere in 4 .. 7. The errors are not percentages. The 'negative' error is actually a positive number.

    Note: Only the x/y value is used in equals()! Error ranges and info texts are ignored when determining equality with another Sample.

    • Constructor Summary

      Constructors 
      Constructor Description
      Sample​(double xdata, double ydata)
      Initialize with x/y value
      Sample​(double xValue, double yValue, double yPlusError, double yMinusError, double xPlusError, double xMinusError)
      Initialize with value and error range
      Sample​(double xValue, double yValue, double yPlusError, double yMinusError, double xPlusError, double xMinusError, java.lang.String info)
      Initialize with value, error ranges and info text
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.lang.Object getData()
      Get meta data stored with the object.
      java.lang.Object getData​(java.lang.String key)
      Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
      java.util.Map<java.lang.String,​java.lang.Object> getDataCollection()
      Get the available meta data entries as a immutable #Map.
      java.lang.String getInfo()  
      double getXMinusError()  
      double getXPlusError()  
      double getXValue()  
      double getYMinusError()  
      double getYPlusError()  
      double getYValue()  
      int hashCode()  
      void setData​(java.lang.Object metaData)
      Store meta data with the object.
      void setData​(java.lang.String key, java.lang.Object data)
      Store meta data mapped with the key.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • xValue

        private final double xValue
      • yValue

        private final double yValue
      • xPlusError

        private final double xPlusError
      • yPlusError

        private final double yPlusError
      • xMinusError

        private final double xMinusError
      • yMinusError

        private final double yMinusError
      • info

        private final java.lang.String info
      • fMetaData

        private java.lang.Object fMetaData
      • fMetaDataMap

        private java.util.Map<java.lang.String,​java.lang.Object> fMetaDataMap
    • Constructor Detail

      • Sample

        public Sample​(double xdata,
                      double ydata)
        Initialize with x/y value
        Parameters:
        xdata -
        ydata -
      • Sample

        public Sample​(double xValue,
                      double yValue,
                      double yPlusError,
                      double yMinusError,
                      double xPlusError,
                      double xMinusError)
        Initialize with value and error range
        Parameters:
        xValue -
        yValue -
        yPlusError -
        yMinusError -
        xPlusError -
        xMinusError -
      • Sample

        public Sample​(double xValue,
                      double yValue,
                      double yPlusError,
                      double yMinusError,
                      double xPlusError,
                      double xMinusError,
                      java.lang.String info)
        Initialize with value, error ranges and info text
        Parameters:
        xValue -
        yValue -
        yPlusError -
        yMinusError -
        xPlusError -
        xMinusError -
        info -
    • Method Detail

      • getXValue

        public double getXValue()
        Specified by:
        getXValue in interface ISample
        Returns:
        X value
      • getYValue

        public double getYValue()
        Specified by:
        getYValue in interface ISample
        Returns:
        Y value
      • getXMinusError

        public double getXMinusError()
        Specified by:
        getXMinusError in interface ISample
        Returns:
        Negative X error.
      • getXPlusError

        public double getXPlusError()
        Specified by:
        getXPlusError in interface ISample
        Returns:
        Positive X error.
      • getYMinusError

        public double getYMinusError()
        Specified by:
        getYMinusError in interface ISample
        Returns:
        Negative Y error.
      • getYPlusError

        public double getYPlusError()
        Specified by:
        getYPlusError in interface ISample
        Returns:
        Positive Y error.
      • getInfo

        public java.lang.String getInfo()
        Specified by:
        getInfo in interface ISample
        Returns:
        Sample info text.
      • hashCode

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        String representation, mostly for debugging
      • setData

        public void setData​(java.lang.Object metaData)
        Description copied from interface: IMetaData
        Store meta data with the object.
        Specified by:
        setData in interface IMetaData
        Parameters:
        metaData - data to be stored with the object
      • getData

        public java.lang.Object getData()
        Description copied from interface: IMetaData
        Get meta data stored with the object.
        Specified by:
        getData in interface IMetaData
        Returns:
        containing meta data or null
      • getData

        public java.lang.Object getData​(java.lang.String key)
        Description copied from interface: IMetaData
        Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
        Specified by:
        getData in interface IMetaData
        Parameters:
        key - key associated with the data
        Returns:
        associated meta data or null
      • setData

        public void setData​(java.lang.String key,
                            java.lang.Object data)
        Description copied from interface: IMetaData
        Store meta data mapped with the key. To remove an existing entry, set the data to null.
        Specified by:
        setData in interface IMetaData
        Parameters:
        key - key to be associated with the data or null to remove
        data - data to be stored with the object
      • getDataCollection

        public java.util.Map<java.lang.String,​java.lang.Object> getDataCollection()
        Description copied from interface: IMetaData
        Get the available meta data entries as a immutable #Map.
        Specified by:
        getDataCollection in interface IMetaData
        Returns:
        immutable map of the stored data