org.opensourcephysics.tools
Class DataRefreshTool

java.lang.Object
  extended by org.opensourcephysics.tools.DataRefreshTool
All Implemented Interfaces:
java.rmi.Remote, Tool

public class DataRefreshTool
extends java.lang.Object
implements Tool

This tool sends data to any tool that requests it.

Version:
1.0
Author:
Douglas Brown

Field Summary
protected  java.util.HashSet<Data> moreData
           
 
Method Summary
 void addData(Data data)
          Adds a Data object.
static DataRefreshTool getTool(Data data)
          Returns a DataRefreshTool for the specified data object.
 void removeData(Data data)
          Removes a Data object.
 void send(Job job, Tool replyTo)
          Sends a job to this tool and specifies a tool to reply to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

moreData

protected java.util.HashSet<Data> moreData
Method Detail

getTool

public static DataRefreshTool getTool(Data data)
Returns a DataRefreshTool for the specified data object.

Parameters:
data - the data
Returns:
the tool

send

public void send(Job job,
                 Tool replyTo)
          throws java.rmi.RemoteException
Sends a job to this tool and specifies a tool to reply to. The job xml defines the Data object requesting a refresh ("requestData"). The requestData is compared with this tool's Data ("localData") as follows: 1. If the requestData ID matches the localData ID, then the localData is sent back to the requester. 2. If not, then the requestData ID is compared with the IDs of all Data objects in the list returned by DataTool.getSelfContainedData(localData). If a match is found, the matching Data is sent back to the requester. 3. If not, then the requestData ID is compared with the IDs of Datasets in the list returned by DataTool.getDatasets(localData). If a match is found, the matching Dataset is sent back to the requester. 4. If not, then every Dataset ID in the list returned by DataTool.getDatasets(requestData) is compared with the IDs of Datasets in the list returned by DataTool.getDatasets(localData). All matching Datasets that are found are sent back to the requester.

Specified by:
send in interface Tool
Parameters:
job - the Job
replyTo - the tool requesting refreshed data
Throws:
java.rmi.RemoteException

addData

public void addData(Data data)
Adds a Data object. Note: added Data objects must use the same independent variable as the original Data.

Parameters:
data - the Data object to add

removeData

public void removeData(Data data)
Removes a Data object.

Parameters:
data - the Data object to remove