de.cau.cs.kieler.kvid.data
Class DataObject

java.lang.Object
  extended by de.cau.cs.kieler.kvid.data.DataObject

public class DataObject
extends Object

Class for storing all important data for KViD to visualize.

Rating red

Constructor Summary
DataObject(KvidUri theURI, String thedata)
          Constructor for a DataObject, knowing the URI and the data.
DataObject(KvidUri theURI, String thedata, boolean doSaveHistory)
          Constructor for a DataObject, knowing the URI and the data, additionally enables or disables history save mode.
DataObject(KvidUri theURI, String thedata, List<List<Point>> thepaths)
          Constructor for a DataObject, knowing the URI and the data, additionally sets one or more animation and display paths.
 
Method Summary
 void clearHistory()
          Clears the history.
 String getData()
          Method to receive the data of this DataObject.
 int getHistoryLength()
          Checks the number of currently saved history values.
 Object getHistoryValue(int which)
          Method to get a certain history value.
 List<List<Point>> getPaths()
          Method to get the paths which this DataObject's visual representation will follow during animation.
 KvidUri getUri()
          Method to get the URI of the referred model element.
 void setSaveHistory(boolean doSaveHistory)
          Enables or disables history save functionality.
 void updateData(String thedata)
          Method to use when new data available for the referred model element.
 void updatePaths(List<List<Point>> thepaths)
          Method to update the paths which this DataObject's visual representation will follow during animation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataObject

public DataObject(KvidUri theURI,
                  String thedata)
Constructor for a DataObject, knowing the URI and the data.

Parameters:
theURI - The URI to identify the referred model element
thedata - The data to associate with the referred model element

DataObject

public DataObject(KvidUri theURI,
                  String thedata,
                  boolean doSaveHistory)
Constructor for a DataObject, knowing the URI and the data, additionally enables or disables history save mode.

Parameters:
theURI - The URI to identify the referred model element
thedata - The data to associate with the referred model element
doSaveHistory - Whether history should be saved (true) or not (false)

DataObject

public DataObject(KvidUri theURI,
                  String thedata,
                  List<List<Point>> thepaths)
Constructor for a DataObject, knowing the URI and the data, additionally sets one or more animation and display paths.

Parameters:
theURI - The URI to identify the referred model element
thedata - The data to associate with the referred model element
thepaths - List of paths (represented by a list of draw2d Points) which the data animation should follow or use for positioning
Method Detail

getData

public String getData()
Method to receive the data of this DataObject. The data will be returned in it's string representation, but could be any parseable object. It is up to the using client to try parsing for their known data types. One could use try/catch to try parsing and ignoring values that aren't of a known data type.

Returns:
An String representing the data of this DataObject

updateData

public void updateData(String thedata)
Method to use when new data available for the referred model element.

Parameters:
thedata - The new data

getUri

public KvidUri getUri()
Method to get the URI of the referred model element.

Returns:
The referred model element's URI

getPaths

public List<List<Point>> getPaths()
Method to get the paths which this DataObject's visual representation will follow during animation.

Returns:
A list of paths (which are lists of Points)

updatePaths

public void updatePaths(List<List<Point>> thepaths)
Method to update the paths which this DataObject's visual representation will follow during animation. Use when paths were recalculated, e.g. after layout.

Parameters:
thepaths - A list of paths (which are lists of Points)

setSaveHistory

public void setSaveHistory(boolean doSaveHistory)
Enables or disables history save functionality.

Parameters:
doSaveHistory - Whether to enable (true) or disable (false) history saving

getHistoryLength

public int getHistoryLength()
Checks the number of currently saved history values.

Returns:
The number of currently saved history values

getHistoryValue

public Object getHistoryValue(int which)
Method to get a certain history value. Make sure that the value exists, use the getHistoryLength() method for this.

Parameters:
which - Index of the history value to get
Returns:
The history value converted in the right data type as Object

clearHistory

public void clearHistory()
Clears the history.