Package hec.rss.model

Class ScriptOpRule

All Implemented Interfaces:
AsciiSerializable, FieldAccessor, TSLocation, AltInputReportInfc, RssModelVariableConstants, RssReturnStatusConstants, RssTSLocation, Serializable, Cloneable, Comparable, Observer, rma.lang.Modifiable

public class ScriptOpRule extends OpRule

Title: General CWMS Framework

Description:

Copyright: Copyright (c) 2002

Company: RMA Inc.

See Also:
  • Constructor Details

    • ScriptOpRule

      public ScriptOpRule()
    • ScriptOpRule

      public ScriptOpRule(String name)
    • ScriptOpRule

      public ScriptOpRule(OpController controller, String name)
  • Method Details

    • evaluateLimits

      public void evaluateLimits(RunTimeStep rts, int iteration)
      calculates the limiting value for this rule for the given time step. as of 12/04
      Overrides:
      evaluateLimits in class OpRule
      Parameters:
      rts -
      iteration -
    • setEvalRule

      public void setEvalRule(boolean evalRule)
    • getEvalRule

      public boolean getEvalRule()
    • getComputeIteration

      public int getComputeIteration()
    • getOpValue

      public OpValue getOpValue(RunTimeStep rts)
      returns the operation value based on the previously computed rule limit. As of 12/04
      Overrides:
      getOpValue in class OpRule
      Parameters:
      rts -
      Returns:
    • setUseJavaClass

      public void setUseJavaClass(boolean set)
    • setJavaClassPath

      public void setJavaClassPath(String path)
    • useJavaClass

      public boolean useJavaClass()
    • getJavaClassPath

      public String getJavaClassPath()
    • setScriptText

      public void setScriptText(String scriptText)
    • getScriptText

      public String getScriptText()
    • getFuncDefinition

      public static String getFuncDefinition()
    • getRuleLimitType

      public int getRuleLimitType()
      get the limit type of this rule should be implemented by all subclasses of OpRule
      Overrides:
      getRuleLimitType in class OpRule
    • initializeCompute

      public boolean initializeCompute()
      Description copied from class: OpRule
      prep for compute
      Overrides:
      initializeCompute in class OpRule
    • getMaxScriptLength

      public static int getMaxScriptLength()
    • evaluateRule

      public OpValue evaluateRule(RunTimeStep rts, double initialValue, int iteration, boolean evalDownstream)
      Description copied from class: OpRule
      compares the intial value to rule constraints and returns the adjusted value
      Overrides:
      evaluateRule in class OpRule
    • localTimeSeriesNew

      public TSRecord localTimeSeriesNew(String varName)
      create a TSRecord for the corresponding to varName, with the initial values set to undefined. If the varName is null then null is returned The TimeSeries will have a size of the entire Run Time Window
      Parameters:
      varName - the name of the Local TimeSeries. Non-null
      Returns:
      the LocalTimeSeries.
    • localTimeSeriesNew

      public TSRecord localTimeSeriesNew(String varName, double initialValue)
      create a TSRecord corresponding to varName, with the initial values set to initialValue If the varName is null then null is returned The TimeSeries will have a size of the entire Run Time Window
      Parameters:
      varName - the name of the Local TimeSeries. Non-Null
      initialValue - the initial value to set the Local TimeSeries to
    • localTimeSeriesNew

      public TSRecord localTimeSeriesNew(String varName, TimeSeriesContainer tsc)
      create a TSRecord corresponding to varName, with the TSRecord data set to the TimeSeriesContainer. If the varName or the TimeSeriesContainer is null then null is returned The TimeSeries returned is the size of the TimeSeriesContainer passed in. No attempt to align the returned TimeSeries with the RunTimeWindow is performed.
      Parameters:
      varName - the name of the Local TimeSeries. Non-Null
      tsc - the TimeSeriesContainer to populate the TSRecord with
    • localTimeSeriesSize

      public int localTimeSeriesSize()
      get the number of Local TimeSeries currently being stored
      Returns:
      the number of Local TimeSeries
    • localTimeSeriesClear

      public int localTimeSeriesClear()
      clear out the Local TimeSeries variables.
      Returns:
      the number of Local TimeSeries variables cleared
    • localTimeSeriesListKeys

      public List<String> localTimeSeriesListKeys()
      get a List of the Local TimeSeries names.
      Returns:
      a List of the Local TimeSeries names
    • localTimeSeriesList

      public List<TSRecord> localTimeSeriesList()
      get a List of the Local TimeSeries. The List is not backed by the internal storage of the Local TimeSeries
      Returns:
      a List of the Local TimeSeries
    • localTimeSeriesGet

      public TSRecord localTimeSeriesGet(String varName)
      return a TSRecord corresponding to varName. If a TSRecord
      Parameters:
      varName - the name of the Local TimeSeries. Non-Null
    • localTimeSeriesExists

      public boolean localTimeSeriesExists(String varName)
      check to see if the Local TimeSeries put with the name varName exists
      Parameters:
      varName - the name of the Local TimeSeries
      Returns:
      true if the Local TimeSeries exists
    • varExists

      public boolean varExists(String varName)
      check to see if the user variable put with the name varName exists
      Parameters:
      varName - the name of the user variable
      Returns:
      true if the variable exists
    • varPut

      public void varPut(String varName, Object usrVar)
      save the user variable usrVar with the associated name varName
      Parameters:
      varName -
      usrVar -
    • varGet

      public Object varGet(String varName)
      get the user variable associated with the name varName, that was previous added with varPut()
      Parameters:
      varName - the name of the user variable
      Returns:
      the user variable or null if the user variable doesn't exist
    • varsClear

      public int varsClear()
      clear out the user variables.
      Returns:
      the number of variables cleared
    • varsSize

      public int varsSize()
      return the number of user variables currently being stored
      Returns:
      the number of user variables
    • varsList

      public List<Object> varsList()
      get a List of the user variables. The List is not backed by the internal storage of the user variables.
      Returns:
      a List of the user variables
    • varsListKeys

      public List<String> varsListKeys()
      get a List of the user variable names.
      Returns:
      a List of the user variable names
    • varRemove

      public Object varRemove(String varName)
      remove the user variable that was stored with the name varName.
      Parameters:
      varName - the name of the user variable
      Returns:
      the user variable or null
    • getFieldObject

      public Object getFieldObject(Field fld)
      Description copied from interface: FieldAccessor
      This method allows access to java.lang.reflect.Field objects within the implementing class.
      Specified by:
      getFieldObject in interface FieldAccessor
      Overrides:
      getFieldObject in class OpRule
      Parameters:
      fld - The field to get.
      Returns:
      The data object that is stored in the given field
    • setFieldObject

      public boolean setFieldObject(Field fld, Object fobj)
      Description copied from interface: FieldAccessor
      This allows access to fields withing the implementing object to set there data.
      Specified by:
      setFieldObject in interface FieldAccessor
      Overrides:
      setFieldObject in class OpRule
      Parameters:
      fld - The java field object representing the member field to be set
      fobj - The data to set in that field
      Returns:
      returns true if successful
    • outputReport

      public void outputReport(AlternativeInputReport report, org.jdom.Element elem)
      Description copied from interface: AltInputReportInfc
      Alternative Input Report Interface for data.
      Specified by:
      outputReport in interface AltInputReportInfc
      Overrides:
      outputReport in class OpRule
    • getTotalComputeInitMs

      public long getTotalComputeInitMs()
    • getTotalComputeMs

      public long getTotalComputeMs()
    • nameChanged

      protected void nameChanged()
    • useTextFileReferences

      public void useTextFileReferences()
    • getElementDependencies

      public void getElementDependencies(List elemList)
      Returns the elements that are related to input time series required for calculation of this state variable. This method is used to determine element dependencies for compute ordering. Both input and output time series are considered.
      Overrides:
      getElementDependencies in class OpRule
      Parameters:
      elemList - List to which required Element objects will be added.