Package adams.data.binning
Class BinnableGroup<T>
- java.lang.Object
-
- adams.data.binning.BinnableGroup<T>
-
- All Implemented Interfaces:
Mergeable<BinnableGroup<T>>,IDHandler,Serializable,Comparable<BinnableGroup<T>>
public class BinnableGroup<T> extends Object implements Serializable, IDHandler, Comparable<BinnableGroup<T>>, Mergeable<BinnableGroup<T>>
Container for multiple Binnable items that fall in the same group ID.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BinnableGroup(String id)Initializes an empty group with the ID.BinnableGroup(String id, List<Binnable<T>> members)Initializes the group with the ID and members.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Binnable<T> member)Adds the member.voidaddAll(Collection<Binnable<T>> members)Adds all the members.intcompareTo(BinnableGroup<T> o)Returns the comparison of the two group IDsbooleanequals(Object obj)Checks wether the object is a BinnableGroup with the same ID.List<Binnable<T>>get()Returns the list of members.StringgetID()Returns the ID.voidmergeWith(BinnableGroup<T> other)Just adds all the members of the other group.intsize()Returns the number of members.StringtoString()Returns a short description of the group.StringtoString(int decimals)Returns a short description of the group.
-
-
-
Constructor Detail
-
BinnableGroup
public BinnableGroup(String id)
Initializes an empty group with the ID.- Parameters:
id- the ID to use
-
-
Method Detail
-
addAll
public void addAll(Collection<Binnable<T>> members)
Adds all the members.- Parameters:
members- the members to add
-
size
public int size()
Returns the number of members.- Returns:
- the member count
-
getID
public String getID()
Returns the ID.
-
mergeWith
public void mergeWith(BinnableGroup<T> other)
Just adds all the members of the other group. Ignores the ID.
-
compareTo
public int compareTo(BinnableGroup<T> o)
Returns the comparison of the two group IDs- Specified by:
compareToin interfaceComparable<T>- Parameters:
o- the other group to compare with- Returns:
- the result of the string comparison of the IDs
-
equals
public boolean equals(Object obj)
Checks wether the object is a BinnableGroup with the same ID.
-
toString
public String toString()
Returns a short description of the group.
-
toString
public String toString(int decimals)
Returns a short description of the group.- Parameters:
decimals- the number of decimals to use for printing, -1 for no limit- Returns:
- the description
-
-