Plug-in Interface and Class Methods


SimplePlugin

hec2.plugin.SimplePlugin interface----public void addMessageTaker(com.rma.message.MessageTaker msgTaker)
Adds the MessageTaker to the plug-in. MessageTakers are used when the plug-in wants to display a message to the user.
Parameters:
msgTaker – the new MessageTaker
Returns:
None----public boolean close(boolean appExiting)
Closes the plug-in application's project. If appExisting is true the application will shut down.
Parameters:
appExiting – true if the application is exiting
Returns:
true if the plug-in has closed successfully----
public boolean createProject(com.rma.model.Project project)
Creates a new Project. The current project is passed in so that the plug in can get any information it needs, like the name, directory, unit system, etc.
Parameters:
project – the current project
Returns:
true if the plug-in has created the project successfully----public boolean displayApplication()
Displays the plug-in applications' main window.
Parameters:
None
Returns:
true if the plug-in has displayed its main window successfully----public String getDirectory()
Gets the plug-in's directory in the WAT study.
Parameters:
None
Returns:
the directory that the Plugin is using----
public String getLogFile()
Returns the log file that the plug-in is using or null if it does not have a log file.
Parameters:
None
Returns:
the full path to the plug-in's logfile or null if the plug-in does not have a logfile----public String getName()
Gets the plug-in's name.
Parameters:
None
Returns:
the name of the Plugin----public String getProjectName()
Returns the name of the plug-in application's project name. This is the name project name without any directory information. Typically, the name resides inside a file and isn't the file name itself.
Parameters:
None
Returns:
the name of the project currently opened by the plug-in----
public String getVersion()
This method is used to get the Application's version number
Parameters:
None
Returns:
the application's version number----
public boolean openProject(com.rma.model.Project project)
Opens an existing project. The current project is passed in so that the plug-in can use its information to determine which project to open when there is more than one project.
Parameters:
project – the current project
Returns:
true if the plug-in has opened its project successfully----public void removeMessageTaker(com.rma.message.MessageTaker msgTaker)
Removes a previously added MessageTaker from the plug-in. MessageTakers are used when the plug-in wants to display a message to the user.
Parameters:
msgTaker – the new MessageTaker
Returns:
None----
public boolean saveProject()
Saves the current project.
Parameters:
None
Returns:
true if the plug-in project was saved successfully----

WatPlugin

hec2.wat.plugin.WatPlugin interface


public void addComputeListeners(List<ComputeProgressListener> listeners)
Adds the com.rma.model.ComputeListeners to the plug-in application's compute process. There is usually an interface class that needs to take the application's compute information and translate the method calls to call the corresponding methods in the ComputeListener.
Parameters:
listeners – a non-null List containing com.rma.model.ComputeProgressListeners
Returns:
None----
public boolean canImport()
Returns whether the plug-in is capable of importing its data into the WAT or not.
Parameters:
None
Returns:
true if the plug-in can import its data----public boolean displayApplication(ModelAlternative modelAlt)
Displays the plug-in application's main window with the data for modelAlt displayed.
Parameters:
modelAlt – the ModelAlternative to display in the application's main window
Returns:
true if the application was displayed----public void importData()
Imports data from the plug-in's application into the WAT.
Parameters:
None
Returns:
None


ComputablePlugin

hec2.plugin.ComputablePlugin interface


public boolean cancelCompute()
Cancels the current compute.
Parameters:
None
Returns:
true if the compute was canceled.----public boolean compute(ModelAlternative modelAlt)
Computes the specified ModelAlternative.
Parameters:
modelAlt – the hec2.wat.model.ModelAlternative to compute
Returns:
true if the compute was completed successfully.----public List<DataLocation> getDataLocations(ModelAlternative modelAlt, int direction)
Gets the DataLocations for the ModelAlternative modelAlt. This is typically either the input or output DSS data for the alternative.
Parameters:
modelAlt – the ModelAlternative to get the DataLocations for
direction – one of either DataLocation.INPUT_LOCATIONS or DataLocation.OUTPUT_LOCATIONS
Returns:
a non-null list of DataLocations


public List<ModelAlternative> getModelAlternatives(Condition schematic)
Returns a non-null List of ModelAlternatives that the plug-in application's project knows about. For RAS this is a Plan and for ResSim it is an Alternative.
Parameters:
schematic – the current Condition. Currently not used.
Returns:
a non-null List of hec2.wat.model.ModelAlternative----public ProgramOrderItem getProgramOrderItem()
Returns the Plug-in's ProgramOrderItem.
Parameters:
None
Returns:
the hec2.modelProgramOrderItem for the plug-in.----public boolean needToCompute(ModelAlternative modelAlt, HecTime lastComputeTime)
Checks if the data represented by the Alternative modelAlt is out of date.
Parameters:
modelAlt – the ModelAlternative to display in the application's main window
lastComputeTime – the time the ModelAlternative was last computed in the current simulation
Returns:
true if the alternative's data has been modified since the last time it was computed


public void setComputeListeners(List<ComputeProgressListener> listeners)
Sets the com.rma.model.ComputeListeners to the plug-in application's compute process. There is usually an interface class that needs to take the application's compute information and translate the method calls to call the corresponding methods in the ComputeListener.
Parameters:
listeners – a non-null List containing com.rma.model.ComputeProgressListeners.
Returns:
None----public boolean setDataLocations(ModelAlternative modelAltList<DataLocation> DataLocations) throws ModelLinkingException
Sets the DataLocations for the ModelAlternative modelAlt. This is typically either the input or output DSS data for the alternative
Parameters:
modelAlt – the ModelAlternative to get the DataLocations for
DataLocations – the data locations set by the user
Returns:
true if the Data Locations were successfully saved by the application
Throws:
ModelLinkingException. – if an error occurred during setting the DataLocations----

DisplayablePlugin

hec2.plugin.DisplayablePlugin interface----public void addMap(String mapPath)
Adds a map to the WAT project so that the plug-in can act accordingly.
Parameters:
mapPath – the full path to the map file to added to the WAT project
Returns:
None----public boolean displayEditor(GraphicElement element)
Displays the application's editor associated with the GraphicElement.
Parameters:
element – the hec.wat.map.GraphicElement to display the editor for
Returns:
true if the editor was displayed successfully----public boolean displayOutput(OutputElement element, List<ModelAlternative> otherAlts)
Displays the output (plot/table/etc) for the selected OutputElement, using the List of ModelAlternatives as the comparison alternative.
Parameters:
element – the hec.wat.model.OutputElement to display the output for
otherAlts – a non-null List of comparison ModelAlternatives. This list may be empty.
Returns:
true if the output was displayed successfully.----public void editAction(String action, ModelAlternative modelAlt)
Performs the edit action. The Action is from the List of Actions returned by getEditActions()
Parameters:
action – the name of the EditAction that was supplied by getEditActions() or getGlobalEditActions
modelAlt – the ModelAlternative to perform the action on. If the EditAction was returned by getGlobalEditAction() then the modelAlt is null.
Returns:
None----public void editAlternative(ModelAlternative modelAlt)
Displays the editor for the specified ModelAlternative.
Parameters:
modelAlts – the ModelAlternative to display the editor for
Returns:
None----public List<EditAction> getEditActions(ModelAlternative modelAlt)
Returns the list of EditActions to be displayed on the main window's Edit menu for the specified ModelAlternative.
Parameters:
modelAlts – the ModelAlternative to get the hec2.wat.ui.EditActions for
Returns:
a non-null List of hec2.wat.ui.EditActions for the specified modelAlt----public List<GraphicElement> getGraphicElements(ModelAlternative modelAlt)
Returns the list of GraphicElements for the specified ModelAlternative. The GraphicElement should use addOutputAction(OutputElement) to include all OutputElements that it needs to display in its popup menu.
Parameters:
modelAlt – the ModelAlternative to get the hec2.wat.map.GraphicElements for
Returns:
a non-null list of GraphicElements----public List<OutputElement> getOutputElements(ModelAlternative modelAlt)
Returns the list of OutputElements that should be added to the Main Window's Results menu.
Parameters:
modelAlt – the ModelAlternative to get the hec2.wat.model.OutputElements for
Returns:
a non-null list of OutputElements----public void removeMap(String mapPath)
Removes a map the WAT project so that the plug-in can act accordingly.
Parameters:
mapPath – the full path to the map file to remove from the WAT project
Returns:
None----

DisplayableWatPlugin

