Package hec.lang
Class NamedType
java.lang.Object
java.util.Observable
hec.lang.NamedType
- All Implemented Interfaces:
AsciiSerializable
,FieldAccessor
,Serializable
,Cloneable
,Comparable
,Observer
,Modifiable
- Direct Known Subclasses:
AbstractConditionalBlockRef
,AbstractDataObject
,AbstractJDomDataObject
,AbstractTSRecord
,AssignedLocation
,AssignedTimeSeries
,AtLockDescriptor
,AtProjectDescriptor
,BaseStreamAlignment
,Conditional
,ConditionalBlock
,G2dLine
,GlyphDataRecord
,Identifier
,InundationLayer
,InundationParameter
,JDomContractWaterSupplyAccounting
,JDomWaterSupplyPump
,LocationCategoryRef
,LocationGroup
,LocationGroupRef
,LocationGroupSet
,LocationLevelIndicatorImpl
,ModelDrawingAttributeSet
,Node
,ProgramOrderItem
,SchedulableJob
,ScriptGroup
,ScriptIdentifier
,StreamElement
,StreamJunction
,StreamNode
,TimeSeriesCategory
,TimeSeriesGroup
,TsGroup
,UnitsType
,UnmodifiableDataObject
,UserInfo
,UserLoginInfo
,WatershedLocation
public abstract class NamedType
extends Observable
implements Serializable, Cloneable, AsciiSerializable, Observer, Modifiable, Comparable
NamedType serves as a superclass for Objects that need a name and description.
Extends java.util.Observable so that any of the derived objects from
NamedType (ie hec.io.Manager) can register observers.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe description data member.protected boolean
flag whether to ignore modified eventsint
The index.protected boolean
Validation flag.protected boolean
Modified flagThe name data member.static final String
The default description.static final String
The default name.static final String
static final String
static final String
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a default NamedType where the name is set to the defaultName, and the description is set to the default description.Construct a default NamedType from a specific NamedTypeConstruct a default NamedType where the name is specified in the constructor.Construct a default NamedType with a specified name and description. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addModifiableListener
(ModifiableListener listener) clone()
Creates a new object of the same class as this object.int
protected void
get the NameType's descriptionreturns the display name which may be different that the _name field override subclasses for specific naming policy.getFieldObject
(Field fld) This method allows access to java.lang.reflect.Field objects within the implementing class.boolean
int
getIndex()
Return the index of the NamedType as an int.getName()
get the NameType's nameboolean
Check if the object has been modified.boolean
isValid()
Check if the object is valid for compute.protected Object
void
removeModifiableListener
(ModifiableListener listener) void
Similar to setName but generates a rename event to let anyone know that this item has been renamedvoid
void
Set the NamedType's description to the argument String.boolean
setFieldObject
(Field fld, Object fobj) This allows access to fields withing the implementing object to set there data.void
setIgnoreModifiedEvents
(boolean b) Set the ignoreModifiedEvents flag to true or falsevoid
setIndex
(int i) void
setModified
(boolean flag) Set the modified flag to true or false.void
Set the NamedTypes's name to the argument String.void
setValid
(boolean flag) Set the isValid flag to true or false.toString()
void
update
(Observable o, Object obj) boolean
Indicates whether object uses recursive modified testing.Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
-
Field Details
-
NAME_CHANGED
- See Also:
-
DESCRIPTION_CHANGED
- See Also:
-
RENAME_EVENT
- See Also:
-
_index
public int _indexThe index. -
_name
The name data member. -
_description
The description data member. -
_modified
protected transient boolean _modifiedModified flag -
_ignoreModifiedEvents
protected transient boolean _ignoreModifiedEventsflag whether to ignore modified events -
_isValid
protected transient boolean _isValidValidation flag. Override the isValid() method where necessary -
defaultName
The default name.- See Also:
-
defaultDescription
The default description.- See Also:
-
-
Constructor Details
-
NamedType
public NamedType()Construct a default NamedType where the name is set to the defaultName, and the description is set to the default description. -
NamedType
Construct a default NamedType where the name is specified in the constructor. -
NamedType
Construct a default NamedType with a specified name and description. -
NamedType
Construct a default NamedType from a specific NamedType
-
-
Method Details
-
getDisplayName
returns the display name which may be different that the _name field override subclasses for specific naming policy. -
setName
Set the NamedTypes's name to the argument String. -
rename
Similar to setName but generates a rename event to let anyone know that this item has been renamed -
getName
get the NameType's name- Returns:
- the name
-
setDescription
Set the NamedType's description to the argument String. -
getDescription
get the NameType's description- Returns:
- the description
-
getIndex
public int getIndex()Return the index of the NamedType as an int. -
setIndex
public void setIndex(int i) -
isModified
public boolean isModified()Check if the object has been modified.- Specified by:
isModified
in interfaceModifiable
- Returns:
- true if the object has been modified
-
setModified
public void setModified(boolean flag) Set the modified flag to true or false.- Specified by:
setModified
in interfaceModifiable
-
setIgnoreModifiedEvents
public void setIgnoreModifiedEvents(boolean b) Set the ignoreModifiedEvents flag to true or false -
getIgnoreModifiedEvents
public boolean getIgnoreModifiedEvents() -
isValid
public boolean isValid()Check if the object is valid for compute. Override this method where needed -
setValid
public void setValid(boolean flag) Set the isValid flag to true or false. -
useRecursiveModifiedTest
public boolean useRecursiveModifiedTest()Indicates whether object uses recursive modified testing. Should be overrided by subclasses that use recursive testing to return true -
clone
Creates 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.- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
compareTo
- Specified by:
compareTo
in interfaceComparable
-
getFieldObject
Description copied from interface:FieldAccessor
This method allows access to java.lang.reflect.Field objects within the implementing class.- Specified by:
getFieldObject
in interfaceFieldAccessor
- Parameters:
fld
- The field to get.- Returns:
- The data object that is stored in the given field
-
setFieldObject
Description copied from interface:FieldAccessor
This allows access to fields withing the implementing object to set there data.- Specified by:
setFieldObject
in interfaceFieldAccessor
- 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
-
update
-
addModifiableListener
-
removeModifiableListener
-
fireModifiedStateChanged
protected void fireModifiedStateChanged() -
readResolve
- Throws:
ObjectStreamException
-
set
-
toString
-