diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/storage/Storage.java b/std-bits/table/src/main/java/org/enso/table/data/column/storage/Storage.java index 62c0baa7a3f7a..99fbaf33b17b8 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/storage/Storage.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/storage/Storage.java @@ -16,23 +16,15 @@ import java.util.function.BiFunction; import java.util.function.Function; -/** - * An abstract representation of a data column. - */ +/** An abstract representation of a data column. */ public abstract class Storage { - /** - * @return the number of elements in this column (including NAs) - */ + /** @return the number of elements in this column (including NAs) */ public abstract int size(); - /** - * @return the number of NA elements in this column - */ + /** @return the number of NA elements in this column */ public abstract int countMissing(); - /** - * @return the type tag of this column's storage. - */ + /** @return the type tag of this column's storage. */ public abstract StorageType getType(); /** @@ -51,9 +43,7 @@ public abstract class Storage { */ public abstract T getItemBoxed(int idx); - /** - * A container for names of vectorizable operation. - */ + /** A container for names of vectorizable operation. */ public static final class Maps { public static final String EQ = "=="; public static final String LT = "<"; @@ -96,15 +86,16 @@ protected abstract Storage runVectorizedZip( /** * Runs a function on each non-missing element in this storage and gathers the results. * - * @param name a name of potential vectorized variant of the function that should be used if supported. - * If this argument is null, the vectorized operation will never be used. - * @param function the function to run. - * @param argument the argument to pass to each run of the function - * @param skipNulls specifies whether null values on the input should result in a null result without passing - * them through the function, this is useful if the function does not support the - * null-values, but it needs to be set to false if the function should handle them. - * @param expectedResultType the expected type for the result storage; it is ignored if the operation is vectorized - * @param problemBuilder a builder for reporting computation problems + * @param name a name of potential vectorized variant of the function that should be used if + * supported. If this argument is null, the vectorized operation will never be used. + * @param function the function to run. + * @param argument the argument to pass to each run of the function + * @param skipNulls specifies whether null values on the input should result in a null result + * without passing them through the function, this is useful if the function does not support + * the null-values, but it needs to be set to false if the function should handle them. + * @param expectedResultType the expected type for the result storage; it is ignored if the + * operation is vectorized + * @param problemBuilder a builder for reporting computation problems * @return the result of running the function on all non-missing elements. */ public final Storage bimap( @@ -142,12 +133,13 @@ public final Storage bimap( /** * Runs a function on each non-missing element in this storage and gathers the results. * - * @param name a name of potential vectorized variant of the function that should be used if supported. - * If this argument is null, the vectorized operation will never be used. - * @param function the function to run. - * @param onMissing the value to place for missing cells, usually just null - * @param expectedResultType the expected type for the result storage; it is ignored if the operation is vectorized - * @param problemBuilder a builder for reporting computation problems + * @param name a name of potential vectorized variant of the function that should be used if + * supported. If this argument is null, the vectorized operation will never be used. + * @param function the function to run. + * @param onMissing the value to place for missing cells, usually just null + * @param expectedResultType the expected type for the result storage; it is ignored if the + * operation is vectorized + * @param problemBuilder a builder for reporting computation problems * @return the result of running the function on all non-missing elements. */ public final Storage map( @@ -181,12 +173,13 @@ public final Storage map( /** * Runs a function on each pair of non-missing elements in this and arg. * - * @param name a name of potential vectorized variant of the function that should be used if supported. - * If this argument is null, the vectorized operation will never be used. - * @param function the function to run. - * @param skipNa whether rows containing missing values should be passed to the function. - * @param expectedResultType the expected type for the result storage; it is ignored if the operation is vectorized - * @param problemBuilder the builder used for reporting computation problems + * @param name a name of potential vectorized variant of the function that should be used if + * supported. If this argument is null, the vectorized operation will never be used. + * @param function the function to run. + * @param skipNa whether rows containing missing values should be passed to the function. + * @param expectedResultType the expected type for the result storage; it is ignored if the + * operation is vectorized + * @param problemBuilder the builder used for reporting computation problems * @return the result of running the function on all non-missing elements. */ public final Storage zip( @@ -217,17 +210,23 @@ public final Storage zip( return storageBuilder.seal(); } - private static void checkFallback(Object fallback, StorageType storageType, String operationName) throws IllegalArgumentException { + private static void checkFallback(Object fallback, StorageType storageType, String operationName) + throws IllegalArgumentException { if (fallback == null) { if (operationName == null) { - throw new IllegalArgumentException("A function or name of vectorized operation must be specified. This is a bug in the Table library."); + throw new IllegalArgumentException( + "A function or name of vectorized operation must be specified. This is a bug in the Table library."); } else { - throw new IllegalArgumentException("The operation " + operationName + " has no vectorized implementation for this storage type, but no fallback function was provided. This is a bug in the Table library."); + throw new IllegalArgumentException( + "The operation " + + operationName + + " has no vectorized implementation for this storage type, but no fallback function was provided. This is a bug in the Table library."); } } if (storageType == null) { - throw new IllegalArgumentException("The expected result type must be specified if a fallback function is used. This is a bug in the Table library."); + throw new IllegalArgumentException( + "The expected result type must be specified if a fallback function is used. This is a bug in the Table library."); } } @@ -276,7 +275,7 @@ protected final Storage fillMissingHelper(Value arg, Builder builder) { /** * Return a new storage, containing only the items marked true in the mask. * - * @param mask the mask to use + * @param mask the mask to use * @param cardinality the number of true values in mask * @return a new storage, masked with the given mask */ @@ -290,24 +289,24 @@ protected final Storage fillMissingHelper(Value arg, Builder builder) { public abstract Storage applyMask(OrderMask mask); /** - * Returns a new storage, resulting from applying the rules specified in a mask. The resulting storage should contain - * the elements of the original storage, in the same order. However, the number of consecutive copies of the i-th - * element of the original storage should be {@code counts[i]}. + * Returns a new storage, resulting from applying the rules specified in a mask. The resulting + * storage should contain the elements of the original storage, in the same order. However, the + * number of consecutive copies of the i-th element of the original storage should be {@code + * counts[i]}. * * @param counts the mask specifying elements duplication - * @param total the sum of all elements in the mask, also interpreted as the length of the resulting storage + * @param total the sum of all elements in the mask, also interpreted as the length of the + * resulting storage * @return the storage masked according to the specified rules */ public abstract Storage countMask(int[] counts, int total); - /** - * @return a copy of the storage containing a slice of the original data - */ + /** @return a copy of the storage containing a slice of the original data */ public abstract Storage slice(int offset, int limit); /** - * @return a new storage instance, containing the same elements as this one, with {@code count} nulls appended at the - * end + * @return a new storage instance, containing the same elements as this one, with {@code count} + * nulls appended at the end */ public Storage appendNulls(int count) { Builder builder = new InferredBuilder(size() + count); @@ -323,9 +322,7 @@ public Storage appendNulls(int count) { */ public abstract Builder createDefaultBuilderOfSameType(int capacity); - /** - * @return a copy of the storage consisting of slices of the original data - */ + /** @return a copy of the storage consisting of slices of the original data */ public abstract Storage slice(List ranges); public List toList() {