hec2.wat.DisplayableWatPlugin interface----public List<EditAction> getGlobalEditActions()
Returns the list of EditActions to be displayed on the main window's Edit menu.
Parameters:
None
Returns:
a non-null List of hec2.wat.ui.EditActions----

BackgroundImportPlugin

hec2.plugin.BackgroundImportPlugin interface----public void addImportListener(hec2.plugin.event.ImportListener listener)
Adds an ImportListener that the plug-in will notify when the background import has completed. More than one listener can be added
Parameters:
listener – the ImportListener to add
Returns:
None----public void removeImportListener(hec2.plugin.event.ImportListener listener)
Removes an ImportListener from the plug-in.
Parameters:
listener – the ImportListener to remove
Returns:
None----

ClientServerPlugin

hec2.plugin.ClientServerPlugin interface----public boolean isServerAlive()
Returns whether the plug-in's server is alive or not.
Parameters:
None
Returns:
true if the plug-in's server is alive----public boolean startServer()
Starts the Plug-in's server.
Parameters:
None
Returns:
true if the plug-in's server was started successfully----public int getServerPort()
Returns the network port that the server is using.
Parameters:
None
Returns:
the network port that the server is using----

CreatablePlugin

hec2.plugin.CreatablePlugin interface.----
public ModelAlternative createModelAlt()
Returns the network port that the server is using.
Parameters:
None
Returns:
the network port that the server is using----

DynamicLinkagePlugin

Hec2.plugin.DynamicLinkagePlugin interface. Marker interface, contains no methods.----

HydrologicEventPlugin

hec2.wat.plugin.HydrologicEventPlugin interface. Marker interface, contains no methods.----

IndependentComputablePlugin

hec2.wat.plugin.IndependentComputablePlugin interface. Marker interface, contains no methods.----

NonInteractiveImportablePlugin

hec2.plugin.NonInteractiveImportablePlugin interface.----
public boolean importWatershed(Project destWatershed, File srcWatershedFile, CaviVersion version)
Called to import a CWMS CAVI watershed into the current watershed.
Parameters:
destWatershed – the watershed to import into
srcWatershedFile – the source CAVI watershed file
version – the CAVI version of the source watershed
Returns:
True if the import was successful.----

OutputPlugin

----public boolean computeOutputVariables(List<OutputVariable> oVars, ModelAlternative mAlt)
Called during the compute, after the Model Alternative has been computed, to compute and return the selected OutputVariables.
Parameters:
oVars – the the OutputVariables to compute and return
mAlt – the ModelAlternative the OutputVariables are for
Returns:
True if the OutputVariables were computed successfully.----
public List<OutputVariable> getAvailOutputVariables(ModelAlternative mAlt)
Returns the available OutputVariables for the ModelAlternative.
Parameters:
mAlt – the ModelAlternative the OutputVariables are for
Returns:
The List of OutputVariables for the ModelAltenative----

RestartableComputePlugin

hec2.plugin.RestartableComputePlugin. Allows plugins to be shutdown and restarted during the compute at the lifecycle boundary----public void setRestartAtEndOfLifeCycle(boolean restart)
Sets whether the plugin should restart itself at the end of a compute lifecycle. This is done when a plugin or native model has issues with running the many computes that the FRM simulation performs.
Parameters:
oVars – the the OutputVariables to compute and return
mAlt – the ModelAlternative the OutputVariables are for
Returns:
True if the OutputVariables were computed successfully----
public void shudownNow()
Calleds during the compute on RestartableComputePlugins that have the restart option selected.
Parameters:
None
Returns:
True if the plugin restarted successfully----

SaveProjectAsPlugin

hec2.wat.plugin.SaveProjectAsPlugin interface. Implemented by Plug-ins that need to handle their own Save Project As operation. Called during a WAT Project Save-As.----public boolean saveProjectAs(Project currentProject, Project saveAsProject)
Performs a Save-As the Plug-in's project from currentProject to the saveAsProject.
Parameters:
currentProject – the Project that is being saved as
saveAsProject – the new Project that is being saved into
Returns:
True if the plug-in's project was saved successfully----

SelfContainedPlugin

hec2.plugin.selfcontained.SelfContainedPlugin interface. Interface for plug-ins that have no underlying native model. Allows for actions that would normally be performed by the native application.


public List<Action> getActions(ModelAlternative mAlt)
Returns a List of Actions that will display in the context sensitive popup menus for a ModelAlternative.
Parameters:
mAlt – the ModelAlternative to return the Actions for
Returns:
The Actions for the ModelAlternative----

TimeWindowIntervalPlugin

hec2.wat.plugin.TimeWindowIntervalPlugin - Marker interface to let the WAT know that the plug-in filled in the ComputeOptions EventList RunTimeWindows and the models in the program sequence after the TimeWindowIntervalPlugin should compute for the newly generated RunTimeWindows in the EventList.

Performance Metric Plug-in

PMComputePlugin

hec2.wat.plugin.pm.PMComputePlugin – Interface that plug-ins to the Performance Metrics plug-in must implement.
.----public PMEPanel getPanel()
Build and return the editor panel that will display in the Performance Metric Alternative's editor
Returns:
The Plug-in's editor panel or null if it doesn't need an editor panel.----
public PMComputeAlternative getAlternative(Element elem, ModelAlternative modelAlt)
Get the PMComputeAlternative read from the specified XML Element elem for the Performance Metric Model Alternative modelAlt.
Parameters:
elem – the Element in the ModelAlternative's file to read the PMComputeAlternative data from
modelAlt – The Performance Metric's Model Alternative that the PMComputeAlternative is part of
Returns:
The PMComputeAlternative----
public String getName()
Return the name for the PMComputeAlternative
Returns:
The PMComputeAlternative's name.----
public List<OutputElement getOutputReports(ModelAlternative modelAlt, PMAlternative pmAlt)
Get the List of hec2.plugin.action.OutputElements for the specified ModelAlternative and corresponding PMAlternative
Parameters:
elem – the Element in the ModelAlternative's file to read the PMComputeAlternative data from
modelAlt – The Performance Metric's Model Alternative that the PMComputeAlternative is part of
Returns:
The PMComputeAlternative


public boolean displayOutput(PMComputeAlternative pmCAlt, OutputElement element, List<PMAlternative> comparisonAlts, int numEvents)
Display the output corresponding to the OutputElement that was returned by getOutputReports() for the specified PMComputeAlternative. The comparison Alternatives are provided if the user selects comparison alternatives and should be used if the output supports it.
Parameters:
pcCAlt – the PMComputeAlternative to display the output for
elem – the OutputElement that was returned by getOutputReports
comparisonAlts – The list of Comparison Alternatives to display in the output if the report supports it.
numEvents – the number of events computed in the simulation
Returns:
True if the report was displayed successfully.


PMComputeAlternative

hec2.wat.plugin.pm.PMComputeAlternative – Interface that PMComputePlugins Alternatives implement.


public boolean load(Element elem, ModelAlternative modelAlt)
Read the PMComputeAlternative's configuration from the specified element for the specified ModelAlternative.
Parameters:
elem – the XML Element that holds the PMComputeAlternative's configuration
modelAlt – The ModelAlternative the PMComputeAlternative belongs to
Returns:
True if the PMComputeAlternative's configuration was loaded successfully.


public void save(Element parentElem)
Save the PMComputeAlternative's configuration from the specified element.
Parameters:
elem – the Element to save the PMComputeAlternative's configuration to


public boolean shouldCompute()
Return true if the PMComputeAlternative is configured to compute.
Returns:
True if PMComputeAlternative should compute


public void addComputeListener(ComputeProgressListener listener)
Adds a com.rma.model.ComputeListener to the PMComputeAlternatives's compute process. There is usually an interface class that needs to take the application's compute information and translate the method calls to call the corresponding methods in the ComputeListener.
Parameters:
listener – a non-null com.rma.model.ComputeProgressListener


public void removeComputeListener(ComputeProgressListener listener)
Removes a com.rma.model.ComputeListener from the PMComputeAlternatives's compute process.
Parameters:
listener – the ComputeListener to remove


public void cancelCompute()
Cancels the current compute.


public boolean compute()
Computes the specified PMComputeAlternative.
Returns:
True if the compute finished successfully.


public List<ConvergenceVariable> getAvailConvVariables()
Return the List of available ConvergenceVariables. ConvergenceVariables are used during the FRA compute to determine when the compute has converged. Convergence is current turned off in the WAT so an empty List can be returned.
Returns:
And Empty List is ok to return


