org.hackystat.projectbrowser.page.trajectory.datapanel
Class TrajectoryChartDataModel

java.lang.Object
  extended by org.hackystat.projectbrowser.page.trajectory.datapanel.TrajectoryChartDataModel
All Implemented Interfaces:
java.io.Serializable, Processable

public class TrajectoryChartDataModel
extends java.lang.Object
implements java.io.Serializable, Processable

Data model to hold state of the telemetry chart.

Author:
Shaoxuan Zhang, Pavel Senin
See Also:
Serialized Form

Constructor Summary
TrajectoryChartDataModel()
           
 
Method Summary
 void addStreamToChart(SelectableTrajectoryStream stream, double minimum, double maximum, java.lang.Integer maxStreamLength, GoogleChart googleChart)
          Add the given stream to the google chart.
 void addStreamToDTWChart(SelectableTrajectoryStream stream, java.util.List<java.lang.Double> list, double minimum, double maximum, java.lang.Integer maxStreamLength, GoogleChart googleChart)
          Add the given stream to the google chart.
 java.util.List<java.lang.Double> addStreamToNormalizedChart(SelectableTrajectoryStream stream, double minimum, double maximum, java.lang.Integer maxStreamLength, GoogleChart googleChart)
          Add the given stream to the google chart and return the normalized data.
 void cancelDataLoading()
          Cancel the data loading process.
 void changeSelectionForAll(boolean flag)
          Change all selected flags of streams to the given flag.
 java.util.List<java.lang.String> getDateList(java.util.List<org.hackystat.telemetry.service.resource.chart.jaxb.TelemetryPoint> points)
          Return the date list within the list of points.
 java.lang.String getDTWChart()
           
 java.lang.String getDTWChartURL(java.util.List<SelectableTrajectoryStream> streams)
          Return the google chart url that present normalized streams.
 java.lang.String getDTWStatistics()
          Get the DTW statistics.
 int getHeight()
           
 java.util.List<java.lang.String> getMarkersList()
          Return the date list inside this model.
 java.lang.String getNormalizedTSChart()
           
 java.lang.String getNormalizedTSChartURL(java.util.List<SelectableTrajectoryStream> streams)
          Return the google chart url that present normalized streams.
 java.lang.String getParameterAsString()
          Return the comma-separated list of parameters in String.
 java.lang.String getProcessingMessage()
           
 java.lang.String getProject1EndDateString()
          Returns the end date in yyyy-MM-dd format.
 java.lang.String getProject1StartDateString()
          Returns the start date in yyyy-MM-dd format.
 java.lang.String getProject2EndDateString()
          Returns the end date in yyyy-MM-dd format.
 java.lang.String getProject2StartDateString()
          Returns the start date in yyyy-MM-dd format.
 java.lang.String getSelectedChart()
           
 java.util.List<ProjectRecord> getSelectedProjects()
           
 java.lang.String getStream1Statistics()
          Return statistics for the stream1.
 java.lang.String getStream2Statistics()
          Return statistics for the stream2.
 java.lang.String getTelemetryChartURL(java.util.List<SelectableTrajectoryStream> streams)
          Return the google chart url that present all streams within the given list.
 java.lang.String getTelemetryName()
           
 java.util.List<SelectableTrajectoryStream> getTrajectoryStream(org.hackystat.sensorbase.resource.projects.jaxb.Project project)
          Return the list of TelemetryStream associated with the given project.
 java.lang.String getWarningMessage()
           
 int getWidth()
           
 boolean isChartEmpty()
           
 boolean isComplete()
           
 boolean isDTWChartEmpty()
           
 boolean isEmpty()
          Returns true if this model does not contain any data.
 boolean isInProcess()
           
 boolean isNormalizedTSChartEmpty()
           
 void loadData()
          Load data from Hackystat service.
 void setHeight(int height)
           
 void setModel(ProjectRecord selectedProject1, ProjectRecord selectedProject2, java.lang.String telemetryName, java.lang.String granularity, java.util.List<org.apache.wicket.model.IModel> parameters)
          Set all the parameters for the current chart.
 void setWarningMessage(java.lang.String message)
          Set the paramErrorMessage.
 void setWidth(int width)
           
 boolean updateDTWChart()
          Extract the time series from the selectedChart, normalize those and chart them.
 boolean updateNormalizedTSChart()
          Extract the time series from the selectedChart, normalize those and chart them.
 boolean updateSelectedChart()
          update the selectedChart.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrajectoryChartDataModel

