Package hec.rss.model.globalvariable
Class ScalarGlobalVariable
java.lang.Object
java.util.Observable
hec.lang.NamedType
hec.rss.model.globalvariable.BaseGlobalVariable
hec.rss.model.globalvariable.ScalarGlobalVariable
- All Implemented Interfaces:
AsciiSerializable,FieldAccessor,GlobalVariable,Serializable,Cloneable,Comparable,Observer,rma.lang.Modifiable
- See Also:
-
Field Summary
FieldsFields inherited from class hec.rss.model.globalvariable.BaseGlobalVariable
_altGvData, _networkFields inherited from class hec.lang.NamedType
_description, _ignoreModifiedEvents, _index, _isValid, _modified, _name, defaultDescription, defaultName, DESCRIPTION_CHANGED, NAME_CHANGED, RENAME_EVENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendToSelectionList(double newDouble) add a double to the selection listvoidappendToSelectionList(int newInt) add an int to the selection listvoidappendToSelectionList(Object newItem) append an item to the selection listclone()Creates a new object of the same class as this object.return a short descriptive String of the global variable.getFieldObject(Field fld) This method allows access to java.lang.reflect.Field objects within the implementing class.get the max limit, if set, for this ScalarGlobalVariablegetMaxLimit(RunTimeStep rts) get the max limit, if set, for this ScalarGlobalVariable.get the maximum limit as a Stringget the min limit, if set, for this ScalarGlobalVariablegetMinLimit(RunTimeStep rts) get the min limit, if set, for this ScalarGlobalVariable.get the minimum limit as a Stringintget the index of the Scalar Variable's value in its selection list.intget the length of the selection listgetType()getValue()get the GlobalVariable's value.getValue(RunTimeStep rts) get the GlobalVariable's value.check to see if the ScalarGlobalVariable has a valid valuebooleanis the the global variable using a max limitbooleanis the global variable using a minimum limitbooleanbooleanis the global variable using a selection listvoidoutputReport(AlternativeInputReport report, org.jdom.Element myElem) add the scalar global variable information to the alternative reportvoidsetDataType(ScalarDataType type) booleansetFieldObject(Field fld, Object fobj) This allows access to fields withing the implementing object to set there data.voidsetIsMaxSelected(boolean selected) set that the global variable is using a max limitvoidsetIsMinSelected(boolean selected) set that the global variable is using a min limitvoidsetIsSelectionList(boolean selected) set that the global variable is using a selection listvoidsetMaxLimit(double maxLimit) set the maximum limit for ScalarGlobalVariables with a ScalarDataType of DOUBLEvoidsetMaxLimit(int maxLimit) set the maximum limit for ScalarGlobalVariables with a ScalarDataType of INTEGERvoidsetMaxLimit(Object maxLimit) voidsetMinLimit(double minLimit) set the minimum limit for input ScalarGlobalVariables with a ScalarDataType of DOUBLEvoidsetMinLimit(int minLimit) set the minimum limit for input ScalarGlobalVariables with a ScalarDataType of INTEGERvoidsetMinLimit(Object minLimit) set the minimum limit for the input ScalarGlobalVariablevoidsetParameter(String parameter) voidsetSelectionList(List<String> selectionList) set the selection listvoidsetValue(boolean value) set the value on the ScalarGlobalVariablevoidsetValue(double value) set the value on the ScalarGlobalVariablevoidsetValue(int value) set the value on the ScalarGlobalVariablevoidset the value on the ScalarGlobalVariableMethods inherited from class hec.rss.model.globalvariable.BaseGlobalVariable
finalizeCompute, getComputeMsg, getIsDataLocation, getNetwork, getUsageType, initializeGv, isInput, printToComputeLog, printToComputeWindow, setGlobalVariableData, setInput, setIsDataLocationMethods inherited from class hec.lang.NamedType
addModifiableListener, compareTo, fireModifiedStateChanged, getDescription, getDisplayName, getIgnoreModifiedEvents, getIndex, getName, isModified, isValid, readResolve, removeModifiableListener, rename, set, setDescription, setIgnoreModifiedEvents, setIndex, setModified, setName, setValid, toString, update, useRecursiveModifiedTestMethods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChangedMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface hec.rss.model.globalvariable.GlobalVariable
finalizeCompute, getDescription, getIndex, getIsDataLocation, getName, getNetwork, initializeGv, isInput, setDescription, setGlobalVariableData, setIndex, setInput, setIsDataLocation, setName
-
Field Details
-
DATE_TIME_FORMAT
- See Also:
-
SEASONAL_DATE_FORMAT
- See Also:
-
DATE_FORMAT
- See Also:
-
-
Constructor Details
-
ScalarGlobalVariable
public ScalarGlobalVariable() -
ScalarGlobalVariable
-
-
Method Details
-
clone
Description copied from class:NamedTypeCreates a new object of the same class as this object.
It then initializes each of the new object's fields by assigning it the same value as the corresponding field in this object. No
constructor is called.- Specified by:
clonein interfaceGlobalVariable- Overrides:
clonein classBaseGlobalVariable
-
getType
- Specified by:
getTypein interfaceGlobalVariable
-
setSelectionList
set the selection list- Parameters:
selectionList- the new selection list
-
setValue
set the value on the ScalarGlobalVariable- Parameters:
value- the new value
-
setValue
public void setValue(int value) set the value on the ScalarGlobalVariable- Parameters:
value- the new value
-
setValue
public void setValue(double value) set the value on the ScalarGlobalVariable- Parameters:
value- the new value
-
setValue
public void setValue(boolean value) set the value on the ScalarGlobalVariable- Parameters:
value- the new value
-
setMinLimit
set the minimum limit for the input ScalarGlobalVariable- Parameters:
minLimit- the new minimum limit
-
setMinLimit
public void setMinLimit(int minLimit) set the minimum limit for input ScalarGlobalVariables with a ScalarDataType of INTEGER- Parameters:
minLimit- the new minimum limit
-
setMinLimit
public void setMinLimit(double minLimit) set the minimum limit for input ScalarGlobalVariables with a ScalarDataType of DOUBLE- Parameters:
minLimit- the new minimum limit
-
getMinLimit
get the min limit, if set, for this ScalarGlobalVariable- Returns:
- the min limit or null if not set
-
getMinLimit
get the min limit, if set, for this ScalarGlobalVariable. This method should be used for SeasonalDates- Parameters:
rts- the current RunTimeStep.- Returns:
- the min limit or null if not set
-
getMaxLimit
get the max limit, if set, for this ScalarGlobalVariable- Returns:
- the max limit or null if not set
-
getMaxLimit
get the max limit, if set, for this ScalarGlobalVariable. This method should be used for SeasonalDates- Parameters:
rts- the current RunTimeStep.- Returns:
- the max limit or null if not set
-
setMaxLimit
- Parameters:
maxLimit-
-
setMaxLimit
public void setMaxLimit(int maxLimit) set the maximum limit for ScalarGlobalVariables with a ScalarDataType of INTEGER- Parameters:
maxLimit- the new maximum limit
-
setMaxLimit
public void setMaxLimit(double maxLimit) set the maximum limit for ScalarGlobalVariables with a ScalarDataType of DOUBLE- Parameters:
maxLimit- the new maximum limit
-
getSelectionList
- Returns:
-
appendToSelectionList
append an item to the selection list- Parameters:
newItem- the new non-null Item to append to the selection list
-
appendToSelectionList
public void appendToSelectionList(int newInt) add an int to the selection list- Parameters:
newInt- the new int value to add to the selection list
-
appendToSelectionList
public void appendToSelectionList(double newDouble) add a double to the selection list- Parameters:
newDouble- the new double value to add to the selection list
-
getSelectionListIndex
public int getSelectionListIndex()get the index of the Scalar Variable's value in its selection list.- Returns:
- -1 selection not found in list -2 not using selection list >0 index in list
-
getSelectionListLength
public int getSelectionListLength()get the length of the selection list- Returns:
- the length of the selection. 0 if empty
-
isSelection
public boolean isSelection()- Returns:
-
getDataType
- Returns:
-
getValue
get the GlobalVariable's value. if this version of getValue() is called on a SeasonalDate then the year will be set to the Run Time Window's start year. returned types:
- ScalarDataType.INTEGER -> Integer
- lcalarDataType.DOUBLE -> Double
- ScalarDataType.BOOLEAN -> Boolean
- ScalarDataType.DAYOFWEEK -> hec.model.DayOfWeek
- ScalarDataType.DATE -> hec.heclib.util.HecTime
- ScalarDataType.MONTHOFYEAR -> java.time.Month
- ScalarDataType.DATEANDTIME -> hec.heclib.util.HecTime
- ScalarDataType.SEASONAL_DATE -> hec.heclib.util.HecTime
- ScalarDataType.TIME -> java.time.LocalTime
- Returns:
- the GlobalVariable's value
-
getValue
get the GlobalVariable's value. this version of getValue() should be called for SeasonalDates so the year can be set appropriately- Parameters:
rts- the current RunTimeStep. can be null for mostScalarDataTypes except SeasonalDate- Returns:
- the GlobalVariable's value
-
setDataType
-
setIsSelectionList
public void setIsSelectionList(boolean selected) set that the global variable is using a selection list- Parameters:
selected-
-
setIsMinSelected
public void setIsMinSelected(boolean selected) set that the global variable is using a min limit- Parameters:
selected-
-
setIsMaxSelected
public void setIsMaxSelected(boolean selected) set that the global variable is using a max limit- Parameters:
selected-
-
isSelectionList
public boolean isSelectionList()is the global variable using a selection list- Returns:
- true if the global variable is using a selection list
-
isMinSelected
public boolean isMinSelected()is the global variable using a minimum limit- Returns:
- true if there is a min limit set
-
isMaxSelected
public boolean isMaxSelected()is the the global variable using a max limit- Returns:
- true if there is a max limit set
-
getMinLimitAsString
get the minimum limit as a String- Returns:
- a String that's the min limit
-
getMaxLimitAsString
get the maximum limit as a String- Returns:
- a String that's the max limit
-
getDescriptiveText
return a short descriptive String of the global variable. used for things like tooltips- Specified by:
getDescriptiveTextin interfaceGlobalVariable- Returns:
- short description String of the global variable
-
getParameter
- Returns:
-
setParameter
-
hasValidValue
check to see if the ScalarGlobalVariable has a valid value- Specified by:
hasValidValuein interfaceGlobalVariable- Overrides:
hasValidValuein classBaseGlobalVariable- Returns:
- null if the value is valid or the ScalarGlobalVariable has no value
-
outputReport
add the scalar global variable information to the alternative report- Specified by:
outputReportin interfaceGlobalVariable- Overrides:
outputReportin classBaseGlobalVariable- Parameters:
report- the Alternative ReportmyElem- the element for this global variable
-
getFieldObject
Description copied from interface:FieldAccessorThis method allows access to java.lang.reflect.Field objects within the implementing class.- Specified by:
getFieldObjectin interfaceFieldAccessor- Overrides:
getFieldObjectin classBaseGlobalVariable- Parameters:
fld- The field to get.- Returns:
- The data object that is stored in the given field
-
setFieldObject
Description copied from interface:FieldAccessorThis allows access to fields withing the implementing object to set there data.- Specified by:
setFieldObjectin interfaceFieldAccessor- Overrides:
setFieldObjectin classBaseGlobalVariable- Parameters:
fld- The java field object representing the member field to be setfobj- The data to set in that field- Returns:
- returns true if successful
-