Package edu.uky.ai.util
Class Table.Sequence
java.lang.Object
edu.uky.ai.util.Table.Sequence
- All Implemented Interfaces:
java.lang.Iterable<Table.Cell>
- Direct Known Subclasses:
Table.Column
,Table.Row
- Enclosing class:
- Table
public abstract static class Table.Sequence extends java.lang.Object implements java.lang.Iterable<Table.Cell>
The abstract parent of
Table.Row
and Table.Column
.- Author:
- Stephen G. Ware
-
Field Summary
Fields Modifier and Type Field Description ImmutableArray<Table.Cell>
cells
The cells that make up this row or columnjava.lang.Object
label
The row or column lable of this sequenceint
number
The row or column number of this sequenceTable
table
The table this sequence belongs to -
Method Summary
Modifier and Type Method Description java.lang.Number
average()
Returns the average of the numeric elements of this sequence (non-numeric values are ignored).java.lang.Number
average(java.util.function.Function<java.lang.Object,?> function)
Returns the average of the numeric elements of this sequence (non-numeric values are ignored).int
hashCode()
java.util.Iterator<Table.Cell>
iterator()
java.lang.Number
sum()
Returns the sum of the numeric elements of this sequence (non-numeric values are ignored).java.lang.Number
sum(java.util.function.Function<java.lang.Object,?> function)
Returns the sum of the numeric elements of this sequence (non-numeric values are ignored).
-
Field Details
-
Method Details
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
iterator
- Specified by:
iterator
in interfacejava.lang.Iterable<Table.Cell>
-
sum
public java.lang.Number sum(java.util.function.Function<java.lang.Object,?> function)Returns the sum of the numeric elements of this sequence (non-numeric values are ignored).- Parameters:
function
- a function for converting the values of the cells in this sequence toNumber
s that will be applied to each cell value before adding it to the sum- Returns:
- the sum of the cell values
-
sum
public java.lang.Number sum()Returns the sum of the numeric elements of this sequence (non-numeric values are ignored).- Returns:
- the sum of the cell values
-
average
public java.lang.Number average(java.util.function.Function<java.lang.Object,?> function)Returns the average of the numeric elements of this sequence (non-numeric values are ignored).- Parameters:
function
- a function for converting the values of the cells in this sequence toNumber
s that will be applied to each cell value before including it in the average- Returns:
- the average of the cell values
-
average
public java.lang.Number average()Returns the average of the numeric elements of this sequence (non-numeric values are ignored).- Returns:
- the average of the cell values
-