public TrajectoryChartDataModel()
Method Detail

setModel

public void setModel(ProjectRecord selectedProject1,
                     ProjectRecord selectedProject2,
                     java.lang.String telemetryName,
                     java.lang.String granularity,
                     java.util.List<org.apache.wicket.model.IModel> parameters)
Set all the parameters for the current chart.

Parameters:
selectedProject1 - The trajectory project1.
selectedProject2 - The trajectory project2.
telemetryName - The selected telemetry stream name.
granularity - The seleceted granularity.
parameters - Additional telemetry parameters.

loadData

public void loadData()
Load data from Hackystat service.


cancelDataLoading

public void cancelDataLoading()
Cancel the data loading process.


getProject1StartDateString

public java.lang.String getProject1StartDateString()
Returns the start date in yyyy-MM-dd format.

Returns:
The date as a simple string.

getProject1EndDateString

public java.lang.String getProject1EndDateString()
Returns the end date in yyyy-MM-dd format.

Returns:
The date as a simple string.

getProject2StartDateString

public java.lang.String getProject2StartDateString()
Returns the start date in yyyy-MM-dd format.

Returns:
The date as a simple string.

getProject2EndDateString

public java.lang.String getProject2EndDateString()
Returns the end date in yyyy-MM-dd format.

Returns:
The date as a simple string.

getTelemetryName

public java.lang.String getTelemetryName()
Returns:
the telemetryName

isEmpty

public boolean isEmpty()
Returns true if this model does not contain any data.

Returns:
True if no data.

getTrajectoryStream

public java.util.List<SelectableTrajectoryStream> getTrajectoryStream(org.hackystat.sensorbase.resource.projects.jaxb.Project project)
Return the list of TelemetryStream associated with the given project.

Parameters:
project - the given project.
Returns:
the list of TelemetryStream.

getSelectedChart

public java.lang.String getSelectedChart()
Returns:
the selectedChart

isChartEmpty

public boolean isChartEmpty()
Returns:
true if the chart is empty.

getNormalizedTSChart

public java.lang.String getNormalizedTSChart()
Returns:
the selectedChart

isNormalizedTSChartEmpty

public boolean isNormalizedTSChartEmpty()
Returns:
true if the chart is empty.

getDTWChart

public java.lang.String getDTWChart()
Returns:
the selectedChart

isDTWChartEmpty

public boolean isDTWChartEmpty()
Returns:
true if the chart is empty.

updateSelectedChart

public boolean updateSelectedChart()
update the selectedChart.

Returns:
true if the chart is successfully updated.

updateNormalizedTSChart

public boolean updateNormalizedTSChart()
Extract the time series from the selectedChart, normalize those and chart them.

Returns:
true if the chart is successfully updated.

updateDTWChart

public boolean updateDTWChart()
Extract the time series from the selectedChart, normalize those and chart them.

Returns:
true if the chart is successfully updated.

getDTWStatistics

public java.lang.String getDTWStatistics()
Get the DTW statistics.

Returns:
DTW statistics.

getTelemetryChartURL

public java.lang.String getTelemetryChartURL(java.util.List<SelectableTrajectoryStream> streams)
Return the google chart url that present all streams within the given list.

Parameters:
streams - the given stream list.
Returns:
the URL string of the chart.

getNormalizedTSChartURL

public java.lang.String getNormalizedTSChartURL(java.util.List<SelectableTrajectoryStream> streams)
Return the google chart url that present normalized streams.

