Class TimeColumn

All Implemented Interfaces:
Iterable<LocalTime>, Comparator<LocalTime>, CategoricalColumn<LocalTime>, Column<LocalTime>, TimeFillers<TimeColumn>, TimeFilters, TimeMapFunctions

A column that contains int-encoded local time values
  • Field Details

    • data

      protected it.unimi.dsi.fastutil.ints.IntArrayList data
  • Method Details

    • valueHash

      public int valueHash(int rowNumber)
      Returns an int suitable as a hash for the value in this column at the given index
      Specified by:
      valueHash in interface Column<LocalTime>
    • equals

      public boolean equals(int rowNumber1, int rowNumber2)
      Returns true if the value in this column at rowNumber1 is equal to the value at rowNumber2
      Specified by:
      equals in interface Column<LocalTime>
    • createInternal

      public static TimeColumn createInternal(String name, int[] data)
    • valueIsMissing

      public static boolean valueIsMissing(int i)
    • create

      public static TimeColumn create(String name)
    • create

      public static TimeColumn create(String name, AbstractColumnParser<LocalTime> parser)
    • create

      public static TimeColumn create(String name, Collection<LocalTime> data)
    • create

      public static TimeColumn create(String name, LocalTime... data)
    • create

      public static TimeColumn create(String name, int initialSize)
    • create

      public static TimeColumn create(String name, Stream<LocalTime> stream)
    • appendMissing

      public TimeColumn appendMissing()
      Appends a missing value appropriate to the column
      Specified by:
      appendMissing in interface Column<LocalTime>
    • subset

      public TimeColumn subset(int[] rows)
      Return a column of the same type containing just those elements whose indexes are included in the given array
      Specified by:
      subset in interface Column<LocalTime>
      Overrides:
      subset in class AbstractColumn<TimeColumn,LocalTime>
    • lag

      public TimeColumn lag(int n)
      Returns a column of the same type and size as the receiver, containing the receivers values offset by n.

      For example if you lag a column containing 2, 3, 4 by 1, you get a column containing NA, 2, 3

      Specified by:
      lag in interface Column<LocalTime>
      Specified by:
      lag in interface TimeMapFunctions
    • isMissing

      public boolean isMissing(int rowNumber)
      Returns true if the value at rowNumber is missing
      Specified by:
      isMissing in interface Column<LocalTime>
    • size

      public int size()
      Returns the number of elements in this column, including missing values
      Specified by:
      size in interface Column<LocalTime>
    • appendInternal

      public TimeColumn appendInternal(int f)
    • append

      public TimeColumn append(LocalTime time)
      Appends value to the bottom of this column and return this column
      Specified by:
      append in interface Column<LocalTime>
    • appendObj

      public TimeColumn appendObj(Object obj)
      Appends the given value to the bottom of this column and return this column
      Specified by:
      appendObj in interface Column<LocalTime>
    • removeMissing

      public TimeColumn removeMissing()
      Returns a copy of this column with the missing values removed
      Specified by:
      removeMissing in interface Column<LocalTime>
    • getString

      public String getString(int row)
      Returns a string representation of the value at the given row.
      Specified by:
      getString in interface Column<LocalTime>
      Parameters:
      row - The index of the row.
      Returns:
      value as String
    • getUnformattedString

      public String getUnformattedString(int row)
      Returns a String representation of the value at index r, without any formatting applied
      Specified by:
      getUnformattedString in interface Column<LocalTime>
    • setPrintFormatter

      public void setPrintFormatter(DateTimeFormatter dateTimeFormatter, String missingValueString)
    • setPrintFormatter

      public void setPrintFormatter(DateTimeFormatter dateTimeFormatter)
    • emptyCopy

      public TimeColumn emptyCopy()
      Returns a copy of the receiver with no data. The column name and type are the same.
      Specified by:
      emptyCopy in interface Column<LocalTime>
      Returns:
      a empty copy of Column
    • emptyCopy

      public TimeColumn emptyCopy(int rowSize)
      Returns an empty copy of the receiver, with its internal storage initialized to the given row size.
      Specified by:
      emptyCopy in interface Column<LocalTime>
      Parameters:
      rowSize - the initial row size
      Returns:
      a Column
    • copy

      public TimeColumn copy()
      Returns a deep copy of the receiver
      Specified by:
      copy in interface Column<LocalTime>
      Returns:
      a Column
    • clear

      public void clear()
      Removes all elements TODO: Make this return this column
      Specified by:
      clear in interface Column<LocalTime>
    • asList

      public List<LocalTime> asList()
      Returns the entire contents of this column as a list
      Specified by:
      asList in interface Column<LocalTime>
    • sortAscending

      public void sortAscending()
      Sorts my values in ascending order
      Specified by:
      sortAscending in interface Column<LocalTime>
    • sortDescending

      public void sortDescending()
      Sorts my values in descending order
      Specified by:
      sortDescending in interface Column<LocalTime>
    • max

      public LocalTime max()
    • min

      public LocalTime min()
      Specified by:
      min in interface TimeMapFunctions
    • summary

      public Table summary()
      Returns a table containing a ColumnType specific summary of the data in this column
      Specified by:
      summary in interface Column<LocalTime>
    • countMissing

      public int countMissing()
      Returns the count of missing values in this column
      Specified by:
      countMissing in interface Column<LocalTime>
      Returns:
      missing values as int
    • countUnique

      public int countUnique()
      Returns the count of unique values in this column.
      Specified by:
      countUnique in interface Column<LocalTime>
      Returns:
      unique values as int
    • unique

      public TimeColumn unique()
      Returns a column of the same type containing only the unique values
      Specified by:
      unique in interface Column<LocalTime>
      Returns:
      a Column
    • isEmpty

      public boolean isEmpty()
      Returns true if the column has no data
      Specified by:
      isEmpty in interface Column<LocalTime>
      Returns:
      true if empty, false if not
    • appendCell

      public TimeColumn appendCell(String object)
      Add one element to the bottom of this column and set its value to the parsed value of the given String. Parsing is type-specific
      Specified by:
      appendCell in interface Column<LocalTime>
    • appendCell

      public TimeColumn appendCell(String object, AbstractColumnParser<?> parser)
      Add one element to the bottom of this column and set its value to the parsed value of the given String, as performed by the given parser
      Specified by:
      appendCell in interface Column<LocalTime>
    • getIntInternal

      public int getIntInternal(int index)
      Returns the packed time representation of the value at index
      Specified by:
      getIntInternal in interface TimeFilters
      Specified by:
      getIntInternal in interface TimeMapFunctions
    • getPackedTime

      protected int getPackedTime(int index)
    • get

      public LocalTime get(int index)
      Returns the value at the given zero-based index
      Specified by:
      get in interface Column<LocalTime>
      Specified by:
      get in interface TimeFilters
      Specified by:
      get in interface TimeMapFunctions
    • rowComparator

      public it.unimi.dsi.fastutil.ints.IntComparator rowComparator()
      Returns an IntComparator for sorting my rows
      Specified by:
      rowComparator in interface Column<LocalTime>
    • getDouble

      public double getDouble(int i)
    • asDoubleArray

      public double[] asDoubleArray()
    • asDoubleColumn

      public DoubleColumn asDoubleColumn()
    • toString

      public String toString()
      Overrides:
      toString in class AbstractColumn<TimeColumn,LocalTime>
    • append

      public TimeColumn append(Column<LocalTime> column)
      Appends all the values in the argument to the bottom of this column and return this column
      Specified by:
      append in interface Column<LocalTime>
    • append

      public TimeColumn append(Column<LocalTime> column, int row)
      Appends the value at the given row in the given column to the bottom of this column and return this column
      Specified by:
      append in interface Column<LocalTime>
    • set

      public TimeColumn set(int row, Column<LocalTime> column, int sourceRow)
      Sets the value at row to the value at sourceRow in the given column and return this column
      Specified by:
      set in interface Column<LocalTime>
    • top

      public List<LocalTime> top(int n)
      Returns the largest ("top") n values in the column. Does not change the order in this column
      Parameters:
      n - The maximum number of records to return. The actual number will be smaller if n is greater than the number of observations in the column
      Returns:
      A list, possibly empty, of the largest observations
    • bottom

      public List<LocalTime> bottom(int n)
      Returns the smallest ("bottom") n values in the column, Does not change the order in this column
      Parameters:
      n - The maximum number of records to return. The actual number will be smaller if n is greater than the number of observations in the column
      Returns:
      A list, possibly empty, of the smallest n observations
    • set

      public TimeColumn set(int index, int value)
    • set

      public TimeColumn set(int index, LocalTime value)
      Sets the value at index row to the given value and return this column
      Specified by:
      set in interface Column<LocalTime>
    • set

      public TimeColumn set(Selection rowSelection, LocalTime newValue)
      Conditionally update this column, replacing current values with newValue for all rows where the current value matches the selection criteria

      Example: myColumn.set(myColumn.valueIsMissing(), LocalTime.now()); // no more missing values

      Specified by:
      set in interface Column<LocalTime>
      Overrides:
      set in class AbstractColumn<TimeColumn,LocalTime>
    • intIterator

      public it.unimi.dsi.fastutil.ints.IntIterator intIterator()
    • contains

      public boolean contains(LocalTime time)
      Returns true if the given object appears in this column, and false otherwise

      TODO override in column subtypes for performance

      Specified by:
      contains in interface Column<LocalTime>
    • asSet

      public Set<LocalTime> asSet()
      Description copied from interface: Column
      Returns a Set containing all the unique values in this column
      Specified by:
      asSet in interface Column<LocalTime>
    • setMissing

      public TimeColumn setMissing(int i)
      Sets the value at index i to the missing-value indicator for this column type, and return this column
      Specified by:
      setMissing in interface Column<LocalTime>
    • isMissing

      public Selection isMissing()
      Returns a selection containing an index for every missing value in this column
      Specified by:
      isMissing in interface Column<LocalTime>
    • isNotMissing

      public Selection isNotMissing()
      Returns a selection containing an index for every non-missing value in this column
      Specified by:
      isNotMissing in interface Column<LocalTime>
    • byteSize

      public int byteSize()
      Returns the width of a cell in this column, in bytes.
      Specified by:
      byteSize in interface Column<LocalTime>
      Returns:
      width in bytes
    • asBytes

      public byte[] asBytes(int rowNumber)
      Returns the contents of the cell at rowNumber as a byte[]
      Specified by:
      asBytes in interface Column<LocalTime>
      Parameters:
      rowNumber - index of the row
      Returns:
      content as byte[]
    • iterator

      public Iterator<LocalTime> iterator()
      Returns an iterator over elements of type T.
      Specified by:
      iterator in interface Iterable<LocalTime>
      Returns:
      an Iterator.
    • where

      public TimeColumn where(Selection selection)
      Returns a new column containing the subset referenced by the Selection
      Specified by:
      where in interface Column<LocalTime>
      Specified by:
      where in interface TimeFilters
    • asObjectArray

      public LocalTime[] asObjectArray()
      Description copied from interface: Column
      Returns an array of objects as appropriate for my type of column
      Specified by:
      asObjectArray in interface Column<LocalTime>
    • fillWith

      public TimeColumn fillWith(Iterator<LocalTime> iterator)
      Specified by:
      fillWith in interface TimeFillers<TimeColumn>
    • fillWith

      public TimeColumn fillWith(Iterable<LocalTime> iterable)
      Specified by:
      fillWith in interface TimeFillers<TimeColumn>
    • fillWith

      public TimeColumn fillWith(Supplier<LocalTime> supplier)
      Specified by:
      fillWith in interface TimeFillers<TimeColumn>
    • compare

      public int compare(LocalTime o1, LocalTime o2)
      Specified by:
      compare in interface Comparator<LocalTime>