Package hec.io

Class TimeSeriesCollectionContainer

java.lang.Object
hec.io.DataContainer
hec.io.TimeSeriesCollectionContainer
All Implemented Interfaces:
Serializable, Cloneable

public class TimeSeriesCollectionContainer extends DataContainer implements Cloneable, Serializable
TimeSeriesCollectionContainer is a DataContainer holding TimeSeriesContainers Each individual TimeSeriesContainer may have a different start and end date.
See Also:
  • Field Details

    • timeSeriesContainers

      protected TimeSeriesContainer[] timeSeriesContainers
    • sequences

      protected String[] sequences
    • times

      protected int[] times
    • _dirtyTimes

      protected boolean _dirtyTimes
    • _dirtySequences

      protected boolean _dirtySequences
  • Constructor Details

    • TimeSeriesCollectionContainer

      public TimeSeriesCollectionContainer()
  • Method Details

    • clone

      public Object clone()
      Overrides:
      clone in class Object
    • clone

      public void clone(TimeSeriesCollectionContainer collection)
      Creates a deep clone
      Parameters:
      collection - TimeSeriesCollectionContainer
    • add

      public void add(TimeSeriesContainer tsc)
      Add a single TimeSeriesContainer to the collection. Can be first or any. Call finishedAdding() when done to complete
      Parameters:
      tsc - TimeSeriesContainer
    • finishedAdding

      public void finishedAdding()
      Completes collection when TimeSeriesContainers have been added Re-computes sequences, etc.
    • set

      public void set(TimeSeriesContainer[] containers)
      Set an array of TimeSeriesContainers to be this collection Each TimeSeriesContainer must have a valid collection pathname Replaces any existing collection with this set.
      Parameters:
      containers - TimeSeriesContainer[]
    • set

      public boolean set(TimeSeriesContainer[] containers, int startingSequenceNumber)
      Set a clone of time series containers to be this collection, using a given starting sequence number. The pathnames in each container must be the same, but do not have to be a collection pathname This will rename them (or renumber them) to collection pathnames with sequences that increment by one.
      Parameters:
      containers - TimeSeriesContainer[]
      startingSequenceNumber - int
      Returns:
      boolean, true if succcessful
    • set

      public boolean set(TimeSeriesContainer[] containers, String[] sequences)
      Set a clone of time series containers to be this collection, using a given set of sequences. The sequences must be the same length as the containers. The pathnames in each container must be the same, but do not have to be a collection pathname This will rename them to collection pathnames.
      Parameters:
      containers - TimeSeriesContainer[]
      sequences - String[]
      Returns:
      boolean, true if succcessful
    • get

      public TimeSeriesContainer[] get()
      Gets the array of TimeSeriesContainer from this collection
      Returns:
      TimeSeriesContainer[]
    • size

      public int size()
      Returns the number of timeSeriesContainers in this collection
      Returns:
      int
    • get

      public TimeSeriesContainer get(int index)
      Get the TimeSeriesContainer at the array index provided Use numberOfSequences() to determine array length
      Parameters:
      index - int
      Returns:
      TimeSeriesContainer null if empty collection
    • get

      public TimeSeriesContainer get(String sequence)
      Get the TimeSeriesContainer corresponding to this sequence string
      Parameters:
      sequence - String
      Returns:
      TimeSeriesContainer returns null if squence doesn't exist in collection
    • getTimes

      public int[] getTimes()
      Gets an int array containing all times in all containers in collection. (No times duplicated)
      Returns:
      int[] returns null if empty set
    • contains

      protected boolean contains(int[] array, int arrayCount, int value)
      searchs an array for a specific value. Used in building the time array
      Parameters:
      array - int[]
      arrayCount - int
      value - int
      Returns:
      boolean
    • getSequences

      public String[] getSequences()
      Gets a String array of sequences in this collection
      Returns:
      String[]
    • getPathnameList

      public String[] getPathnameList()
      Return an array of pathnames in this collection
      Returns:
      String[]
    • numberOfSequences

      public int numberOfSequences()
      returns the number of sequences in this collection
      Returns:
      int
    • setDirty

      public void setDirty()
      Tells the collection that sequences need to be recomputed (this is done automatically - don't need to call)
    • remove

      public boolean remove(TimeSeriesContainer tsc)
      Remove a TimeSeriesContainer from the collection
      Parameters:
      tsc - TimeSeriesContainer
      Returns:
      boolean if in the collecion
    • remove

      public boolean remove(int index)
      Remove the TimeSeriesContainer at the index given
      Parameters:
      index - int
      Returns:
      boolean if in the collecion
    • checkContainers

      @Deprecated public boolean checkContainers()
      Deprecated.
      Checks that all containers are collections removes containers that are not part of a sequence (don't need to call - automatically called by getSequences() and finishedAdding() )
      Returns:
      boolean true if all collections