Class DerivedDataChoice


public class DerivedDataChoice extends ListDataChoice
A subclass of DataChoice for derived quantities.
Version:
$Revision: 1.118 $
Author:
IDV Development Team
  • Field Details

    • PROP_FROMDERIVED

      public static String PROP_FROMDERIVED
      Property indicating this is a derived quantity
  • Constructor Details

    • DerivedDataChoice

      public DerivedDataChoice()
      Dummy param-less constructor so we can be recreated thru reflection.
    • DerivedDataChoice

      public DerivedDataChoice(DerivedDataChoice that)
      The copy ctor.
      Parameters:
      that - The object to instantiate from.
    • DerivedDataChoice

      public DerivedDataChoice(DataContext dataContext, List dataChoices, String desc, DerivedDataDescriptor ddd)
      The regular constructor from a DerivedDataDescriptor TODO: Right now the children of a DerivedDataChoice do not refererence their parent. If they do we will need to clone the children here so a DataChoice only has one parent.
      Parameters:
      dataContext - The context in which this DataChoice exists (typically the IntegratedDataViewer).
      dataChoices - The list of initial children data choices (the operands).
      desc - The long description of this choice.
      ddd - The DerivedDataDescriptor that holds the information to instantiate this choice.
    • DerivedDataChoice

      public DerivedDataChoice(DataContext dataContext, DerivedDataDescriptor ddd)
      This is the constructor used when creating a DDC as an end user formula.
      Parameters:
      dataContext - The context in which this DataChoice exists (typically the IntegratedDataViewer).
      ddd - The DerivedDataDescriptor that holds the information to instantiate this choice.
    • DerivedDataChoice

      public DerivedDataChoice(DataContext dataContext, List dataChoices, String name, String description, String categories, String method, String formula, String code)
      Used when not creating it from a DerivedDataDescriptor.
      Parameters:
      dataContext - The context in which this DataChoice exists (typically the IntegratedDataViewer).
      dataChoices - The list of initial children data choices (the operands).
      name - The name of this DataChoice.
      description - The description of this DataChoice.
      categories - The list if DataCategorys.
      method - The method name used as the operator (may be null).
      formula - The formula body used as the operator (may be null).
      code - The code body used as the operator (may be null). (Note: having different code and formula attributes is just a hangover from the initial development. They are acted upon in the same way.
    • DerivedDataChoice

      public DerivedDataChoice(DataContext dataContext, String formula)
      Used when not creating it from a DerivedDataDescriptor.
      Parameters:
      dataContext - The context in which this DataChoice exists (typically the IntegratedDataViewer).
      formula - The formula body used as the operator
  • Method Details

    • cloneMe

      public DataChoice cloneMe()
      Create a new instance of this object.
      Overrides:
      cloneMe in class ListDataChoice
      Returns:
      The new instance.
    • getFullDescription

      public String getFullDescription()
      Get the full Description for this DataChoice.
      Overrides:
      getFullDescription in class ListDataChoice
      Returns:
      full description
    • getData

      protected Data getData(DataCategory category, DataSelection incomingDataSelection, Hashtable requestProperties) throws VisADException, RemoteException, DataCancelException
      Apply the derived operation. If any of the getData of the sub-dataChoices returns null or if on a user select we get null back then this returns null.
      Overrides:
      getData in class ListDataChoice
      Parameters:
      category - Ignore this for now.
      incomingDataSelection - Allows one to subset the getData call (e.g., selecting times).
      requestProperties - extra request properties
      Returns:
      The Data object that is the result of applying the operator held by this choice to its set of operands.
      Throws:
      DataCancelException - if the request was canelled
      RemoteException - Java RMI problem
      VisADException - VisAD problem
    • setFormula

      public void setFormula(String formula)
      Set the formula. Mostly used for xml encoding.
      Parameters:
      formula - The new value.
    • getFormula

      public String getFormula()
      Get the formula. Mostly used for xml encoding.
      Returns:
      The formula.
    • getMethodName

      public String getMethodName()
      Get the method name. Mostly used for xml encoding.
      Returns:
      The method name.
    • setMethodName

      public void setMethodName(String methodName)
      Set the method name. Mostly used for xml encoding.
      Parameters:
      methodName - The new value.
    • setClassName

      public void setClassName(String m)
      Stub method to keep around so persistence won't flag a warning.
      Parameters:
      m - class name
    • getCode

      public String getCode()
      Get the code. Mostly used for xml encoding.
      Returns:
      The code.
    • setCode

      public void setCode(String m)
      Set the code. Mostly used for xml encoding.
      Parameters:
      m - The new value.
    • setUserSelectedChoices

      public void setUserSelectedChoices(Hashtable value)
      Set the user selected choices. Mostly used for xml encoding.
      Parameters:
      value - a hashtable of choices
    • getUserSelectedChoices

      public Hashtable getUserSelectedChoices()
      Get the user selected choices. Mostly used for xml encoding.
      Returns:
      The user selected choices.
    • setDescriptor

      public void setDescriptor(DerivedDataDescriptor value)
      Set the descriptor. Mostly used for xml encoding.
      Parameters:
      value - the new DerivedDataDescriptor
    • getDataDescriptor

      public DerivedDataDescriptor getDataDescriptor()
      Get the DerivedDataDescriptor. Mostly used for xml encoding.
      Returns:
      The DerivedDataDescriptor.
    • setExtraArgs

      public void setExtraArgs(String foo)
      Dummy for persistence.
      Parameters:
      foo - extra args
    • hashCode

      public int hashCode()
      Override the hasCode method.
      Overrides:
      hashCode in class ListDataChoice
      Returns:
      The object's hashcode.
    • equals

      public boolean equals(Object o)
      Override the equals method.
      Overrides:
      equals in class ListDataChoice
      Parameters:
      o - Obejct to compare to.
      Returns:
      Is equals?
    • isEndUserFormula

      public boolean isEndUserFormula()
      Is this an (editable) end user formula.
      Overrides:
      isEndUserFormula in class DataChoice
      Returns:
      true if no descriptor
    • parseOperands

      public static List parseOperands(String jythonCode)
      Parse out the operands in the given Jython code. Return a list of DataOperands
      Parameters:
      jythonCode - The code.
      Returns:
      List of operands.
    • parseOperands

      public static List parseOperands(String jythonCode, List operands, Hashtable seen)
      parse the operands in the given jython code
      Parameters:
      jythonCode - jython code to parse
      operands - ???
      seen - operands we have seen so far
      Returns:
      the operands
    • cleanupJythonCode

      public static String cleanupJythonCode(String code)
      Clean up any JythonCode that the user inputs
      Parameters:
      code - code to clean up
      Returns:
      cleaned up code
    • getDataContext

      public DataContext getDataContext()
      Get the DataContext. Mostly used for xml encoding.
      Returns:
      The DataContext.
    • setDataContext

      public void setDataContext(DataContext c)
      Set the DataContext. Mostly used for xml encoding.
      Parameters:
      c - The new value.
    • main

      public static void main(String[] args)
      Method for testing.
      Parameters:
      args - operands