public boolean computeConvergenceVariables(List<ConvergenceVariable> cVars)
Compute the ConvergenceVariables for the PMComputeAlternative. The list of ConvergenceVariables will be all or a subset of the ConvergenceVariables returned by getAvailConvVariables()
Parameters:
cVars – The List of ConvergenceVariables to compute Convergence for
Returns:
True if the ConvergenceVariables values were compute successfully.


public List<OutputVariable> getAvailOutputVariables()
Returns the List of available OutputVariables for the ModelAlternative.
Returns:
The List of OutputVariables for the ModelAltenative


public boolean computeOutputVariables(List<OutputVariable> oVars)
Called during the compute, after the PMComputeAlternative has been computed, to compute and return the selected OutputVariables. The List of OutputVariables will be all or a subset of the OutputVariables returned from getAvailOutputVariables().
Parameters:
oVars – the OutputVariables to compute
Returns:
True if the report was displayed successfully.


public List<SaveFlagVariable> getAvailSaveFlagVariables()
Returns the List of available SaveFlagVariables for the user to select from for FRA Computes. SaveFlagVariables indicate if the Event being computed is interesting and should be saved (event folder doesn't get deleted). SaveFlags are current turned off in the WAT so an empty List can be returned.
Returns:
List of SaveFlagVariables.


public boolean computeSaveFlagVariables(List<SaveFlagVariable> sfVars)
Called during the compute, after the PMComputeAlternative has been computed, to compute and return the selected SaveFlagVariables. The List of SaveFlagVariables will be all or a subset of the SaveFlagVariables returned from getAvailSaveFlagVariables().
Parameters:
sfVars – the SaveFlagVariables to Compute
Returns:
True if the report was displayed successfully.


public List<DataLocation> getDataLocations(int direction)
Gets the DataLocations for the PMComputeAlternative. This is typically either the input or output DSS data for the alternative.
Parameters:
direction – one of either DataLocation.INPUT_LOCATIONS or DataLocation.OUTPUT_LOCATIONS
Returns:
a non-null list of DataLocations


public boolean setDataLocations(List<DataLocation> dataLocations)
Sets the DataLocations for the PMComputeAlternative.
Parameters:
DataLocations – the data locations set by the user
Returns:
true if the Data Locations were successfully saved by the alternative.


public List<GraphicElement> getGraphicElements()
Returns the list of GraphicElements for the specified PMComputeAlternative. The GraphicElement should use addOutputAction(OutputElement) to include all OutputElements that it needs to display in its popup menu.
Returns:
True the list of GraphicElements to display on the map when the Performance Metrics ModelAlternative is displayed, or an empty list if there is nothing to display.


public void setStratificationBinWeights(Map<Integer, Double> weights)
Set the stratification bin weights for the PMComputeAlternative.
Parameters:
weights – the


public Map<Integer, Double>getStratificationBinWeights()
Get the stratification bin weights for the PMComputeAlternative.
Returns:
The bin weights set with setStratificationBinWeights.


Additional Classes


ComputeProgressListener

The com.rma.model.ComputeProgressListener interface is to allow plug-ins to call back into the WAT during the compute to update the compute progress dialog.----public void addMessage(String msg)
Adds a message to the compute progress window. These messages also go to the compute log.
Parameters:
msg – text to add to the compute window
Returns:
None----
public void addErrorMessage()
Adds an error message to the compute progress window. These error messages also go to the compute log.
Parameters:
msg – error text to add to the compute window
Returns:
None----public void addImage(String imagePath)
Adds an image to the compute progress window. Images will not go to the compute log.
Parameters:
ImagePath – full path to the image
Returns:
None----public void addLogMessage(String msg)
Adds a message to the compute log. The message will not appear in the compute progress window.
Parameters:
Msg – text to add directly to the compute log.
Returns:
None----public void addWarningMessage(String msg)
Returns whether the plug-in should compute the model alternative even if it's not out of date.
Parameters:
msg – the warning text to add to the compute progress window
Returns:
None----public void setComputePosition(int currentModelInCompute)
Sets the position in the list of model alternatives to compute. Generally, this method is not called by the plug-ins.
Parameters:
currentModelInCompute – the position in the list of model alternatives
Returns:
None----public void setModelPosition(int percentComplete)
Sets the percent complete on the compute for the current model alternative being computed.
Parameters:
percentComplete – the percent complete for the current computing model alternative
Returns:
None----public void setStatusMessage(String msg)
Sets the text in the compute progress window's status line. The status line will only display a single line of text at a time.
Parameters:
msg – text to display in the status line
Returns:
None----

ComputeOptions

The hec2.wat.model.ComputeOptions class is used to pass the options for the compute to the plug-ins----public int getCurrentEventNumber()
FRA. Returns the current event number during an FRA compute. During non-FRA computes it will return -1. Events start at 1.
Parameters:
None
Returns:
The current FRA event number----public int getCurrentLifecyleNumber()
FRA. Returns the current lifecycle number during an FRA compute. During non-FRA computes it will return -1. Lifecycles start at 1.
Parameters:
None
Returns:
The current FRA lifecycle number----public int getCurrentRealizationNumber()
FRA. Returns the current realization number during an FRA compute. During non-FRA computes it will return -1. Realizations start at 1.
Parameters:
None
Returns:
The current FRA realization number----public String getDssFilename()
Returns the DSS file name used for both input and output data during the compute.
Parameters:
None
Returns:
The full path to the DSS file----public List<hec2.plugin.DynamicLinkage> getDynamicLinkages()
Returns any optional dynamic linkages that might be set for the model alternative being computed.
Parameters:
None
Returns:
The optional dynamic linkages----public List<RunTimeWIndow getEventList()
FRA. Returns the List of RunTimeWindows that represent the FRA event time windows.
Parameters:
None
Returns:
The current FRA RunTimeWindow Event List. The List will be empty for non-FRA computes.


public int getEventNumberInLifeCycle()
FRA. Returns the current event number in the current lifecycle.
Parameters:
None
Returns:
The current FRA event in lifecycle number----public int getEventRandom()
FRA. Returns the current event's random number seed. The event random number seed varies by event.
Parameters:
None
Returns:
The current event's random number seed----public int getInitialLifecycleNumber()
FRA. Gets the first lifecycle number that the current simulation compute was started with.
Parameters:
None
Returns:
The initial lifecycle number


public int getLifecycleRandom ()
FRA. Gets lifecycle's random number seed. The lifecycle random number seed varies by lifecycle.
Parameters:
None
Returns:
The lifecyle's random number seed----public String getFpart()
Returns the output DSS F-Part that the model alternative's use.
Parameters:
None
Returns:
The output DSS F-Part----public int getModelPosition ()
Gets the model's position in the Program Order.
Parameters:
None
Returns:
The model's position in the Program Order


public int getNumberEvents()
Gets the number of events in the lifecycle being computed.
Parameters:
None
Returns:
The number of events----public int getNumberLifecycles()
Gets the number of lifecycles in the Realization being computed.
Parameters:
None
Returns:
The number of lifecycles----public int getProgramModelPosition()
Gets the program specific model position. zero based. i.e. the first FIA model of size FIA models in the sequence.
Parameters:
None
Returns:
The program specific model position


public double getRealizationRandom()
Gets the realization random number seed.
Parameters:
None
Returns:
The realization random number seed----public String getRunDirectory()
Returns the compute directory for the plug-in.
Parameters:
None
Returns:
The compute directory----public hec.model.RunTimeWindow getRunTimeWindow()
Returns the time window (lookback, start & end times) to use for the model alternative compute.
Parameters:
None
Returns:
The time window for the model alternative compute


public String getSimulationName()
Returns the name of the Simulation/Forecast that the Model Alternative is being computed for.
Parameters:
None
Returns:
The name of the Simulation/Forecast----public RunTimeWindow getSimulationTimeWindow()
Time window of the entire simulation. For an FRM simulation this is the 50 year time window..
Parameters:
None
Returns:
The Simulations Time Window----public List<Integer> getSpecifiedLifeCyclesToRunList ()
Gets the Lifecycles that the user specified to compute.
Parameters:
None
Returns:
The Lifecycles to run


public List<Integer> getYearsInLifeCycle ()
Gets the years in a Lifecycle.
Parameters:
None
Returns:
The years in a lifecycle----public boolean isFrmCompute ()
Gets whether the compute is an FRA Compute.
Parameters:
None
Returns:
True if the compute is an FRA compute----public boolean isModelFirstTime ()
Flags indicating if its the models' first time computing. For non-FRA computes this will almost always be true. For FRA computes this will be true on the first event in a lifecycle the model is run.
Parameters:
None
Returns:
true if it's the model's first time computing in the current invocation of the simulation/lifecycle


public boolean isNewLifecycle ()
Flags indicating if it's the model's first time computing. For non-FRA computes this will almost always be true. For FRA computes this will be true on the first event in a lifecycle the model is run.
Parameters:
None
Returns:
true if it's the models first time computing in the current invocation of the simulation/lifecycle----public void setCurrentEventNumber (int event)
Sets the current FRA event number being computed. This is set by the WAT and shouldn't be changed by the plug-ins. However, changes will not be reflected in the other model alternatives computed in the simulation.
Parameters:
evnt – the FRA event number to be computed
Returns:
None----public void setCurrentLifecycleNumber (int lifecycle)
Sets the current FRA lifecycle number being computed. This is set by the WAT and shouldn't be changed by the plug-ins. However, changes will not be reflected in the other model alternatives computed in the simulation.
Parameters:
evnt – the FRA lifecycle number to be computed
Returns:
None


public void setCurrentRealizationNumber (int realization)
Sets the current FRA realization number being computed. This is set by the WAT and shouldn't be changed by the plug-ins. However, changes will not be reflected in the other model alternatives computed in the simulation.
Parameters:
evnt – the FRA realization number to be computed
Returns:
None----public void setDssFileName(String dssFileName)
Sets the name of the input/output DSS file used in the compute. This is set by the WAT and shouldn't be changed by the plug-ins. However, changes will not be reflected in the other model alternatives computed in the simulation.
Parameters:
dssFileName – the DSS filename used for input & output of DSS data
Returns:
None----public void setDynamicLinkages(java.util.List<hec2.plugin.DynamicLinkage> linkages)
Sets any dynamic linkages the model alternative might have in this simulation. Dynamic linkages allow a model alternative to remap its linked DSS F-Parts at compute time.
Parameters:
linkages – the dynamic linkages, if any, for the model alternative in the simulation/forecast
Returns:
None


public void setEventList(List<RunTimeWindow> eventList)
Sets FRA Events RunTimeWindows. This is set by the WAT and shouldn't be changed by the plug-ins. However, changes will not be reflected in the other model alternatives computed in the simulation.
Parameters:
eventList – the FRA Events RunTimeWindows
Returns:
None----public void setEventRandom(double eventRandom)
Sets FRA random number for the Event being computed. This is set by the WAT and shouldn't be changed by the plug-ins. However, changes will not be reflected in the other model alternatives computed in the simulation.
Parameters:
eventRandom – the FRA Event random number
Returns:
None----public void setForceCompute(boolean forceCompute)
Sets whether the model alternative should be computed even if it's not out of date. This is set by the WAT and shouldn't be changed by the plug-ins. However, changes will not be reflected in the other model alternatives computed in the simulation.
Parameters:
forceCompute – true if the model alternative should be recomputed
Returns:
None


public void setFpart(String fPart)
Sets the DSS output F-Part the model alternative uses. This is set by the WAT and shouldn't be changed by the plug-ins. However, changes will not be reflected in the other model alternatives computed in the simulation.
Parameters:
fPart – The DSS F-Part used for the model alternative's compute
Returns:
None----public void setInitialLifecycleNumber(int initialLifecycle)
Sets first FRA lifecycle number to be computed. This is set by the WAT and shouldn't be changed by the plug-ins. However, changes will not be reflected in the other model alternatives computed in the simulation.
Parameters:
initialLifecycle – the initial FRA lifecycle number to be computed
Returns:
None----public void setIsFrmCompute(boolean isFrmCompute)
Sets whether the compute is an FRA compute or not. This is set by the WAT and shouldn't be changed by the plug-ins. However, changes will not be reflected in the other model alternatives computed in the simulation.
Parameters:
isFrmCompute – true if it's a FRA compute
Returns:
None


public void setIsNewLifecycle(boolean newLifecycle)
Sets whether the current event is a new Realization. This is set by the WAT and shouldn't be changed by the plug-ins. However, changes will not be reflected in the other model alternatives computed in the simulation.
Parameters:
isFrmCompute – true if the current event is the start of a new Realization
Returns:
None----public void setLifecycleRandom(double lifecycleRandom)
Sets FRA random number seed for the lifecycle. This is set by the WAT and shouldn't be changed by the plug-ins. However, changes will not be reflected in the other model alternatives computed in the simulation.
Parameters:
lifecycleRandom – the lifecycle random number seed
Returns:
None----public void setModelFirstTime(boolean firstTime)
Sets whether it's the model's first time computing in a lifecycle for FRA compute or in the compute as a whole for non-FRA compute. This is set by the WAT and shouldn't be changed by the plug-ins. However, changes will not be reflected in the other model alternatives computed in the simulation.
Parameters:
lifecycleRandom – true if it's the model's first time computing
Returns:
None


public void setModelPosition(int modelPosition)
Sets position of the model in the overall model order, zero based. This is set by the WAT and shouldn't be changed by the plug-ins. However, changes will not be reflected in the other model alternatives computed in the simulation.
Parameters:
lifecycleRandom – the model's position in the compute order
Returns:
None----public void setNumberLifecycles(int numberLifecycles)
Sets total number of lifecycles in the FRA compute. This is set by the WAT and shouldn't be changed by the plug-ins. However, changes will not be reflected in the other model alternatives computed in the simulation.
Parameters:
numberLifecycles – the model's position in the compute order.
Returns:
None----public void setRunDirectory(String runDirectory)
Sets the run directory the plug-in should compute the model alternative in. This is set by the WAT and shouldn't be changed by the plug-ins, though any change will not be reflected in the other model alternatives computed in the simulation.
Parameters:
modelAlt – the hec2.model.ModelAlternative to compute
Returns:
true if the compute was completed successfully


public void setRunTimeWindow(hec.model.RunTimeWindow rtw)
Sets the run time window (lookback, start, & end times) that the plug-in should compute the model alternative for. This is set by the WAT and shouldn't be changed by the plug-ins, though any change will not be reflected in the other model alternatives computed in the simulation.
Parameters:
rtw – the run time window to compute the model alternative for
Returns:
None----public void setSimulationName(String simulationName)
Sets the name of the simulation/forecast that the model alternative is being computed for. This is set by the WAT and shouldn't be changed by the plug-ins, though any change will not be reflected in the other model alternatives computed in the simulation.
Parameters:
simulationName – the name of the simulation
Returns:
None----public boolean shouldForceCompute()
Returns whether the plug-in should compute the model alternative even if its not out of date.
Parameters:
None
Returns:
true if the model alternative should always be computed


DataLocation

The hec2.model.DataLocation class is used to get and set the various locations for the models that produce or consume DSS data during a forecast compute. The DataLocation objects are used by the Model Linking process. They are access through the plug-ins through the getDataLocation() and setDataLocation() calls. An input DataLocation (returned from the plugin through the getDataLocation(DataLocation.INPUT_LOCATIONS) call) when linked will have the previous model's DataLocation set as its linked to location. The DataLocation's linkages are stored by the plugin/native application. Once a DataLocation is linked it needs to return its linkage when subsequent calls to getDataLocation(DataLocation.INPUT_LOCATIONS) are made. Output DataLocations aren't linked and don't need to store the linkage.
To make storing/loading the linkages easier there is a utility class hec2.plugin.util.DataLocationUtilities that contains saveDataLocations() and loadDataLocations() methods that will store the DataLocations out to a JDom XML Element.----public boolean fromXML (Element dataLocationElement)
Restores the DataLocation from the XML element dataLocationElement.
Parameters:
dataLocationElement – the element to restore the DataLocation from
Returns:
True if the DataLocation was restored correctly.----public String getAlternativeName()
Gets the name of the ModelAlternative that is DataLocation is for.
Parameters:
None
Returns:
The name of the Model Alternative----

public DataLocationComputeType getComputeType ()
Gets when this DataLocation is computed. By default DataLocations are computed at Forecast Compute time (DataLocationComputeType.Computed), but some DataLocations data are known before compute time (DataLocationComputeType.Known).
Parameters:
None
Returns:
The DataLocationComputeType, either Computed or Known.----public String getDescription()
Gets the DataLocation's description.
Parameters:
None
Returns:
The DataLocation's description----public String getDsspath()
Gets the DataLocation's DSS path.
Parameters:
None
Returns:
The DataLocation's DSS Path----public GeoLocation getGeoLocation()
Gets the DataLocation's geographic location. Not currently Implemented.
Parameters:
None
Returns:
The DataLocation's Geographic Location----public DataLocation getLinkedToLocation()
Gets the DataLocation that this DataLocation's is linked to. The linkage is set by the Model Linking in the WAT application.
Parameters:
None
Returns:
The DataLocation's linked to location----public ModelAlternative getModelAlternative()
Gets the DataLocation's ModelAlternative.
Parameters:
None
Returns:
The DataLocation's ModelAlternative----public String getModelToLinkTo()
Gets the plugin's name that this DataLocation is linked to.
Parameters:
None
Returns:
The DataLocation's plugin name that it's linked to or null if it's not linked----public String getName()
Gets the DataLocation's name.
Parameters:
None
Returns:
The DataLocation's Name----public String getParameter()
Gets the DataLocation's parameter name..flow, stage etc.
Parameters:
None
Returns:
The DataLocation's parameter----public String getPrevModelIndex()
Gets the DataLocation's parameter name..flow, stage etc.
Parameters:
None
Returns:
The DataLocation's parameter----
public DataLocationType getType()
Gets the DataLocation's data type. One of DataLocationType.TIME_SERIES (default), DataLocationType.PAIRED_DATA, DataLocationType.GRID, DataLocationType.FILE, DataLocationType.SCALAR.
Parameters:
None
Returns:
The DataLocation's type----public boolean isLinkedToPreviousModel()
Returns true if this DataLocation is linked to another DataLocation for its input.
Parameters:
None
Returns:
true if the DataLocation is linked to another DataLocation----public void setAlternativeName (String alternativeName)
Sets the name of the ModelAlternative this DataLocation is for.
Parameters:
alternativeName – the ModelAlternative's name
Returns:
None----public void setComputeType (DataLocationComputeType computeType)
Sets the whether the DataLocation is computed (default) or known value.
Parameters:
computeType – the compute Type. One of DataLocationComputeType.Computed or DataLocationComputeType.Known
Returns:
None----public void setDescription (String description)
Sets the DataLocation's description.
Parameters:
description – the description for the DataLocation
Returns:
None----public void setDssPath (String dsspath)
Sets the DataLocation's dss path.
Parameters:
dsspath – the dss path for the DataLocation
Returns:
None----public void setGeoLocation (GeoLocation location)
Sets the DataLocation's geographic location. Not implemented.
Parameters:
location – the geographic location for the DataLocation
Returns:
None----public void setLinkedToLocation (DataLocation location)
Sets the DataLocation's linked to DataLocation. This is the location that writes the DSS data that the DataLocation reads from during the compute.
Parameters:
location – the linked to location for the DataLocation
Returns:
None----public void setModelAlternative (ModelAlternative modelAlt)
Sets the DataLocation's ModelAlternative.
Parameters:
location – the ModelAlternative for the DataLocation
Returns:
None----public void setModelToLinkTo(String linkedToModel)
Sets the DataLocation's linked to plugin name.
Parameters:
location – the linked to plugin name for the DataLocation or null if its not linked
Returns:
None----public void setName(String name)
Sets the DataLocation's name.
Parameters:
name – the DataLocation's name
Returns:
None----public void setParameter(String parameter)
Sets the DataLocation's parameter (flow, stage etc).
Parameters:
parameter – the DataLocation's parameter
Returns:
None----public void setPrevModelIndex(int index)
Sets the index of the model the DataLocation is linked to in the program order. 1 based. -1=not linked. -99 = use the modelToLinkTo instead.
Parameters:
index – the DataLocation's linked to model index.
Returns:
None----public void setType(DataLocationType type)
Sets the DataLocationType of the DataLocation. Default is DataLocationType.TIME_SERIES.
Parameters:
type – the DataLocation's data type, One of DataLocationType.TIME_SERIES (default), DataLocationType.PAIRED_DATA, DataLocationType.GRID, DataLocationType.FILE, DataLocationType.SCALAR.
Returns:
None----public void toXML(Element parent)
Saves the DataLocation to the XML Element.
Parameters:
parent – the DataLocation's data type, One of DataLocationType.TIME_SERIES (default), DataLocationType.PAIRED_DATA, DataLocationType.GRID, DataLocationType.FILE, DataLocationType.SCALAR.
Returns:
None----

FileDataLocation

The hec2.model.FileDataLocation class is used like the hec2.model.DataLocation class, except it is used for data that resides in files on disk instead of DSS data. Some examples of this would be Arrival Time Grids and Depth Grids.----public String getFilename()
Gets the Filename that this DataLocation is referring to.
Parameters:
None
Returns:
The DataLocation's filename----
public boolean isFromFile ()
Returns if this FileDataLocation is from a file.
Parameters:
None
Returns:
true if the FileDataLocation is from a file----public boolean setFilename ()
Returns if this FileDataLocation is from a file.
Parameters:
None
Returns:
True – if the FileDataLocation is from a file----public void setFromFile(boolean fromFile)
Sets whether this FileDataLocation is from a file or not.
Parameters:
fromFile – true if the FileDataLocation is from a file
Returns:
None


DataLocationUtilities

A utility class for storing/loading DataLocations.----
public static DataLocation createDataLocation(Element dlElem)
Creates the DataLocation from the Element read in from the XML file that was created with saveDataLocations().
Parameters:
dlElem – the ProjectListener.
Returns:
The newly created DataLocation----public static void loadDataLocations(Element root, List<DataLocation>inputDataLocations, ModelAlternative malt)
Loads the input DataLocations from the Element root into the List inputDataLocations and set the ModelAlternative for all the DataLocations to malt.
Parameters:
root – the JDom Element that contains the DataLocation elements.
inputDataLocations – the List to store the newly created DataLocations into.
malt – the ModelAlternative that the DataLocations are for.
Returns:
None


public static void loadDataLocations(Element root, List<DataLocation>outputDataLocations, ModelAlternative malt)
Loads the output DataLocations from the Element root into the List outputDataLocations and set the ModelAlternative for all the DataLocations to malt.
Parameters:
root – the JDom Element that contains the DataLocation elements.
outputDataLocations – the List to store the newly created DataLocations into.
malt – the ModelAlternative that the DataLocations are for.
Returns:
None----public static void saveDataLocations(Element root, List<DataLocation>inputDataLocations)
Saves the input DataLocations from the List inputDataLocations into the Element root.
Parameters:
root – the JDom Element to save the input DataLocations into.
inputDataLocations – the List of DataLocations to save.
Returns:
None


public static void saveOutputDataLocations(Element root, List<DataLocation>outputDataLocations)
Saves the output DataLocations from the List outputDataLocations into the Element root.
Parameters:
root – the JDom Element to store the output DataLocations into.
outputDataLocations – the List of output DataLocations to save.
Returns:
None----

EditActionImpl

The hec2.plugin.ui.EditAction interface represents actions that are added to the Edit menu on the main WAT window for a plug-in. EditActions are created by the plug-in, either from a call to getEditActions(ModelAlternative) or getGlobalEditActions(). The single implementation class is hec2.wat.ui.EditActionImpl.----public String getCommand()
Returns the name of the edit command to run in the plug-in when the edit action is selected. This command can be different from the label.
Parameters:
None
Returns:
The edit command


public String getLabel()
Returns the text to display in the menu item.
Parameters:
None
Returns:
The text to display in the menu item----public String getPluginName()
Returns the name of the plug-in that created the edit action.
Parameters:
None
Returns:
The name of the plug-in----public String getSimulationName()
Returns the name of the simulation that the action is being performed on.
Parameters:
None
Returns:
The simulation name----public void setModelAlternative(hec2.plugin.model.ModelAlternative modelAlt)
Sets the model alternative that this edit action is for.
Parameters:
modelAlt – the model alternative that the edit action is for. This can be left null if the edit action is applicable to a model alternative.
Returns:
None----public void setNeedsModelAlt(boolean needsModelAlt)
Sets whether the edit action needs to have a model alternative to be selected.
Parameters:
needsModelAlt – true if the edit action needs a model alt
Returns:
None----public void setShowAltName(boolean showAltName)
Sets whether the menu item text should include the model alternative name in its label. The plug-in generally does not need to decide this.
Parameters:
showAltName – true if the menu item should show the model alternative name
Returns:
none----public void setSimulationName(String name)
Sets the name of the simulation that the action is being performed for. The WAT sets this before it calls the plug-in to perform the action.
Parameters:
name – the simulation's name
Returns:
None----

GraphicElement

The hec2.plugin.map.GraphicElement class is the base class for the various Graphic Element implementations.----public void addOutputAction(OutputElement output)
Adds an output action to the graphic element. This will add a menu item to the popup menu when the graphic element is right-clicked on in the map schematic.
Parameters:
output – OutputElement to add action to
Returns:
None----public boolean contains(hec.map.WorldPt wpt, double tol)
Checks to see if the graphic element contains the world point within the tolerance. This is the default implementation provided so that subclasses can override it.
Parameters:
wpt – The WorldPoint
tol – tolerance for the WorldPoint
Returns:
false default implementation always returns false.----public void draw(java.awt.Graphic graphics, hec.map.MapPanel mapPanel, boolean selected, boolean editing)
Draws the graphic element to the map schematic. The default implementation does nothing, it is provided so custom graphic elements can draw themselves.
Parameters:
graphics – the graphics context to draw the graphic element onto
mapPanel – the map panel that the graphics is for.
selected – true if the graphic element is selected
editing – true if the user is editing the graphic element
Returns:
None----public CoordinateReferenceSystem getCoordinateReferenceSystem()
If the GraphicElement is in a different coordinate system than the project, returns the CoordinateReferenceSystem that its in so that it can be reprojected on the WAT map windows to align correctly with the maps and other Graphic Elements.
Parameters:
None
Returns:
The GraphicElement's Coordinate Reference System or null if one isn't set.----public GraphicElementAction getEditAction()
If this graphic element allows editing (there is a native model editor for it) gets the edit action.
Parameters:
None
Returns:
The action to add to the popup menu that will display the editor or null if the graphic element doesn't support editing.



public String getElementType()
Returns a string representation of the element's type. May be overridden by sub-classes to return a different string to differentiate itself from other graphic elements.
Parameters:
None
Returns:
The string representation of the graphic element type. For example: ReservoirElements returns 'Reservoir', JunctionElements returns 'Junction' and so on.----public WorldRect getExtents()
Returns the extents of the graphic element.
Parameters:
None
Returns:
The extents of the GraphicElement in world bounds----public hec.map.ButtonGifStrings getMapTool()
Returns the (optional) map tool that will display in the map schematic's tools area when the graphic element is displayed.
Parameters:
None
Returns:
The hec.map.ButtonGifStrings map tool information or null




public hec2.plugin.model.ModelAlternative getModelAlternative()
Returns the model alternative the graphic element is associated with. When the plug-in or native model creates the graphic element, it should set the model alternative that the graphic element is associated with.
Parameters:
Mone
Returns:
The hec2.plugin.model.ModelAlternative the graphic element is associated with


public java.util.List<hec2.plugin.model.OutputElement> getOutputActions()
Returns the list of output actions (tables, reports, plots, etc.) associated with the graphic element. A graphic element may have zero to many output actions.
Parameters:
None
Returns:
The output actions associated with the graphic element


public int getPriority()
Returns the priority of the graphic element in the drawing hierarchy. The element with the highest priority for a given item (i.e. the Reservoir Folsom Lake) will draw. Additional graphic elements representing the same item will rely on the highest priority item to represent them. Some graphic elements are not combined together; therefore, the priority is not used.
Parameters:
None
Returns:
The priority of the graphic element


public String getProgramName()
Returns the name of the plug-in (program) that created this element. By default, it is an empty string and will be this value if the plug-in does not set it.Parameters:
None
Returns:
The plug-in name of the graphic element


public boolean intersects(hec.map.WorldRegion region)
Calls on custom graphic elements to see if they intersect with the world region.
Parameters:
region - the WorldRegion to check intersection with
Returns:
true if the graphic element intersects with the region


public void setAllowsEditing(boolean allowsEditing)
Sets whether the graphic element allows editing or not.
Parameters:
allowsEditing - true if the graphic element allows editing
Returns:
None


public void setCoordinateReferenceSystem(CoordinateReferenceSystem crs)
If the GraphicElement is in a different coordinate system that the WAT project, set its coordinate reference system so that it can be reprojected on the WAT's map window to align properly with the other maps and GraphicElements.
Parameters:
crs – the GraphicElement's CoordinateReferenceSystem
Returns:
None


public void setDescription(String description)
Sets the description of the graphic element.
Parameters:
description - the description for the graphic element
Returns:
None



public void setMapTool(hec.map.ButtonGifStrings mapTool)
Sets the (optional) map panel tool for the graphic element.
Parameters:
mapTool - the optional map tool
Returns:
None


public void setModelAlternative(hec2.plugin.model.ModelAlternative modelAlt)
Sets the model alternative for the graphic element.
Parameters:
modelAlt - the model alternative for the graphic element
Returns:
None


public void setName(String name)
Sets the name of the graphic element.
Parameters:
name - the name for the graphic element
Returns:
None


public void setPriority(int priority)
Sets the priority of the graphic element in the drawing hierarchy. The element with the highest priority for a given item (i.e. the Reservoir Folsom Lake) will draw and the other graphic elements representing the same item won't, instead relying on the highest priority item to draw. Some graphic elements are not combined together so the priority is not used.
Parameters:
priority - the priority for the graphic element
Returns:
None


public void setProgramName(String programName)
Sets the plug-in (program) name for the graphic element. This is the same value returned by the plug-in's getName().
Parameters:
programName - the name of the program
Returns:
None


MessageTaker

The com.rma.message.MessageTaker interface is for objects to be able to display messages to the user without having dependencies on user interface objects----
public void addMessage(String message)
Adds the message to the default view location.
Parameters:
message – the message to display
Returns:
None


public void addMessage(Message message)
Adds the message to the default view location.
Parameters:
message – the message to display
Returns:
None


public void addMessage(String viewName, String message)
Adds the message to the view location specified by viewName. If the view location specified by viewName doesn't exist it will be created.
Parameters:
viewName – the name of the view to display the message in.
message – the message to display
Returns:
None


public void addMessage(String viewName, Message message)
Adds the message to the view location specified by viewName. If the view location specified by viewName doesn't exist it will be created.
Parameters:
viewName – the name of the view to display the message in.
message – the Message to display
Returns:
None


ModelAlternative


OutputElementImpl

The hec2.plugin.model.OutputElement class is used to represent actions for output tables, reports, plots, etc.----
public String getAlternativeName()
Returns the name of the model alternative that this output action is associated with.
Parameters:
None
Returns:
The alternative name


public String getCommand()
Returns the name of the output action command to run in the plug-in when the output action is selected. This command can be different from the label.
Parameters:
None
Returns:
The output command


public hec2.plugin.map.GraphicElement getGraphicElement()
Returns the GraphicElement, if any, associated with the output element.
Parameters:
None
Returns:
The graphic element associated with the output element, or null is there is no graphic element


public String getLabel()
Returns the text to display in the menu item.
Parameters:
None
Returns:
The text to display in the menu item


public hec2.plugin.model.ModelAlternative getModelAlternative()
Returns the model alternative that the output action is used for. If the model alternative is not set, it will get set, by the WAT, to the first model alternative in the program sequence for the active forecast.
Parameters:
None
Returns:
The model alternative


public String getPluginName()
Returns the name of the plug-in that created the edit action.
Parameters:
None
Returns:
The name of the plug-in.


public String getSimulationDirectory()
Returns the simulation/forecast directory. The output action retrieves its model data from this directory.
Parameters:
None
Returns:
The simulation/forecast directory


public String gettSimulationName()
Returns the name of the simulation/forecast. The output action is being performed for this simulation.
Parameters:
None
Returns:
The simulation/forecast name


public void setAlternativeName(String altName)
The output action's alternative name.
Parameters:
altName – the model alternative name
Returns:
None


public void setGraphicElement(hec2.plugin.map.GraphicElement graphicElement)
The output action's graphic element, if any.
Parameters:
graphicElement – the graphic element this output action uses
Returns:
None


public void setModelAlternative (hec2.plugin.model.ModelAlternative modelAlt)
The action's model alternative. If the model alternative is not set by the plugin, it will be set by the WAT to the first model alternative from the appropriate program in the model sequence for the active Forecast Run.
Parameters:
modelAlt – the model alternative
Returns:
None


public void setSimulationDirectory(String simDirectory)
The simulation directory used by the action. The WAT sets this before it calls into the plug-in to perform the action.
Parameters:
simDirectory – the simulation directory.
Returns:
None


public void setSimulationName(String simName)
Sets the action's simulations name. The WAT sets this before it calls into the plug-in to perform the action.
Parameters:
simName – the simulation name
Returns:
None


ProgramOrderItem


Project

The com.rma.model.Project class represents the collection of different Managers, Maps, and various Watershed settings. Only one Project can be open at a time. If there is no Project opened, a special Project object is returned.----
public static void addStaticProjectListener(com.rma.event.ProjectListener listener)
Adds a Project Listener that will be notified when project events (open/closed/loaded/saved) occur for any project.
Parameters:
listener – the ProjectListener
Returns:
None


public static Project getCurrentProject()
Returns the currently opened Project. If no Project is opened, a special 'empty' Project is returned. To check if the 'empty' Project has been returned, use isNoProject().
Parameters:
None
Returns:
The currently opened Project


public static Project getNoProject()
Returns the special 'empty' Project that is the current Project when a Project has not been opened.
Parameters:
None
Returns:
The special 'empty' Project


public static boolean hasOpenProject()
Returns true if the currently opened Project is not the 'empty' Project.
Parameters:
None
Returns:
true if the currently opened Project is not the 'empty' Project


public static void removeStaticProjectListener(ProjectListener listener)
Removes a static ProjectListener
Parameters:
listener – the ProjectListener to remove
Returns:
None


public void addContainer(ManagerContainer container)
Adds a com.rma.model.ManagerContainer to the Project. A ManagerContainer is a way to group one or more Manager types.
Parameters:
container – the ManagerContainrer to add.
Returns:
None


public void addErrorMessage(String msg)
Adds an error message. This message is forwarded on to the Project's MessageTaker.
Parameters:
msg – the error message
Returns:
None


public void addManager(Manager mgr)
Adds a Manager to the Project. A Manager is a collection of data, generally stored in a file.
Parameters:
mgr – the new Manager
Returns:
None


public void addManagerListener(ProjectManagerListener listener)
Adds a ProjectManagerListener to the Project. A ProjectManagerListener is notified when a manager is added or deleted. It can listen for a specific type of Manager added or deleted or for all Manager types.
Parameters:
listener – the new ProjectManagerListener
Returns:
None


public void addManagerProxy(ManagerProxy proxy)
Adds a ManagerProxy to the Project. Normally a ManagerProxy is created when addManager(Manager) is called, so calling this method isn't necessary when adding a Manager with addManager(Manager).
Parameters:
proxy – the new ManagerProxy
Returns:
None


public void addMap(MapIdentifier identifier)
Adds a hec.map.MapObject identified by its hec.map.MapIdentifier to the Project. A MapObject can only have a single copy in a Project at once.
Parameters:
identifier – the new MapIdentifier
Returns:
none
----public void addMessage(String msg)
Adds a message to the Project. This message is forwarded to the Project's MessageTaker.
Parameters:
msg – a message to display
Returns:
none


public void addModifiableListener(com.rma.event.ModifiableListener listener)
Adds a ModifiableListener to the Project. ModifiableListeners are notified when the Project's modified state is changed.
Parameters:
listener – a ModifiableListener
Returns:
None


public Manager createManager(String classname, String mgrName, String mgrDesc)
Creates a new Manager of the type specified by classname, with the name mgrName and the description mgrDesc.
Parameters:
classname – the class of the new Manager
mgrName – the name of the new Manager
mgrDesc – the description of the new Manager
Returns:
The new Manager or null if an error occurred.


public MapObject findMap(MapIdentifier identifier)
Finds and returns the MapObject identified by the MapIdentifier or null if no matching MapObject is found.
Parameters:
identifier – the MapIdentifier to find the Map for
Returns:
None


public String getAbsolutePath(String relativePath)
Converts a relative path to an absolute path. The relative path will be returned as an absolute path relative to the Project folder.
Parameters:
relativePath – a path relative to the Project folder
Returns:
The relative path as an absolute path


public List<ManagerContainer> getContainerList()
Returns the List of ManagerContainers in the Project. ManagerContainers organize Managers into logical order, usually by class type.
Parameters:
None
Returns:
The Project's ManagerContainer List


public CoordinateReferenceSystem getCoordinateReferenceSystem()
Returns the Coordinate System for the Project. The Coordinate System generally shouldn't be changed once it is set.
Parameters:
None
Returns:
The Project's coordinate system


public java.util.Date getCreationDate()
Returns the Date that the Project was created.
Parameters:
None
Returns:
The Date the Project was created


public String getCreator()
Returns the name of the person who created the Project.
Parameters:
None
Returns:
The name of the person who created the Project


public java.util.List<MapObject> getDefaultMaps()
Returns the default List of MapObjects to display in a Map Window. The Project may contain additional MapObjects that the user has to add to the Map Window manually.
Parameters:
None
Returns:
The List of Default Maps


public java.util.Date getDescription()
Returns the Project's description.
Parameters:
None
Returns:
The Project's description


public hec.map.WorldRect getExtents()
Returns the Project watershed extents. The extents can change if the "grow to extents" flag is set and a Map or Manager, with extents larger than the current extents, is loaded.
Parameters:
simDirectory – the simulation directory
Returns:
None


public int getGmtOffset()
Returns the Project's time zone offset from GMT.
Parameters:
None
Returns:
The Project's GMT time zone offset


public boolean getGrowToExtents()
Returns whether the Project watershed extents will grow to the largest Map or Manager's extents that is displayed in a Map window.
Parameters:
None
Returns:
true if the Project's watershed extents will grow


public Manager getManager(String mgrName, Class mgrClass)
Returns the Manager whose name matches mgrName and is of type mgrClass.
Parameters:
mgrName – the name of the Manager
mgrClass – the class type of the Manager
Returns:
The matching Manager


public Manager getManager(String mgrName, String mgrClass)
Returns the Manager whose name matches mgrName and is of type mgrClass. This method converts the mgrClass String into a Class object and calls getManager(String, Class).
Parameters:
mgrName – the name of the Manager
mgrClass – the class type of the Manager
Returns:
The matching Manager


public Manager getManagerByPath(String path, String mgrClass)
Returns the Manager who's file is specified by path and is of the Class type mgrClass.
Paraaeters:
path – the path to the Manager's file
mgrClass – the class type of the Manager
Returns:
The Manager or null it either the path or mgrClass doesn't match


public String getManagerFileName(String path, String name, String extension)
Creates an absolute path for a Manager file by concatenating the path, name, and extension together.
Parameters:
path – the directory/folder where the file should reside. If null, the Project directory is used.
name – the name of the file. Special characters are replaced with underscores.
extension – the file extension
Returns:
The Manager's file path


public List<Manager> getManagerList()
Returns a List of all the Managers that the Project holds. This method will cause all Managers that haven't been loaded to be loaded. Use getManagerProxyList() whenever possible to keep memory usage down.
Parameters:
None
Returns:
A non-null List of the Project's Managers


public List<Manager> getManagerList(ManagerProxyFilter filter)
Returns the list of Managers that matches the ManagerProxyFilter.
Parameters:
filter – a filter on the types of Manager's to return
Returns:
A non-null List of Managers. List may be empty


public <T extends Manager> List<T> getManagerList(Class<T> mgrClass)
Returns the list of Managers for the specified class type. This will load all Managers of the specified class type. It's better to use getManagerProxyListForType(String mgrClassName) where possible.
Parameters:
mgrClassName – the Manager's class type
Returns:
Non-null List of Managers of the class type mgrClassName. List may be empty.


public List<Manager> getManagerList(String mgrClassName)
Returns the list of Managers for the specified class type. This will load all Managers of the specified class type. It's better to use getManagerProxyListForType(String mgrClassName) whenever possible. This method converts the mgrClassName String into a Class object and calls getManagerList(Class).
Parameters:
mgrClassName – the Managers' class type
Returns:
Non-null List of Managers of the class tpe mgrClassName. List may be empty.


public ManagerProxy getManagerProxy(Manager mgr)
Returns the ManagerProxy for the specified mgr.
Parameters:
mgr – the Manager to get the ManagerProxy for
Returns:
The ManagerProxy for the Manager or null if the ManagerProxy is not found


public ManagerProxy getManagerProxy(String mgrName, String mgrClass)
Returns the ManagerProxy for the Manager file specified by path if the Manager is the same class type as mgrClass. This method converts the mgrClass into a Class object and calls getManagerProxyByPath(String, Class).
Parameters:
path – the Manager's file path
mgrClass – the class of the Manager
Returns:
The matching ManagerProxy or null if not found


public ManagerProxy getManagerProxyByPath(String path, Class mgrClass)
Returns the ManagerProxy for the Manager file specified by the path, if the Manager is the same class type as mgrClass.
Parameters:
path – the Manager's file path
mgrClass – the class of the Manager
Returns:
The matching ManagerProxy or null if not found


public List<ManagerProxy> getManagerProxyList()
Returns a List of all the ManagerProxies held by the Project.
Parameters:
None
Returns:
A List of the entire Project's ManagerProxies


public List<ManagerProxy> getManagerProxyListForType(Class mgrClass)
Returns a List of ManagerProxy's for Managers that are of type mgrClass.
Parameters:
mgrClass – The Manager's class to return ManagerProxies for
Returns:
A List of ManagerProxies. This List may be null if there are no Managers of the requested type


public List<ManagerProxy> getManagerProxyListForType(String mgrClass)
Returns a List of ManagerProxy's for Managers that are of type mgrClass. This method converts the mgrClass String into a Class object and calls getManagerProxyListForType(Class).
Parameters:
mgrClass – The Managers' class to return ManagerProxies for
Returns:
List of ManagerProxies. This List may be null if there are no Managers of the requested type


public MapObjectInterface getMap(String mapPath)
Returns the Map Object that represented by the mapPath.
Parameters:
mapPath – the path to a Map Object's file
Returns:
The Map Object or none if the mapPath did not match any Map Object's files


public List<MapObject> getMaps()
Returns the list of MapObjects held by the Project.
Parameters:
None
Returns:
The Project's MapObjects


public List<Manager> getModifiedManagers()
Returns the list of modified Managers.
Parameters:
None
Returns:
The list of modified Managers


public String getName()
Returns the name of the Project.
Parameters:
None
Returns:
The Project's name


public String getProjectDirectory()
Returns the directory/folder where the Project file resides.
Parameters:
None
Returns:
The Project's folder


public String getProjectExtension()
Returns the file extension for the Project. Default is to return 'prj'.
Parameters:
None
Returns:
The Project's file extension


public com.rma.io.RmaFile getProjectFile()
Gets the Project file.
Parameters:
None
Returns:
The Project's file


public String getProjectType()
Returns the String that represents the Project type. The default type is 'Project' but some applications want to call it 'Study' or 'Watershed' etc.
Parameters:
simDirectory – the simulation directory
Returns:
None


public String getRelativePath(String absPath)
Returns a path relative to the Project folder, using the absolute path passed in. If a relative path is passed in, no changes will be made to it. Convenience method for getRelativePath(absPath, false).
Parameters:
absPath – absolute path used to create the relative path
Returns:
The relative path


public String getRelativePath(String absPath, boolean relativeIfPossible)
Returns a path relative to the Project folder, using the absolute path passed in. If a relative path is passed in, no changes will be made to it.
Parameters:
absPath – absolute path used to create the relative path
relativeIfPossible – true if the path should be made relative even if it's not under the Project folder
Returns:
relative path


public String getTitleName()
Returns the name of the Project to be displayed to the user. This is normally the same as the Project's getName() value.
Parameters:
None
Returns:
name of the Project to be displayed to the user


public int getUnitSystem()
Returns the unit system for the Project. This is either hec.data.Units.ENGLISH_ID or hec.data.Units.SI_ID. The unit system for the Project should not be changed once it's set.
Parameters:
None
Returns:
unit system for the Project


public double getVersion()
Returns the version of the Project. The current version is 1.0.
Parameters:
None
Returns:
version of the project


public String getWorkspacePath()
Gets the absolute path of the folder the Project file resides.
Parameters:
None
Returns:
absolute path to the project folder


public boolean hasProxy(ManagerProxy proxy)
Returns whether the ManagerProxy is already in the list of the current Project's ManagerProxies.
Parameters:
proxy – Search the Project ManagerProxies list for this ManagerProxy
Returns:
true if the Project's ManagerProxies list contains the ManagerProxy


public boolean isClosed()
Returns if Project has been closed.
Parameters:
None
Returns:
true if the Project has been closed


public boolean isModified()
Returns if the Project has been modified since its last load or save.
Parameters:
None
Returns:
true if the Project is modified


public boolean isNoProject()
Checks if the current Project is the default empty project, which means the user hasn't opened a Project yet.
Parameters:
None
Returns:
true if the Project is the default empty Project


public boolean isReadOnly()
Returns whether the Project is read only.
Parameters:
None
Returns:
true if the Project is read only----public boolean removeManager(Manager mgr)
Removes the Manager from the list of Manager's held by the Project. This method calls the Manager.deleting() and then notifies the ManagerListeners that the Project is modified.
Parameters:
mgr – the Manager to remove
Returns:
true if the Manager is removed from the list of Managers held by the Project----public void removeManagerListener(ManagerListener listener)
Removes the ManagerListener from the list of ManagerListeners held by the Project.
Parameters:
listener – the listener to remove
Returns:
None


public void removeMap(MapIdentifier mapToRemove)
Removes the map specified by mapToRemove from the list of MapObjects that the Project holds. This will not remove the MapObject files from disk.
Parameters:
mapToRemove – the MapIdentifier to remove from the Project
Returns:
None


public void removeModifiableListener(ModifiableListener listener)
Removes the ModifiableListener from the list of ModifiableListeners.
Parameters:
listener – the listener to remove
Returns:
None


public void removeProjectMapListener(ProjectMapListener listener)
Removes the ProjectMapListener from the list of ProjectMapListeners.
Parameters:
listener – the ProjectMapListener to remove
Returns:
None


public boolean saveProject()
Saves the Project out to its file and saves any related modified Managers.
Parameters:
None
Returns:
true if the save was successful


public boolean saveProject(com.rma.io.RmaFile prjFile)
Saves the Project out to the specified prjFile and tells modified Managers to save themselves.
Parameters:
prjFile – the file the Project will be saved to
Returns:
true if the save was successful


public boolean setCoordSys(CoordinateInfo cInfo)
Sets the Coordinate System for the Project. The Coordinate System should not be changed once it is set.
Parameters:
cInfo – the Project Coordinate System information
Returns:
None


public void setDescription(String desc)
Sets the description for the project.
Parameters:
desc – the Project's description
Returns:
None


public void setExtents(hec.map.WorldRec extents)
Sets the Project watershed's extents. This can be changed if the "grow to extents" flag is set and a Map or Manager with extents larger than the current extents is loaded.
Parameters:
extents – the Project watershed extents
Returns:
None


public boolean setGrowToExtents(boolean grow)
Sets the Project watershed's extents to grow to the largest Map or Manager's extents displayed in a Map window.
Parameters:
grow – true to grow the Project watershed extents
Returns:
None


public void setMapContainer(MapContainer mapsContainer)
Sets the container that holds the Map Objects loaded in the Project.
Parameters:
mapsContainer – the container to hold the Project's Maps
Returns:
None


public void setMessageTaker(MessageTaker mt)
Sets the object that will accept messages that are to be displayed to the user.
Parameters:
mt – the object that will accept messages
Returns:
None


public void setModified(boolean modified)
Sets the Project (or a subpart of the Project) as modified.
Parameters:
modified – true to set the Project as modified
Returns:
None


public void setName(String name)
Sets the name of the Project. The name of the Project should not be changed after its set.
Parameters:
name – the Project's name
Returns:
None


public void setSyncMapWindows(boolean syncMapWindows)
Sets the map windows to stay in sync as the user scrolls, zooms, or pans.
Parameters:
syncMapWindow – true to set map windows in sync
Returns:
None


public boolean shouldSyncMapWindow()
Returns if the map windows are set in sync as the user scrolls, zooms, or pans.
Parameters:
None
Returns:
true if the maps windows are in sync


WatPluginManager

The hec2.wat.plugin.WatPluginManager is where all plug-ins register themselves so that the WAT can find them.----
public static SimplePlugin getPlugin(String pluginName)
Returns the WatPlugin for the specified plug-in name. The plug-in name is the same name that the plug-in returns from its getName().
Parameters:
pluginName – the name of the plug-in
Returns:
The plug-in or null if there is no plug-in registered with the plug-in manager with the specified name


public static List<SimplePlugin> getPlugins()
Returns the list of plug-ins that have been registered with the plug manager.
Parameters:
None
Returns:
A non-null List of registered plug-ins


public static void register(SimplePlugin plugin)
Registers the plug-in with the plug-in manager.
Parameters:
Plugin – the plug-in to register
Returns:
None