Class DataRefreshTool

java.lang.Object
org.opensourcephysics.tools.DataRefreshTool
All Implemented Interfaces:
Tool

public class DataRefreshTool extends Object implements Tool
This tool sends data to any tool that requests it.
Version:
1.0
Author:
Douglas Brown
  • Field Details

  • Method Details

    • 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)
      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
    • 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