Package adams.data.sequence
Class XYSequence
- java.lang.Object
-
- adams.data.container.AbstractDataContainer<XYSequencePoint>
-
- adams.data.sequence.XYSequence
-
- All Implemented Interfaces:
CloneHandler,Mergeable<DataContainer>,UniqueIDHandler,DataContainer<XYSequencePoint>,DataContainerWithSpreadSheetSupport<XYSequencePoint>,IDHandler,MutableIDHandler,SpreadSheetSupporter,Serializable,Comparable,Iterable<XYSequencePoint>,Collection<XYSequencePoint>
- Direct Known Subclasses:
SequencePlotSequence
public class XYSequence extends AbstractDataContainer<XYSequencePoint> implements DataContainerWithSpreadSheetSupport<XYSequencePoint>
A sequence storing 2-dimensional points.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringFILE_EXTENSIONthe file extension.protected DataPointComparatorm_Comparatorthe default comparator.protected XYSequencePointComparator.Comparisonm_Comparisonthe comparison to use.protected gnu.trove.map.hash.TDoubleObjectHashMap<String>m_MappingXstring representations for the X values.protected gnu.trove.map.hash.TDoubleObjectHashMap<String>m_MappingYstring representations for the Y values.protected XYSequencePointm_MaxXthe maximum X point.protected XYSequencePointm_MaxYthe maximum Y point.protected XYSequencePointm_MinXthe minimum X point.protected XYSequencePointm_MinYthe minimum Y point.-
Fields inherited from class adams.data.container.AbstractDataContainer
m_ID, m_Points, m_UUID
-
-
Constructor Summary
Constructors Constructor Description XYSequence()Initializes the sequence.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassign(XYSequence other)Obtains the stored variables from the other data point, but not the actual data points.XYSequencePointfind(double x)Returns the SequencePoint with the exact number, null if not found.XYSequencePointfindClosest(double x)Returns the SequencePoint with a number closest to the one provided.DataPointComparator<XYSequencePoint>getComparator()Returns the comparator in use.XYSequencePointComparator.ComparisongetComparison()Returns the type of comparison currently in use.List<String>getLabelsX()Returns all the labels for X.List<String>getLabelsY()Returns all the labels for Y.gnu.trove.map.hash.TDoubleObjectHashMap<String>getMappingsX()Returns all the mappings for X.gnu.trove.map.hash.TDoubleObjectHashMap<String>getMappingsY()Returns all the mappings for Y.StringgetMappingX(double key)Returns the X mapping associated with the key.StringgetMappingY(double key)Returns the Y mapping associated with the key.XYSequencePointgetMaxX()Returns point with the maximum X.XYSequencePointgetMaxY()Returns point with the maximum Y.XYSequencePointgetMinX()Returns point with the minimum X.XYSequencePointgetMinY()Returns point with the minimum Y.booleanhasMappingX()Checks whether there are string mappings for the X values available.booleanhasMappingY()Checks whether there are string mappings for the Y values available.protected voidinvalidateMinMax()Invalidates the min/max points.protected booleanmodifiedListener(boolean modified)Method that gets notified about changes in the collection of data points.DataPointComparator<XYSequencePoint>newComparator()Returns the comparator in use.XYSequencePointnewPoint()Returns a new instance of a sequence point.doubleputMappingX(String s)Adds a X mapping for the given string.doubleputMappingY(String s)Adds a Y mapping for the given string.StringremoveMappingX(double x)Removes a X mapping for the given value.StringremoveMappingY(double y)Removes a Y mapping for the given value.voidsetComparison(XYSequencePointComparator.Comparison value)Sets the type of comparison to use.SpreadSheettoSpreadSheet()Returns the content as spreadsheet.SpreadSheettoSpreadSheet(List<XYSequencePoint> points)Returns the list of points as spreadsheet.protected voidvalidateMinMax()Determines the min/max points.-
Methods inherited from class adams.data.container.AbstractDataContainer
add, addAll, assign, clear, compareTo, compareToData, compareToHeader, contains, containsAll, ensureCapacity, equals, equalsData, equalsHeader, getClone, getHeader, getID, getUniqueID, hashCode, isEmpty, iterator, mergeWith, newInstance, remove, removeAll, retainAll, setID, size, toArray, toArray, toList, toList, toString, toTreeSet, toTreeSet, trimToSize
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface adams.data.container.DataContainer
assign, compareToData, compareToHeader, equalsData, equalsHeader, getClone, getHeader, toList, toList, toTreeSet, toTreeSet
-
Methods inherited from interface adams.data.id.MutableIDHandler
setID
-
Methods inherited from interface adams.core.UniqueIDHandler
getUniqueID
-
-
-
-
Field Detail
-
FILE_EXTENSION
public static final String FILE_EXTENSION
the file extension.- See Also:
- Constant Field Values
-
m_Comparator
protected DataPointComparator m_Comparator
the default comparator.
-
m_Comparison
protected XYSequencePointComparator.Comparison m_Comparison
the comparison to use.
-
m_MinX
protected XYSequencePoint m_MinX
the minimum X point.
-
m_MaxX
protected XYSequencePoint m_MaxX
the maximum X point.
-
m_MinY
protected XYSequencePoint m_MinY
the minimum Y point.
-
m_MaxY
protected XYSequencePoint m_MaxY
the maximum Y point.
-
m_MappingX
protected gnu.trove.map.hash.TDoubleObjectHashMap<String> m_MappingX
string representations for the X values.
-
m_MappingY
protected gnu.trove.map.hash.TDoubleObjectHashMap<String> m_MappingY
string representations for the Y values.
-
-
Method Detail
-
assign
public void assign(XYSequence other)
Obtains the stored variables from the other data point, but not the actual data points.- Parameters:
other- the data point to get the values from
-
hasMappingX
public boolean hasMappingX()
Checks whether there are string mappings for the X values available.- Returns:
- true if X mappings available
-
putMappingX
public double putMappingX(String s)
Adds a X mapping for the given string.- Parameters:
s- the string to add the mapping for- Returns:
- the generated mapping
-
removeMappingX
public String removeMappingX(double x)
Removes a X mapping for the given value.- Parameters:
x- the mapping to remove- Returns:
- the previous mapping string, if any
-
getMappingX
public String getMappingX(double key)
Returns the X mapping associated with the key.- Parameters:
key- the mapping to look up- Returns:
- the mapping
-
getMappingsX
public gnu.trove.map.hash.TDoubleObjectHashMap<String> getMappingsX()
Returns all the mappings for X.- Returns:
- the mappings
-
hasMappingY
public boolean hasMappingY()
Checks whether there are string mappings for the Y values available.- Returns:
- true if Y mappings available
-
putMappingY
public double putMappingY(String s)
Adds a Y mapping for the given string.- Parameters:
s- the string to add the mapping for- Returns:
- the generated mapping
-
removeMappingY
public String removeMappingY(double y)
Removes a Y mapping for the given value.- Parameters:
y- the mapping to remove- Returns:
- the previous mapping string, if any
-
getMappingY
public String getMappingY(double key)
Returns the Y mapping associated with the key.- Parameters:
key- the mapping to look up- Returns:
- the mapping
-
getMappingsY
public gnu.trove.map.hash.TDoubleObjectHashMap<String> getMappingsY()
Returns all the mappings for Y.- Returns:
- the mappings
-
setComparison
public void setComparison(XYSequencePointComparator.Comparison value)
Sets the type of comparison to use.- Parameters:
value- the type of comparison to use
-
getComparison
public XYSequencePointComparator.Comparison getComparison()
Returns the type of comparison currently in use.- Returns:
- the type of comparison
-
newComparator
public DataPointComparator<XYSequencePoint> newComparator()
Returns the comparator in use.- Specified by:
newComparatorin interfaceDataContainer<XYSequencePoint>- Returns:
- the comparator to use
-
getComparator
public DataPointComparator<XYSequencePoint> getComparator()
Returns the comparator in use.- Specified by:
getComparatorin interfaceDataContainer<XYSequencePoint>- Returns:
- the comparator in use
-
newPoint
public XYSequencePoint newPoint()
Returns a new instance of a sequence point.- Specified by:
newPointin interfaceDataContainer<XYSequencePoint>- Returns:
- the new sequence point
-
modifiedListener
protected boolean modifiedListener(boolean modified)
Method that gets notified about changes in the collection of data points. Invalidates the min/max and passes the modified state through.- Overrides:
modifiedListenerin classAbstractDataContainer<XYSequencePoint>- Parameters:
modified- whether the action modified the collection- Returns:
- the same as the input
-
invalidateMinMax
protected void invalidateMinMax()
Invalidates the min/max points.
-
validateMinMax
protected void validateMinMax()
Determines the min/max points.
-
getMinX
public XYSequencePoint getMinX()
Returns point with the minimum X.- Returns:
- the point
-
getMaxX
public XYSequencePoint getMaxX()
Returns point with the maximum X.- Returns:
- the point
-
getMinY
public XYSequencePoint getMinY()
Returns point with the minimum Y.- Returns:
- the point
-
getMaxY
public XYSequencePoint getMaxY()
Returns point with the maximum Y.- Returns:
- the point
-
find
public XYSequencePoint find(double x)
Returns the SequencePoint with the exact number, null if not found.- Parameters:
x- the number to look for- Returns:
- the SequencePoint or null if not found
-
findClosest
public XYSequencePoint findClosest(double x)
Returns the SequencePoint with a number closest to the one provided.- Parameters:
x- the number to look for- Returns:
- the SpectrumPoint
-
toSpreadSheet
public SpreadSheet toSpreadSheet(List<XYSequencePoint> points)
Returns the list of points as spreadsheet.- Specified by:
toSpreadSheetin interfaceDataContainerWithSpreadSheetSupport<XYSequencePoint>- Parameters:
points- the points to convert- Returns:
- the content
-
toSpreadSheet
public SpreadSheet toSpreadSheet()
Returns the content as spreadsheet.- Specified by:
toSpreadSheetin interfaceSpreadSheetSupporter- Returns:
- the content
-
-