Package hec.lang

Class 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 Details

    • NAME_CHANGED

      public static final String NAME_CHANGED
      See Also:
    • DESCRIPTION_CHANGED

      public static final String DESCRIPTION_CHANGED
      See Also:
    • RENAME_EVENT

      public static final String RENAME_EVENT
      See Also:
    • _index

      public int _index
      The index.
    • _name

      public String _name
      The name data member.
    • _description

      public String _description
      The description data member.
    • _modified

      protected transient boolean _modified
      Modified flag
    • _ignoreModifiedEvents

      protected transient boolean _ignoreModifiedEvents
      flag whether to ignore modified events
    • _isValid

      protected transient boolean _isValid
      Validation flag. Override the isValid() method where necessary
    • defaultName

      public static final String defaultName
      The default name.
      See Also:
    • defaultDescription

      public static final String 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

      public NamedType(String name)
      Construct a default NamedType where the name is specified in the constructor.
    • NamedType

      public NamedType(String name, String descript)
      Construct a default NamedType with a specified name and description.
    • NamedType

      public NamedType(NamedType nt)
      Construct a default NamedType from a specific NamedType
  • Method Details

    • getDisplayName

      public String getDisplayName()
      returns the display name which may be different that the _name field override subclasses for specific naming policy.
    • setName

      public void setName(String s)
      Set the NamedTypes's name to the argument String.
    • rename

      public void rename(String s)
      Similar to setName but generates a rename event to let anyone know that this item has been renamed
    • getName

      public String getName()
      get the NameType's name
      Returns:
      the name
    • setDescription

      public void setDescription(String s)
      Set the NamedType's description to the argument String.
    • getDescription

      public 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 interface Modifiable
      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 interface Modifiable
    • 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

      public Object clone() throws CloneNotSupportedException
      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 class Object
      Throws:
      CloneNotSupportedException
    • compareTo

      public int compareTo(Object object)
      Specified by:
      compareTo in interface Comparable
    • getFieldObject

      public Object getFieldObject(Field fld)
      Description copied from interface: FieldAccessor
      This method allows access to java.lang.reflect.Field objects within the implementing class.
      Specified by:
      getFieldObject in interface FieldAccessor
      Parameters:
      fld - The field to get.
      Returns:
      The data object that is stored in the given field
    • setFieldObject

      public boolean setFieldObject(Field fld, Object fobj)
      Description copied from interface: FieldAccessor
      This allows access to fields withing the implementing object to set there data.
      Specified by:
      setFieldObject in interface FieldAccessor
      Parameters:
      fld - The java field object representing the member field to be set
      fobj - The data to set in that field
      Returns:
      returns true if successful
    • update

      public void update(Observable o, Object obj)
      Specified by:
      update in interface Observer
    • addModifiableListener

      public void addModifiableListener(ModifiableListener listener)
    • removeModifiableListener

      public void removeModifiableListener(ModifiableListener listener)
    • fireModifiedStateChanged

      protected void fireModifiedStateChanged()
    • readResolve

      protected Object readResolve() throws ObjectStreamException
      Throws:
      ObjectStreamException
    • set

      public void set(NamedType nt)
    • toString

      public String toString()
      Overrides:
      toString in class Object