Class Bin<T>

    • Field Detail

      • m_Index

        protected int m_Index
        the bin index.
      • m_Start

        protected double m_Start
        the start of the bin.
      • m_End

        protected double m_End
        the end of the bin.
      • m_Objects

        protected List<Binnable<T>> m_Objects
        the binnable objects that belong to this bin.
    • Constructor Detail

      • Bin

        public Bin​(int index,
                   double start,
                   double end,
                   BaseInterval interval)
        Initializes the bin.
        Parameters:
        index - the index of the bin
        start - the starting point
        interval - the complete range
    • Method Detail

      • getIndex

        public int getIndex()
        Returns the index of the bin.
        Returns:
        the index
      • getStart

        public double getStart()
        Returns the start of the bin.
        Returns:
        the start
      • getEnd

        public double getEnd()
        Returns the end of the bin.
        Returns:
        the end
      • getInterval

        public BaseInterval getInterval()
        Returns the complete interval of the bin.
        Returns:
        the interval
      • fits

        public boolean fits​(Binnable<T> object)
        Checks whether the object belongs to this bin.
        Parameters:
        object - the object to check
        Returns:
        true if it fits
      • add

        public void add​(Binnable<T> object)
        Adds the object to the list of objects belong to this bin.
        Parameters:
        object - the object to add
      • addAll

        public void addAll​(Collection<Binnable<T>> objects)
        Adds the objects to the list of objects belong to this bin.
        Parameters:
        objects - the objects to add
      • get

        public List<Binnable<T>> get()
        Returns the list of objects in the bin.
        Returns:
        the objects
      • size

        public int size()
        Returns the number of stored objects.
        Returns:
        the number of objects
        See Also:
        get()
      • compareTo

        public int compareTo​(Bin<T> o)
        Uses the index of the bin for comparison.
        Specified by:
        compareTo in interface Comparable<T>
        Parameters:
        o - the other bin
        Returns:
        less than, equal to, or larger based on the index comparison
      • equals

        public boolean equals​(Object obj)
        Returns true if the other object is a bin with the same index.
        Overrides:
        equals in class Object
        Parameters:
        obj - the other bin
        Returns:
        true if the same index
      • getClone

        public Bin<T> getClone()
        Returns a clone of the object.
        Specified by:
        getClone in interface CloneHandler<T>
        Returns:
        the clone
      • mergeWith

        public void mergeWith​(Bin<T> other)
        Merges its own data with the one provided by the specified object.
        Specified by:
        mergeWith in interface Mergeable<T>
        Parameters:
        other - the object to merge with
      • toString

        public String toString()
        Returns a short description of the bin.
        Overrides:
        toString in class Object
        Returns:
        the description
      • toString

        public String toString​(int decimals)
        Returns a short description of the bin.
        Parameters:
        decimals - the number of decimals to use in the output, -1 for no limit
        Returns:
        the description