ibspan.ecap.merchant.shopdecisions.forecasting
Class ForecastTask

java.lang.Object
  extended by ibspan.ecap.merchant.shopdecisions.forecasting.ForecastTask
All Implemented Interfaces:
java.util.concurrent.Callable<ForecastDescription>

public class ForecastTask
extends java.lang.Object
implements java.util.concurrent.Callable<ForecastDescription>

A class representing a single forecasting task, containing all the information needed to schedule, execute at the proper time, and evaluate the forecast.

Author:
Micha³ Drozdowicz

Constructor Summary
ForecastTask(java.lang.String productId, java.util.Date previousForecastEnd, ForecastEvaluator evaluator)
          Constructor
 
Method Summary
 ForecastDescription call()
           Uses the ForecastEvaluator passed in the constructor to prepare the forecast.
 java.util.Date getForecastStart()
          Gets the date at which the forecast task should be executed.
 java.util.concurrent.Future<ForecastDescription> getFuture()
          Gets the Future object able to return the result of the completed task.
 java.util.Date getPreviousForecastEnd()
          Gets the date when the previous forecast period has finished
 java.lang.String getProductId()
          Gets the id of the product to be forecasted.
 long getTaskId()
          Gets the task's unique id
 void setForecastStart(java.util.Date forecastStart)
          Sets the date at which the forecast task should be executed.
 void setFuture(java.util.concurrent.Future<ForecastDescription> future)
          Sets the Future object able to return the result of the completed task.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForecastTask

public ForecastTask(java.lang.String productId,
                    java.util.Date previousForecastEnd,
                    ForecastEvaluator evaluator)
Constructor

Parameters:
productId - the id of the product to be forecasted
previousForecastEnd - the date when the previous forecast period has finished
evaluator - the ForecastEvaluator to be used when executing the task
Method Detail

call

public ForecastDescription call()
                         throws java.lang.Exception
Uses the ForecastEvaluator passed in the constructor to prepare the forecast.

Specified by:
call in interface java.util.concurrent.Callable<ForecastDescription>
Throws:
java.lang.Exception

getForecastStart

public java.util.Date getForecastStart()
Gets the date at which the forecast task should be executed.

Returns:
the date at which the forecast task should be executed.

setForecastStart

public void setForecastStart(java.util.Date forecastStart)
Sets the date at which the forecast task should be executed.

Parameters:
forecastStart - the date at which the forecast task should be executed.

getProductId

public java.lang.String getProductId()
Gets the id of the product to be forecasted.

Returns:
the id of the product to be forecasted.

getFuture

public java.util.concurrent.Future<ForecastDescription> getFuture()
Gets the Future object able to return the result of the completed task.

Returns:
the Future object able to return the result of the completed task.

setFuture

public void setFuture(java.util.concurrent.Future<ForecastDescription> future)
Sets the Future object able to return the result of the completed task.

Parameters:
future - the Future object able to return the result of the completed task.

getPreviousForecastEnd

public java.util.Date getPreviousForecastEnd()
Gets the date when the previous forecast period has finished

Returns:
the date when the previous forecast period has finished

getTaskId

public long getTaskId()
Gets the task's unique id

Returns:
the task's unique id