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 booleanflag whether to ignore modified eventsintThe index.protected booleanValidation flag.protected booleanModified flagThe name data member.static final StringThe default description.static final StringThe default name.static final Stringstatic final Stringstatic 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 TypeMethodDescriptionvoidaddModifiableListener(ModifiableListener listener) clone()Creates a new object of the same class as this object.intprotected voidget 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.booleanintgetIndex()Return the index of the NamedType as an int.getName()get the NameType's namebooleanCheck if the object has been modified.booleanisValid()Check if the object is valid for compute.protected ObjectvoidremoveModifiableListener(ModifiableListener listener) voidSimilar to setName but generates a rename event to let anyone know that this item has been renamedvoidvoidSet the NamedType's description to the argument String.booleansetFieldObject(Field fld, Object fobj) This allows access to fields withing the implementing object to set there data.voidsetIgnoreModifiedEvents(boolean b) Set the ignoreModifiedEvents flag to true or falsevoidsetIndex(int i) voidsetModified(boolean flag) Set the modified flag to true or false.voidSet the NamedTypes's name to the argument String.voidsetValid(boolean flag) Set the isValid flag to true or false.toString()voidupdate(Observable o, Object obj) booleanIndicates 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:
isModifiedin 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:
setModifiedin 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:
clonein classObject- Throws:
CloneNotSupportedException
-
compareTo
- Specified by:
compareToin interfaceComparable
-
getFieldObject
Description copied from interface:FieldAccessorThis method allows access to java.lang.reflect.Field objects within the implementing class.- Specified by:
getFieldObjectin interfaceFieldAccessor- 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- 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
-