Class DoubleColumn

    • Field Detail

      • data

        protected final it.unimi.dsi.fastutil.doubles.DoubleArrayList data
    • Constructor Detail

      • DoubleColumn

        protected DoubleColumn​(String name,
                               it.unimi.dsi.fastutil.doubles.DoubleArrayList data)
      • DoubleColumn

        protected DoubleColumn​(String name)
    • Method Detail

      • valueIsMissing

        public static boolean valueIsMissing​(double value)
      • clear

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

        public DoubleColumn setMissing​(int index)
        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<Double>
      • get

        public Double get​(int index)
        Returns the value at the given zero-based index
        Specified by:
        get in interface Column<Double>
      • isNotIn

        public Selection isNotIn​(double... doubles)
      • isIn

        public Selection isIn​(double... doubles)
      • top

        public DoubleColumn top​(int n)
        Returns the largest ("top") n values in the column TODO(lwhite): Consider whether this should exclude missing
        Specified by:
        top in class NumberColumn<DoubleColumn,​Double>
        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 DoubleColumn bottom​(int n)
        Returns the smallest ("bottom") n values in the column TODO(lwhite): Consider whether this should exclude missing
        Specified by:
        bottom in class NumberColumn<DoubleColumn,​Double>
        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
      • lag

        public DoubleColumn 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<Double>
        Specified by:
        lag in interface NumericColumn<Double>
      • append

        public DoubleColumn append​(float f)
        Adds the given float to this column
      • append

        public DoubleColumn append​(double d)
        Adds the given double to this column
      • 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<Double>
      • 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<Double>
      • asObjectArray

        public Double[] asObjectArray()
        Returns an array of objects as appropriate for my type of column
        Specified by:
        asObjectArray in interface Column<Double>
      • set

        public DoubleColumn set​(int i,
                                Double val)
        Sets the value at index row to the given value and return this column
        Specified by:
        set in interface Column<Double>
      • set

        public DoubleColumn set​(DoublePredicate condition,
                                NumericColumn<?> other)
        Updates this column where values matching the selection are replaced with the corresponding value from the given column
      • append

        public DoubleColumn append​(Column<Double> 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<Double>
      • set

        public DoubleColumn set​(int row,
                                Column<Double> 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<Double>
      • filter

        public DoubleColumn filter​(DoublePredicate test)
        Returns a new NumberColumn with only those rows satisfying the predicate
        Parameters:
        test - the predicate
        Returns:
        a new NumberColumn with only those rows satisfying the predicate
      • asBytes

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

        public Set<Double> asSet()
        Returns a Set containing all the unique values in this column
        Specified by:
        asSet in interface Column<Double>
      • countUnique

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

        public boolean isMissingValue​(double value)
      • sortAscending

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

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

        public DoubleColumn appendCell​(String value)
        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<Double>
      • 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<Double>
      • asLongColumn

        public LongColumn asLongColumn()
        Returns a new LongColumn containing a value for each value in this column, truncating if necessary

        A narrowing primitive conversion such as this one may lose information about the overall magnitude of a numeric value and may also lose precision and range. Specifically, if the value is too small (a negative value of large magnitude or negative infinity), the result is the smallest representable value of type long.

        Similarly, if the value is too large (a positive value of large magnitude or positive infinity), the result is the largest representable value of type long.

        Despite the fact that overflow, underflow, or other loss of information may occur, a narrowing primitive conversion never results in a run-time exception.

        A missing value in the receiver is converted to a missing value in the result

        Specified by:
        asLongColumn in interface NumericColumn<Double>
      • asIntColumn

        public IntColumn asIntColumn()
        Returns a new IntColumn containing a value for each value in this column, truncating if necessary.

        A narrowing primitive conversion such as this one may lose information about the overall magnitude of a numeric value and may also lose precision and range. Specifically, if the value is too small (a negative value of large magnitude or negative infinity), the result is the smallest representable value of type int.

        Similarly, if the value is too large (a positive value of large magnitude or positive infinity), the result is the largest representable value of type int.

        Despite the fact that overflow, underflow, or other loss of information may occur, a narrowing primitive conversion never results in a run-time exception.

        A missing value in the receiver is converted to a missing value in the result

        Specified by:
        asIntColumn in interface NumericColumn<Double>
      • asShortColumn

        public ShortColumn asShortColumn()
        Returns a new ShortColumn containing a value for each value in this column, truncating if necessary.

        A narrowing primitive conversion such as this one may lose information about the overall magnitude of a numeric value and may also lose precision and range. Specifically, if the value is too small (a negative value of large magnitude or negative infinity), the result is the smallest representable value of type int.

        Similarly, if the value is too large (a positive value of large magnitude or positive infinity), the result is the largest representable value of type short.

        Despite the fact that overflow, underflow, or other loss of information may occur, a narrowing primitive conversion never results in a run-time exception.

        A missing value in the receiver is converted to a missing value in the result

        Specified by:
        asShortColumn in interface NumericColumn<Double>
      • asFloatColumn

        public FloatColumn asFloatColumn()
        Returns a new FloatColumn containing a value for each value in this column, truncating if necessary.

        A narrowing primitive conversion such as this one may lose information about the overall magnitude of a numeric value and may also lose precision and range. Specifically, if the value is too small (a negative value of large magnitude or negative infinity), the result is the smallest representable value of type float.

        Similarly, if the value is too large (a positive value of large magnitude or positive infinity), the result is the largest representable value of type float.

        Despite the fact that overflow, underflow, or other loss of information may occur, a narrowing primitive conversion never results in a run-time exception.

        A missing value in the receiver is converted to a missing value in the result

        Specified by:
        asFloatColumn in interface NumericColumn<Double>