filecontroller
Class FileController

java.lang.Object
  extended by filecontroller.FileController
All Implemented Interfaces:
FileInterface

public class FileController
extends java.lang.Object
implements FileInterface

The FileController is a maintain class which handles all other classes in filecontroller -package. FileController returns and updates the actual weather data. The source of weather data depends on WeatherDataType -value, which is defined in Parameter -class. WeatherDataType can be "radar" or "PGM". The first value means that we use real data from FMI's radar, and the second value means that we use user made images. No matter what is the source, the data is returned in WeatherMap -class. FileController class also implements the FileInterface.

Version:
1
Author:
Potkuri -group

Field Summary
private  java.lang.String errorMessage
          Error message for user.
private  java.lang.String mode
          This value reflect which ReadImageFile -class shall we use.
private  Parameters parameters
          Current instance of Parameter class.
private  ReadImageFile readImageFile
          Current instance of ReadImageFile class.
private  ReadPGMImageFile readPGMImageFile
          Current instance of ReadPGMImageFile class.
private  boolean status
          Status reveal if constructor fails.
private  WeatherMap weatherMap
          Current instance of WeatherMap class.
 
Constructor Summary
FileController(Parameters parameters)
          Constructor initialize new instance of FileController class.
 
Method Summary
 java.lang.String getErrorMessage()
          Method returns latest error message.
 boolean getStatus()
          Method returns current status of this instance.
 WeatherMap getWeatherMap()
          Method returns current instance of WeatherMap -class, which contains the actual weather data.
 boolean prepare()
          Method is used to divide calculation in several parts.
 boolean update()
          Update FileController and all it's adjuncts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errorMessage

private java.lang.String errorMessage
Error message for user.


mode

private java.lang.String mode
This value reflect which ReadImageFile -class shall we use.


parameters

private Parameters parameters
Current instance of Parameter class.


readImageFile

private ReadImageFile readImageFile
Current instance of ReadImageFile class.


readPGMImageFile

private ReadPGMImageFile readPGMImageFile
Current instance of ReadPGMImageFile class.


status

private boolean status
Status reveal if constructor fails.


weatherMap

private WeatherMap weatherMap
Current instance of WeatherMap class.

Constructor Detail

FileController

public FileController(Parameters parameters)
Constructor initialize new instance of FileController class. If the constructor fails some reason, the status of this class is set false.

Parameters:
parameters - Current Parameter -class.
Method Detail

getErrorMessage

public java.lang.String getErrorMessage()
Method returns latest error message.

Specified by:
getErrorMessage in interface FileInterface
Returns:
ErrorMessage

getStatus

public boolean getStatus()
Method returns current status of this instance. If status is false, there should be some error message available.

Specified by:
getStatus in interface FileInterface
Returns:
status

getWeatherMap

public WeatherMap getWeatherMap()
Method returns current instance of WeatherMap -class, which contains the actual weather data.

Specified by:
getWeatherMap in interface FileInterface
Returns:
WeatherMap

prepare

public boolean prepare()
Method is used to divide calculation in several parts. We can calculate in advance some images and get them later by update-method. Right now this is used only with data from FMI's radar, because they need heavy rendering and more calculation.

Specified by:
prepare in interface FileInterface
Returns:
succeed.

update

public boolean update()
Update FileController and all it's adjuncts. This means that we render next set of weather data and update it into WeatherMap -class.

Specified by:
update in interface FileInterface
Returns:
boolean