Parameters:
streams - the given stream list.
Returns:
the URL string of the chart.

getDTWChartURL

public java.lang.String getDTWChartURL(java.util.List<SelectableTrajectoryStream> streams)
Return the google chart url that present normalized streams.

Parameters:
streams - the given stream list.
Returns:
the URL string of the chart.

addStreamToChart

public void addStreamToChart(SelectableTrajectoryStream stream,
                             double minimum,
                             double maximum,
                             java.lang.Integer maxStreamLength,
                             GoogleChart googleChart)
Add the given stream to the google chart. And return the maximum value of the stream.

Parameters:
stream - the given stream.
maximum - the maximum value of the range this stream will be associated to.
minimum - the minimum value of the range this stream will be associated to.
maxStreamLength - the plotted stream length on X axis.
googleChart - the google chart.

addStreamToNormalizedChart

public java.util.List<java.lang.Double> addStreamToNormalizedChart(SelectableTrajectoryStream stream,
                                                                   double minimum,
                                                                   double maximum,
                                                                   java.lang.Integer maxStreamLength,
                                                                   GoogleChart googleChart)
Add the given stream to the google chart and return the normalized data.

Parameters:
stream - the given stream.
maximum - the maximum value of the range this stream will be associated to.
minimum - the minimum value of the range this stream will be associated to.
maxStreamLength - the plotted stream length on X axis.
googleChart - the google chart.
Returns:
normalized data extracted from the stream.

addStreamToDTWChart

public void addStreamToDTWChart(SelectableTrajectoryStream stream,
                                java.util.List<java.lang.Double> list,
                                double minimum,
                                double maximum,
                                java.lang.Integer maxStreamLength,
                                GoogleChart googleChart)
Add the given stream to the google chart. And return the maximum value of the stream.

Parameters:
stream - the given stream.
list - the chart data.
maximum - the maximum value of the range this stream will be associated to.
minimum - the minimum value of the range this stream will be associated to.
maxStreamLength - the plotted stream length on X axis.
googleChart - the google chart.

getDateList

public java.util.List<java.lang.String> getDateList(java.util.List<org.hackystat.telemetry.service.resource.chart.jaxb.TelemetryPoint> points)
Return the date list within the list of points.

Parameters:
points - the point list.
Returns:
the date list.

getMarkersList

public java.util.List<java.lang.String> getMarkersList()
Return the date list inside this model.

Returns:
the date list.

getSelectedProjects

public java.util.List<ProjectRecord> getSelectedProjects()
Returns:
the selectedProjects

getParameterAsString

public java.lang.String getParameterAsString()
Return the comma-separated list of parameters in String.

Returns:
the parameters as String

setWidth

public void setWidth(int width)
Parameters:
width - the width to set

getWidth

public int getWidth()
Returns:
the width

setHeight

public void setHeight(int height)
Parameters:
height - the height to set

getHeight

public int getHeight()
Returns:
the height

getStream1Statistics

public java.lang.String getStream1Statistics()
Return statistics for the stream1.

Returns:
the statistics for the stream1.

getStream2Statistics

public java.lang.String getStream2Statistics()
Return statistics for the stream2.

Returns:
the statistics for the stream2.

changeSelectionForAll

public void changeSelectionForAll(boolean flag)
Change all selected flags of streams to the given flag.

Parameters:
flag - the boolean flag.

isInProcess

public boolean isInProcess()
Specified by:
isInProcess in interface Processable
Returns:
the inProcess

isComplete

public boolean isComplete()
Specified by:
isComplete in interface Processable
Returns:
the isComplete

getProcessingMessage

public java.lang.String getProcessingMessage()
Specified by:
getProcessingMessage in interface Processable
Returns:
the message

setWarningMessage

public void setWarningMessage(java.lang.String message)
Set the paramErrorMessage.

Parameters:
message - the message.

getWarningMessage

public java.lang.String getWarningMessage()
Returns:
the paramErrorMessage