Class ObservationPlotModel
java.lang.Object
org.jfree.data.general.AbstractDataset
org.jfree.data.general.AbstractSeriesDataset
org.jfree.data.xy.AbstractXYDataset
org.jfree.data.xy.AbstractIntervalXYDataset
org.aavso.tools.vstar.ui.model.plot.ObservationPlotModel
- All Implemented Interfaces:
ObjectInputValidation,Serializable,Cloneable,EventListener,ISeriesInfoProvider,org.jfree.data.general.Dataset,org.jfree.data.general.SeriesChangeListener,org.jfree.data.general.SeriesDataset,org.jfree.data.xy.IntervalXYDataset,org.jfree.data.xy.XYDataset
- Direct Known Subclasses:
ObservationAndMeanPlotModel
public abstract class ObservationPlotModel
extends org.jfree.data.xy.AbstractIntervalXYDataset
implements ISeriesInfoProvider
This is the abstract base class for models that represent a series of valid
variable star observations, e.g. for different bands (or from different
sources). In practice, this class is only intended to be used as a the base
class for ObservationAndMeanPlot. The two could be merged with the latter
assuming the current class's name.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanIs at least one visual band observation present?protected ICoordSourceCoordinate and error source.protected Listener<DiscrepantObservationMessage>Discrepant observation listener.protected Listener<ExcludedObservationMessage>Excluded observation listener.protected intprotected SeriesTypeWhat was the most recently singly selected series (e.g.protected intprotected intprotected static final intprotected Comparator<ValidObservation>An observation comparator (e.g.protected intprotected intA unique next series number for this model.protected Map<Integer,List<ValidObservation>> A mapping from series number to a list of observations where each such list is a data series.protected Map<Integer,SeriesType> A mapping from series number to source type.A collection of series to be joined visually.protected Map<SeriesType,Boolean> A mapping from series numbers to whether or not they visible.protected Map<SeriesType,Integer> A mapping from source type to series number. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedObservationPlotModel(Map<SeriesType, List<ValidObservation>> obsSourceListMap, ICoordSource coordSrc, Comparator<ValidObservation> obComparator, Map<SeriesType, Boolean> seriesVisibilityMap) Constructor (for phase plots). -
Method Summary
Modifier and TypeMethodDescriptionintaddObservationSeries(SeriesType type, List<ValidObservation> obs) Add an observation series.voidaddObservationsToSeries(List<ValidObservation> obs, SeriesType series) Add a list of observations to a series list, creating the series first if necessary.voidaddObservationToSeries(ValidObservation ob, SeriesType series) Add a single observation to a series list, creating the series first if necessary.booleanchangeSeriesVisibility(int seriesNum, boolean visibility) Attempt to change the specified series' visibility.protected abstract Listener<FilteredObservationMessage>Listen for a filtered observation and add/remove its observations from the relevant collections.protected abstract Listener<ModelSelectionMessage>Listen for a model series selection and add/remove its fit and residual observations from the relevant collections.protected Listener<SeriesCreationMessage>org.jfree.data.DomainOrdergetEndX(int series, int item) getEndY(int series, int item) intgetItemCount(int series) doublegetMagAsYCoord(int series, int item) Return the magnitude as the Y coordinate.doublegetMagError(int series, int item) Return the error associated with the magnitude.protected intgetObservations(SeriesType type) Get the observations for the specified series.intgetSeriesKey(int series) Get a set of series keys.Which series' elements should be joined visually (e.g.getStartX(int series, int item) getStartY(int series, int item) getValidObservation(int series, int item) Given a series and item number, return the corresponding observation.What is the current set of visible series?getX(int series, int item) getY(int series, int item) booleanisSeriesVisibleByDefault(SeriesType series) Should the specified series be visible by default?booleanRemove all observations from the specified series, but not the series itself.booleanremoveObservationFromSeries(ValidObservation ob, SeriesType series) Remove a single observation from a series list.booleanremoveObservationsFromSeries(List<ValidObservation> obs, SeriesType series) Remove a single observation from a series list.intreplaceObservationSeries(SeriesType type, List<ValidObservation> obs) Replace an existing seriesbooleanseriesExists(SeriesType type) Does the specified series type exist, i.e.voidMethods inherited from class org.jfree.data.xy.AbstractIntervalXYDataset
getEndXValue, getEndYValue, getStartXValue, getStartYValueMethods inherited from class org.jfree.data.xy.AbstractXYDataset
getXValue, getYValueMethods inherited from class org.jfree.data.general.AbstractSeriesDataset
indexOf, seriesChangedMethods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, canEqual, clone, equals, fireDatasetChanged, getGroup, getNotify, hashCode, hasListener, notifyListeners, removeChangeListener, setGroup, setNotify, validateObjectMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jfree.data.general.Dataset
addChangeListener, getGroup, removeChangeListener, setGroupMethods inherited from interface org.jfree.data.general.SeriesDataset
indexOfMethods inherited from interface org.jfree.data.xy.XYDataset
getXValue, getYValue
-
Field Details
-
NO_SERIES
protected static final int NO_SERIES- See Also:
-
coordSrc
Coordinate and error source. -
obComparator
An observation comparator (e.g. to provide an ordering over time: JD or phase). -
seriesNum
protected int seriesNumA unique next series number for this model. -
seriesNumToObSrcListMap
A mapping from series number to a list of observations where each such list is a data series. -
seriesNumToSrcTypeMap
A mapping from series number to source type. -
srcTypeToSeriesNumMap
A mapping from source type to series number. -
seriesVisibilityMap
A mapping from series numbers to whether or not they visible. -
atLeastOneVisualBandPresent
protected boolean atLeastOneVisualBandPresentIs at least one visual band observation present? -
seriesToBeJoinedVisually
A collection of series to be joined visually. -
discrepantListener
Discrepant observation listener. -
excludedListener
Excluded observation listener. -
lastSinglySelectedSeries
What was the most recently singly selected series (e.g. via a dialog). -
modelSeriesNum
protected int modelSeriesNum -
modelFunctionSeriesNum
protected int modelFunctionSeriesNum -
residualsSeriesNum
protected int residualsSeriesNum -
filterSeriesNum
protected int filterSeriesNum
-
-
Constructor Details
-
ObservationPlotModel
protected ObservationPlotModel(Map<SeriesType, List<ValidObservation>> obsSourceListMap, ICoordSource coordSrc, Comparator<ValidObservation> obComparator, Map<SeriesType, Boolean> seriesVisibilityMap) Constructor (for phase plots). We add named observation source lists to unique series numbers, and if the visibility map is non-null, potentially change the set of visible series.- Parameters:
obsSourceListMap- A mapping from source series to lists of observation sources.coordSrc- A coordinate and error source.obComparator- A valid observation comparator (e.g. by JD or phase).seriesVisibilityMap- A mapping from series number to visibility status.
-
-
Method Details
-
addObservationSeries
Add an observation series.- Parameters:
type- The series type to be associated with the series.obs- A series (list) of observations, in particular, magnitude and Julian Day.- Returns:
- The number of the series added.
-
addObservationToSeries
Add a single observation to a series list, creating the series first if necessary.- Parameters:
ob- A valid observation.series- A series.
-
addObservationsToSeries
Add a list of observations to a series list, creating the series first if necessary.- Parameters:
obs- The list of observations to be added.series- The series to which to add the list.
-
replaceObservationSeries
Replace an existing series- Parameters:
type- The series type to be associated with the series.obs- A series (list) of observations, in particular, magnitude and Julian Day.- Returns:
- The number of the series replaced.
-
removeObservationFromSeries
Remove a single observation from a series list.- Parameters:
ob- A valid observation.series- A series.- Returns:
- Whether or not the observation was removed.
-
removeObservationsFromSeries
Remove a single observation from a series list.- Parameters:
obs- The list of valid observations to be removed.series- The series from which the list is to be removed.- Returns:
- Whether or not the observations were removed.
-
removeAllObservationFromSeries
Remove all observations from the specified series, but not the series itself.- Parameters:
type- The series type.- Returns:
- Whether or not the series observations were removed.
-
changeSeriesVisibility
public boolean changeSeriesVisibility(int seriesNum, boolean visibility) Attempt to change the specified series' visibility.- Parameters:
seriesNum- The series number of interest.visibility- Whether this series should be visible.- Returns:
- Whether or not the visibility of the object changed.
-
getVisibleSeries
Description copied from interface:ISeriesInfoProviderWhat is the current set of visible series?- Specified by:
getVisibleSeriesin interfaceISeriesInfoProvider- Returns:
- The current set of visible series?
- See Also:
-
getSeriesCount
public int getSeriesCount()- Specified by:
getSeriesCountin interfaceISeriesInfoProvider- Specified by:
getSeriesCountin interfaceorg.jfree.data.general.SeriesDataset- Specified by:
getSeriesCountin classorg.jfree.data.general.AbstractSeriesDataset- See Also:
-
getSeriesKey
- Specified by:
getSeriesKeyin interfaceorg.jfree.data.general.SeriesDataset- Specified by:
getSeriesKeyin classorg.jfree.data.general.AbstractSeriesDataset- See Also:
-
AbstractSeriesDataset.getSeriesKey(int)
-
getSeriesKeys
Description copied from interface:ISeriesInfoProviderGet a set of series keys.- Specified by:
getSeriesKeysin interfaceISeriesInfoProvider- Returns:
- The set of series keys.
- See Also:
-
seriesExists
Description copied from interface:ISeriesInfoProviderDoes the specified series type exist, i.e. has it been added to the plot?- Specified by:
seriesExistsin interfaceISeriesInfoProvider- Parameters:
type- The series type in question.- Returns:
- Whether the series has been added to the plot.
- See Also:
-
getObservations
Description copied from interface:ISeriesInfoProviderGet the observations for the specified series.- Specified by:
getObservationsin interfaceISeriesInfoProvider- Parameters:
type- The series type for which observations are requested.- Returns:
- The observation list for the specified series; may be null.
-
getItemCount
public int getItemCount(int series) - Specified by:
getItemCountin interfaceorg.jfree.data.xy.XYDataset- Returns:
- The number of observations (items) in the requested series.
- See Also:
-
XYDataset.getItemCount(int)
-
getX
- Specified by:
getXin interfaceorg.jfree.data.xy.XYDataset- See Also:
-
XYDataset.getX(int, int)
-
getY
- Specified by:
getYin interfaceorg.jfree.data.xy.XYDataset- See Also:
-
XYDataset.getY(int, int)
-
getDomainOrder
public org.jfree.data.DomainOrder getDomainOrder()- Specified by:
getDomainOrderin interfaceorg.jfree.data.xy.XYDataset- Overrides:
getDomainOrderin classorg.jfree.data.xy.AbstractXYDataset- See Also:
-
AbstractXYDataset.getDomainOrder()
-
getSeriesWhoseElementsShouldBeJoinedVisually
Which series' elements should be joined visually (e.g. with lines)?- Returns:
- A collection of series numbers for series whose elements should be joined visually.
-
getStartX
- Specified by:
getStartXin interfaceorg.jfree.data.xy.IntervalXYDataset
-
getEndX
- Specified by:
getEndXin interfaceorg.jfree.data.xy.IntervalXYDataset
-
getStartY
- Specified by:
getStartYin interfaceorg.jfree.data.xy.IntervalXYDataset
-
getEndY
- Specified by:
getEndYin interfaceorg.jfree.data.xy.IntervalXYDataset
-
getNextSeriesNum
protected int getNextSeriesNum() -
getMagAsYCoord
public double getMagAsYCoord(int series, int item) Return the magnitude as the Y coordinate.- Parameters:
series- The series number.item- The item number within the series.- Returns:
- The magnitude value.
-
getMagError
public double getMagError(int series, int item) Return the error associated with the magnitude. We skip the series and item legality check to improve performance on the assumption that this has been checked already when calling getMagAsYCoord(). So this is a precondition of calling the current function.- Parameters:
series- The series number.item- The item number within the series.- Returns:
- The error value associated with the mean.
-
getValidObservation
Given a series and item number, return the corresponding observation.- Parameters:
series- The series number.item- The item within the series.- Returns:
- The valid observation.
- Throws:
IllegalArgumentException- if series or item are out of range.
-
getSeriesNumToObSrcListMap
- Returns:
- the seriesNumToObSrcListMap
-
getSrcTypeToSeriesNumMap
- Returns:
- the srcTypeToSeriesNumMap
-
getSeriesNumToSrcTypeMap
- Returns:
- the seriesNumToSrcTypeMap
-
getSeriesVisibilityMap
- Returns:
- the seriesVisibilityMap
-
setLastSinglySelectedSeries
- Parameters:
lastSinglySelectedSeries- the lastSinglySelectedSeries to set
-
getLastSinglySelectedSeries
- Returns:
- the lastSinglySelectedSeries
-
isSeriesVisibleByDefault
Should the specified series be visible by default?- Parameters:
series- The series name.- Returns:
- Whether or not the series should be visible by default.
-
createSeriesCreationListener
-
createModelSelectionListener
Listen for a model series selection and add/remove its fit and residual observations from the relevant collections. We need to re-calculate the means series if any of the model observations' series type is the same as the mean source series type. -
createFilteredObservationListener
Listen for a filtered observation and add/remove its observations from the relevant collections. We need to re-calculate the means series if any of the model observations' series type is the same as the mean source series type.
-