Package hec.model

Class ConditionalBlock

All Implemented Interfaces:
AsciiSerializable, FieldAccessor, Serializable, Cloneable, Comparable, Observer, Modifiable

public class ConditionalBlock extends NamedType implements AsciiSerializable
See Also:
  • Field Details

  • Constructor Details

    • ConditionalBlock

      public ConditionalBlock()
    • ConditionalBlock

      public ConditionalBlock(String name)
  • Method Details

    • setParent

      public void setParent(Object obj)
    • initializeCompute

      public boolean initializeCompute(RunTimeWindow rtw)
    • deleteConditionalBlock

      public void deleteConditionalBlock(int cbBlockIndex)
    • getParent

      public Object getParent()
    • remove

      public void remove(Conditional cond)
    • clone

      public ConditionalBlock clone()
      Description copied from class: NamedType
      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 NamedType
    • getEvaluatedItems

      public List getEvaluatedItems(RunTimeStep rts, List objList)
      Returns a list of conditional objects (objects owned by a conditional) if that conditional evalutes to a boolean value of true
      Parameters:
      objList -
      Returns:
    • getUnEvaluatedItems

      public List getUnEvaluatedItems(List objList)
      Returns a list of conditional objects (objects owned by a conditional) no matter what a conditional evalutates to.
      Parameters:
      objList -
      Returns:
    • getConditionals

      public List<Conditional> getConditionals()
    • clearConditionals

      public void clearConditionals()
    • setPriority

      public void setPriority(float priority)
    • getPriority

      public float getPriority()
    • addConditional

      public void addConditional(int index, Conditional c)
      Inserts the specified Conditional at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices). In some cases the index value will be modified IF and ELSE conditional items are restricted to the first and list position in the list so the "index" value is ignored. ELSE_IF conditionals will always be constrained to be between the IF and ELSE conditionals items. The method will not allow the index to be used to insert an ELSE_IF before an IF or after an ELSE conditional.
      Parameters:
      index - index at which the specified element is to be inserted
      c - element to be inserted
      Throws:
      UnsupportedOperationException - if the add operation is not supported by this list
      ClassCastException - if the class of the specified element prevents it from being added to this list
      IllegalArgumentException - if some property of the specified element prevents it from being added to this list
      IndexOutOfBoundsException - if the index is out of range (index < 0 || index > size())
    • addConditional

      public void addConditional(Conditional c)
    • hasElse

      public boolean hasElse()
      does this ConditionalBlock have an ELSE
      Returns:
      true if has an ELSE Conditional
    • toString

      public String toString()
      Overrides:
      toString in class NamedType
    • 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
      Overrides:
      getFieldObject in class NamedType
      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
      Overrides:
      setFieldObject in class NamedType
      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
    • duplicateConditionals

      public void duplicateConditionals(ConditionalBlock copyIntoBlock)
      make a copy of the top level items, and reuse lower items
    • shouldTreeNodeExpand

      public boolean shouldTreeNodeExpand()
      Returns:
    • setTreeNodeExpanded

      public void setTreeNodeExpanded(boolean expanded)