Package hec.clientapp.model
Class SimulationPeriod
java.lang.Object
java.util.Observable
hec.lang.NamedType
hec.clientapp.model.Manager
hec.clientapp.model.ManagerProxyListManager
hec.clientapp.model.AbstractSimulation
hec.clientapp.model.SimulationPeriod
- All Implemented Interfaces:
hec.clientapp.client.WkspCallBack,hec.clientapp.event.ManagerChangedListener,ManagerProxyListContainer,Simulation,AsciiSerializable,FieldAccessor,LockableObject,MessagePrinter,TsRecordContainer,Serializable,Cloneable,Comparable,EventListener,Observer,mil.army.usace.hec.rmi.csinterface.CallBackInterface,rma.lang.Modifiable
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intlength of the SimulationRun's keyprotected intprotected Vector<SimulationRun> protected Stringstatic final intstatic StringDescription of the Fieldprotected booleanprotected Stringstatic final intstatic final StringFields inherited from class hec.clientapp.model.AbstractSimulation
_altCanceledComputeTimes, _altComputeTimes, _altFailedComputeTimes, _computeAll, _endDate, _endTimeString, _lookbackDate, _lookbackTime, _progressDisplay, _startDate, _startTimeString, _timeIncrement, _timeStepFields inherited from class hec.clientapp.model.ManagerProxyListManager
_childWorkspaces, _dataListContainer, _managerGroup, _managerRmiWorkspace, _managerVectorFields inherited from class hec.clientapp.model.Manager
_callBack, _dssFileManagerWrapper, _identifier, _lastModifiedTime, _modifiableListeners, _proxyList, _readOnly, _reloadFailed, _reloadOk, _uiWrapper, _userInterface, _wkspPath, _Workspace, LASTMODIFIED_STRINGFields inherited from class hec.lang.NamedType
_description, _ignoreModifiedEvents, _index, _isValid, _modified, _name, defaultDescription, defaultName, DESCRIPTION_CHANGED, NAME_CHANGED, RENAME_EVENTFields inherited from interface hec.clientapp.event.ManagerChangedListener
MANAGER_ADDED, MANAGER_DELETED, MANAGER_RENAMED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidacceptTrial(SimulationRun run, AltItem altItem, int modelPos, String trialKey) Description of the MethodbooleanaddModelTrial(String program, String id, int num) add a new Model Trial to the list.protected voidbooleancompute()Description of the MethodbooleanbooleancomputeRun(SimulationRun run, int lastModel) compute the ForecastRun run throught model position lastModel.protected voidcopyTrialDataFiles(SimulationRun run, ManagerProxyList proxyList, Vector altList, int numRuns) copy the datafiles that the trial is going to use to the Forecast directorycreateBaseTrialName(String name) Creates the base trial name.createNewTrialRun(String newTrialName, String userName, String trialKey, SimulationRun parent, TrialRun baseTrial, int modelPosition) voiddeleting()called when the Simulation is being deleted, deletes the Simulation directory.findManagerID(Vector idlist, String idname) String[]return an array of the Alternatives (SimulationRuns) namesget the SimulationRun currently being computed.getFieldObject(Field fld) Gets the FieldObject attribute of the SimulationPeriod objectintlonggetLastComputeTime(int index) getLastComputeTimeString(int index) intprotected intgetModelPosition(int a, String altname) getModelTrials(String program, String id) Returns only the name of the simulation dss fileReturns full path to simulation dss filereturns the absolute path to where the simulation reference results are storedReturns an absolute path to where the simulation data is storedgetSimulationRun(String simRunName) return the list of SimulationRunsGets the StreamAlignment attribute of the SimulationPeriod objectgetTrialRun(String trialName) get the TrialRun by namegetTrialRunByUserName(String trialUserName) get TrialRun by usernamereturns a Vector of the names of the SimulationTrialRuns that this SimulationPeriod holdsreturn a Vector of TrialRuns that this Simulation holdsgetUnusedModelTrials(String program, String id) return a list of Model trials that have been created but aren't currently in use.return the path to the workspace.booleanisLoaded()voidloadWorkspace(String remoteRegistry, String baseDir) Load the Simulations specific RmiWorkspaceprotected SimulationRunnewBaseModelTrial(SimulationRun run, int numRuns) create a new base Model Trial for a new ForecastRun added to this ForecastvoidbooleanremoveTrial(AltItem altItem, TrialReference trialRef2Remove) booleanrunExtract(SimulationExtract extract) booleanvoidsetAlternatives(String[] alts) Sets the Alternatives attribute of the SimulationPeriod object.booleansetFieldObject(Field fld, Object fobj) This is part of the ascii serializer interaface.voidsetKeyLength(int length) voidsetLastComputeTime(int index, long computeTime) voidsetMaxAlternativeNameLength(int length) voidsetOutputDSSFileName(String fileName) set the Simulation DSS output filenamevoidsetSimulationAppType(String appType) Sets the application type that is running the simulation.voidsetSimulationRunClass(String className) Sets the name of the class the will perform the simulation run.voidsetSimulationTypeString(String simType) Set the name type (default is "Simulation") of the string printed to compute log, etc.toString()protected voidvoidcalled when Manager is being unloaded.voidMethods inherited from class hec.clientapp.model.AbstractSimulation
computeModel, getAltCanceledComputeIndex, getAltCanceledComputeTime, getAltComputeIndex, getAltComputeTime, getAltFailedComputeIndex, getAltFailedComputeTime, getComputeAll, getEndDateString, getLookbackDateString, getRunTimeWindow, getStartDateString, getTimeIncrementType, getTimestep, getTimeStepString, getTimeWindow, getTimeWindowString, getUserDisplayUrl, isModified, readFile, setAltCanceledComputeTime, setAltComputeTime, setAlternativesModified, setAltFailedComputeTime, setComputeAll, setComputeDisplay, setEndDate, setLookbackDate, setStartDate, setTaskNumber, setTimestep, setTimeStep, writeFileMethods inherited from class hec.clientapp.model.ManagerProxyListManager
dataChanged, deleteManager, getChildWorkspace, getCommonDataList, getDataListContainer, getGmtOffset, getManagerIdentifier, getManagerIDList, getManagerIDList, getManagerProxies, getManagerProxy, getManagerProxy, getManagerProxyList, getManagerProxyList, getManagerRmiWorkspace, getTitleName, getUnitSystem, getWorkspaceConfigFile, getWorkspaceName, init, initCallBack, isNetworked, loadManagerByName, managerAdded, managerChanged, managerRemoved, managerRenamed, mapAdded, mapRemoved, newManager, newManager, openManager, openManager, openManager, openManager, openManager, openManagerByName, saveAllManagers, saveAllModifiedManagers, saveManager, saveManager, saveManagerAs, saveManagerAs, saveWorkspace, saveWorkspace, setCallback, setCallback, setManagerRmiWorkspace, unloadManager, userChangedMethods inherited from class hec.clientapp.model.Manager
addModifiableListener, backupFile, computeComplete, copyFile, deleteFile, finalize, getCallback, getDirectory, getDSSFileManager, getDSSFileManagerWrapper, getFileManager, getFilename, getIdentifier, getInputITSDataSet, getInputTSDataSet, getLastModifiedTime, getLastModifiedTimeString, getModTime, getModTime, getOutputITSDataSet, getOutputTSDataSet, getPath, getProxyList, getReadOnly, getRelativePath, getReloadOk, getSaveAsId, getSaveAsId, getUserInterface, getWorkspace, hasLock, isCanceled, isForecastManager, loadComplete, loadSaveAsFile, makeAbsolutePath, makeAbsolutePath, makeAbsolutePathFromWatershed, makeRelativePath, makeRelativePathFromWatershed, modifiyForSaveAs, newFile, newTSRecordProxy, newTSRecordProxy, notify, notifyModifiableListeners, openFile, printErrorMessage, printLogMessage, printMessage, printSeparator, printStatus, printTableRow, printWarningMessage, refreshData, reLoadChildManagers, reLoadFile, reLoadFile, removeCallBack, removeModifiableListener, renamed, saveChildManagers, saveManager, saveManagerAs, saveManagerAs, setIdentifier, setLastModifiedTime, setLastModifiedTime, setLineAttributes, setLocked, setManagersModifiedTime, setModified, setModifiedFalse, setPath, setProgress, setProxyList, setReadOnly, setReloadOk, setUserInterface, setUserInterface, setWorkspace, writeLastModTimeMethods inherited from class hec.lang.NamedType
clone, compareTo, fireModifiedStateChanged, getDescription, getDisplayName, getIgnoreModifiedEvents, getIndex, getName, isValid, readResolve, rename, set, setDescription, setIgnoreModifiedEvents, setIndex, setName, setValid, update, useRecursiveModifiedTestMethods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChangedMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface hec.clientapp.model.ManagerProxyListContainer
makeAbsolutePath, setModifiedMethods inherited from interface hec.clientapp.model.Simulation
getDescription, getEndDateString, getLookbackDateString, getName, getStartDateString, getTimeWindow, getTimeWindowString, setEndDate, setLookbackDate, setModified, setStartDate
-
Field Details
-
MAX_ALTERNATIVE_NAME_LENGTH
public static final int MAX_ALTERNATIVE_NAME_LENGTH- See Also:
-
SIMULATION_DSS_FILE_NAME
- See Also:
-
DEFAULT_KEY_LENGTH
public static final int DEFAULT_KEY_LENGTH- See Also:
-
m_simulationPath
-
FILE_EXT
Description of the Field -
_keyLength
protected int _keyLengthlength of the SimulationRun's key -
_maxAlternativeNameLength
protected int _maxAlternativeNameLength -
m_loaded
protected transient boolean m_loaded -
_simulationFileName
-
_simRuns
-
-
Constructor Details
-
SimulationPeriod
public SimulationPeriod()Constructor for the SimulationPeriod object
-
-
Method Details
-
getOutputDSSFilePath
Returns full path to simulation dss file- Specified by:
getOutputDSSFilePathin classAbstractSimulation- Returns:
- full path to simulation dss file
-
getOutputDSSFileName
Returns only the name of the simulation dss file- Specified by:
getOutputDSSFileNamein classAbstractSimulation- Returns:
- only the name of the simulation dss file
-
setOutputDSSFileName
set the Simulation DSS output filename- Parameters:
fileName-
-
getTrialRunNames
returns a Vector of the names of the SimulationTrialRuns that this SimulationPeriod holds- Specified by:
getTrialRunNamesin interfaceSimulation
-
createNewTrialRun
public TrialRun createNewTrialRun(String newTrialName, String userName, String trialKey, SimulationRun parent, TrialRun baseTrial, int modelPosition) - Specified by:
createNewTrialRunin interfaceSimulation
-
setSimulationRunClass
Sets the name of the class the will perform the simulation run. If the class name is invalid an illegal arguement exception is thrown.- Parameters:
className- The new SimulationRunClass value
-
getSimulationRunClass
-
getSimulationAppType
-
setSimulationAppType
Sets the application type that is running the simulation. This is used to lookup the simulation run objects -
unloadAlternatives
protected void unloadAlternatives() -
setAlternatives
Sets the Alternatives attribute of the SimulationPeriod object. This are a list of Simulation Runs that will be used in a particular simulation.- Parameters:
alts- A String array of Simulation Run Names.
-
saveStreamAlignment
public boolean saveStreamAlignment() -
newBaseModelTrial
create a new base Model Trial for a new ForecastRun added to this Forecast -
getModelTrials
- Specified by:
getModelTrialsin interfaceSimulation
-
getUnusedModelTrials
return a list of Model trials that have been created but aren't currently in use.- Specified by:
getUnusedModelTrialsin interfaceSimulation
-
addModelTrial
add a new Model Trial to the list. Return true if the model was added. -
copyTrialDataFiles
protected void copyTrialDataFiles(SimulationRun run, ManagerProxyList proxyList, Vector altList, int numRuns) copy the datafiles that the trial is going to use to the Forecast directory -
createBaseTrialName
Creates the base trial name. For a simulation the base trial name is the name of the alternative clipped to 10 characters and appended with the number 0. If it is shorter than 10 then it is appended with '-' characters -
getReferenceResultsPath
returns the absolute path to where the simulation reference results are stored- Returns:
- The reference results value. There is
NO trailing '/' character
-
getSimulationPath
Returns an absolute path to where the simulation data is stored- Specified by:
getSimulationPathin classAbstractSimulation- Returns:
- The SimulationPath value. There is
NO trailing '/' character
-
getWorkspacePath
return the path to the workspace.- Overrides:
getWorkspacePathin classManagerProxyListManager
-
getStreamAlignment
Gets the StreamAlignment attribute of the SimulationPeriod object- Specified by:
getStreamAlignmentin interfaceSimulation- Returns:
- The StreamAlignment value
-
writeTrials
public void writeTrials() -
getTrialRunByUserName
get TrialRun by username- Parameters:
trialUserName- the username of the Trial- Returns:
- the TrialRun or null if its not found
-
getTrialRun
get the TrialRun by name- Parameters:
trialName- the name of the Trial- Returns:
- the TrialRun or null if its not found
-
getTrialRuns
return a Vector of TrialRuns that this Simulation holds -
findManagerID
-
loadWorkspace
Load the Simulations specific RmiWorkspace- Specified by:
loadWorkspacein classAbstractSimulation- Parameters:
remoteRegistry- Description of ParameterbaseDir- Description of Parameter
-
isLoaded
public boolean isLoaded()- Overrides:
isLoadedin classAbstractSimulation
-
unloading
public void unloading()Description copied from class:ManagerProxyListManagercalled when Manager is being unloaded. Closes the workspace.- Overrides:
unloadingin classManagerProxyListManager
-
acceptTrial
Description of the Method- Specified by:
acceptTrialin interfaceSimulation- Parameters:
run- Description of ParameteraltItem- Description of ParametermodelPos- Description of ParametertrialKey- Description of Parameter
-
removeTrial
- Specified by:
removeTrialin interfaceSimulation- Overrides:
removeTrialin classAbstractSimulation
-
setSimulationTypeString
Set the name type (default is "Simulation") of the string printed to compute log, etc.- Parameters:
simType-
-
toString
-
getAlternatives
return an array of the Alternatives (SimulationRuns) names- Specified by:
getAlternativesin classAbstractSimulation- Returns:
-
getAlternativeInfo
-
getSimulationRuns
return the list of SimulationRuns- Overrides:
getSimulationRunsin classAbstractSimulation
-
getSimulationRun
-
compute
public boolean compute()Description of the Method- Specified by:
computein interfaceSimulation- Returns:
- Description of the Returned Value
-
computeRun
compute the ForecastRun run throught model position lastModel.- Parameters:
run- TrialForecastRun to computelastModel- position of last model to run. -1 runs all models
-
computeInit
public boolean computeInit() -
getModelPosition
- Parameters:
a-altname-- Returns:
-
getCurrentComputingRun
get the SimulationRun currently being computed.- Returns:
- null if no run is being computed.
-
setLastComputeTime
public void setLastComputeTime(int index, long computeTime) -
getLastComputeTime
public long getLastComputeTime(int index) -
getLastComputeTimeString
-
runExtract
-
getSimulationExtract
-
getKeyLength
public int getKeyLength() -
setKeyLength
public void setKeyLength(int length) -
getMaxAlternativeNameLength
public int getMaxAlternativeNameLength() -
setMaxAlternativeNameLength
public void setMaxAlternativeNameLength(int length) -
reloadManagers
public void reloadManagers() -
deleting
public void deleting()called when the Simulation is being deleted, deletes the Simulation directory. -
closeWorkspace
protected void closeWorkspace()- Overrides:
closeWorkspacein classManagerProxyListManager
-
getFieldObject
Gets the FieldObject attribute of the SimulationPeriod object- Specified by:
getFieldObjectin interfaceFieldAccessor- Overrides:
getFieldObjectin classAbstractSimulation- Parameters:
fld- Description of Parameter- Returns:
- The FieldObject value
-
setFieldObject
This is part of the ascii serializer interaface. It gives the serializer the ability to assigne a value to a private field. If the field does not belong to this class, it is passed to the superclass.- Specified by:
setFieldObjectin interfaceFieldAccessor- Overrides:
setFieldObjectin classAbstractSimulation- Parameters:
fld- The field object that describes which field to setfobj- The value that is assigned to the field- Returns:
- true if the assignment was successful
-