Skip to content

Commit

Permalink
Revert getBoxed to getItemBoxed.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdunkerley committed Jan 26, 2025
1 parent d8783ef commit 1af40f2
Show file tree
Hide file tree
Showing 80 changed files with 170 additions and 170 deletions.
8 changes: 4 additions & 4 deletions distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,7 @@ type Column

builder = make_string_builder length
0.up_to length . each i->
replaced = do_replace i (storage.getBoxed i)
replaced = do_replace i (storage.getItemBoxed i)
builder.append replaced

Column.from_storage new_name builder.seal
Expand Down Expand Up @@ -2294,7 +2294,7 @@ type Column
valid_index = (index >= 0) && (index < self.length)
if valid_index.not then default else
storage = self.java_column.getStorage
java_to_enso <| storage.getBoxed index
java_to_enso <| storage.getItemBoxed index

## PRIVATE
ICON data_input
Expand Down Expand Up @@ -2363,7 +2363,7 @@ type Column
to_js_object self =
name = self.java_column.getName
storage = self.java_column.getStorage
storage_proxy = Array_Proxy.new storage.getSize i-> storage.getBoxed i
storage_proxy = Array_Proxy.new storage.getSize i-> storage.getItemBoxed i
storage_json = Vector.from_polyglot_array storage_proxy
JS_Object.from_pairs [["name", name], ["data", storage_json]]

Expand Down Expand Up @@ -2859,7 +2859,7 @@ wrap_text_argument_as_value_provider val =
text : Text -> (_-> text)
col : Column ->
storage = col.java_column.getStorage
i-> storage.getBoxed i
i-> storage.getItemBoxed i

## PRIVATE
wrap_text_or_regex_argument_as_value_provider val =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ map_over_storage input_column function builder skip_nothing=True on_problems:Pro
num_input_rows = input_storage.getSize
output_storage_builder = builder num_input_rows
0.up_to num_input_rows . each i->
input_value = input_storage.getBoxed i
input_value = input_storage.getItemBoxed i
if skip_nothing && input_value.is_nothing then output_storage_builder.append Nothing else
output_value = function input_value . catch Any err->
problem_builder.report_other_warning err
Expand All @@ -41,8 +41,8 @@ map_2_over_storage input_column_0 input_column_1 function builder skip_nothing=T
num_input_rows = input_storage_0.getSize
output_storage_builder = builder num_input_rows
ok = 0.up_to num_input_rows . each_propagate i->
input_value_0 = input_storage_0.getBoxed i
input_value_1 = input_storage_1.getBoxed i
input_value_0 = input_storage_0.getItemBoxed i
input_value_1 = input_storage_1.getItemBoxed i
if skip_nothing && input_value_0.is_nothing then output_storage_builder.append Nothing else
output_value = function input_value_0 input_value_1
output_storage_builder.append output_value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ansi_bold enabled txt =
## PRIVATE
Gets a textual representation of the item at position `ix` in `storage`.
private _get_item_as_text storage ix =
item = storage.getBoxed ix
item = storage.getItemBoxed ix
## Special handling for display of Text to avoid quotes when not necessary.
case item of
_ : Text -> _normalize_text_for_display item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ fan_out_to_rows_and_columns_fixed input_storage function at_least_one_row:Boolea
maybe_add_empty_row vecs = if vecs.is_empty && at_least_one_row then empty_row else vecs

0.up_to num_input_rows . each i->
input_value = input_storage.getBoxed i
input_value = input_storage.getItemBoxed i
output_values = maybe_add_empty_row (function input_value)

output_values.each row_unchecked->
Expand Down Expand Up @@ -192,7 +192,7 @@ fan_out_to_rows_and_columns_dynamic input_storage function at_least_one_row colu
[Vector.fill output_column_builders.length Nothing]

0.up_to num_input_rows . each i->
input_value = input_storage.getBoxed i
input_value = input_storage.getItemBoxed i
output_values = maybe_add_empty_row (function input_value)

# get the column names for the row.
Expand Down Expand Up @@ -250,7 +250,7 @@ map_columns_to_multiple input_column function column_count column_builder=make_s
builders = Builder.new

0.up_to num_rows . each i->
input_value = input_storage.getBoxed i
input_value = input_storage.getItemBoxed i
output_values = function input_value

# Add more builders if necessary to accommodate `output_values`.
Expand All @@ -276,7 +276,7 @@ map_columns_to_multiple input_column function column_count column_builder=make_s
builders = Vector.new column_count (_-> column_builder num_rows)

output_lengths = 0.up_to num_rows . map i->
input_value = input_storage.getBoxed i
input_value = input_storage.getItemBoxed i
output_values = function input_value

## Add `output_values` to builders; if there are more builders
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Object aggregate(List<Integer> indexes, ProblemAggregator problemAggregat
Context context = Context.getCurrent();
StringBuilder current = null;
for (int row : indexes) {
Object value = storage.getBoxed(row);
Object value = storage.getItemBoxed(row);
if (value == null || value instanceof String) {
String textValue = toQuotedString(value, quote, separator);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Object aggregate(List<Integer> indexes, ProblemAggregator problemAggregat
Context context = Context.getCurrent();
int count = 0;
for (int row : indexes) {
Object value = storage.getBoxed(row);
Object value = storage.getItemBoxed(row);
if (value == null) {
count += isEmpty ? 1 : 0;
} else if (value instanceof String asString) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public Object aggregate(List<Integer> indexes, ProblemAggregator problemAggregat
Context context = Context.getCurrent();
long count = 0;
for (int row : indexes) {
count += ((storage.getBoxed(row) == null) == isNothing ? 1L : 0L);
count += ((storage.getItemBoxed(row) == null) == isNothing ? 1L : 0L);
context.safepoint();
}
return count;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private Object firstBySpecifiedOrder(List<Integer> indexes) {

Context context = Context.getCurrent();
for (int row : indexes) {
Object value = storage.getBoxed(row);
Object value = storage.getItemBoxed(row);
if (ignoreNothing && value == null) {
continue;
}
Expand All @@ -62,7 +62,7 @@ private Object firstBySpecifiedOrder(List<Integer> indexes) {
new OrderedMultiValueKey(this.orderByColumns, row, this.orderByDirections);
if (key == null || key.compareTo(newKey) > 0) {
key = newKey;
current = storage.getBoxed(row);
current = storage.getItemBoxed(row);
}

context.safepoint();
Expand All @@ -74,7 +74,7 @@ private Object firstBySpecifiedOrder(List<Integer> indexes) {
private Object firstByRowOrder(List<Integer> indexes) {
Context context = Context.getCurrent();
for (int row : indexes) {
Object value = storage.getBoxed(row);
Object value = storage.getItemBoxed(row);
if (!ignoreNothing || value != null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ public GroupBy(String name, Column column) {

@Override
public Object aggregate(List<Integer> indexes, ProblemAggregator problemAggregator) {
return indexes.isEmpty() ? null : storage.getBoxed(indexes.get(0));
return indexes.isEmpty() ? null : storage.getItemBoxed(indexes.get(0));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private Object lastBySpecifiedOrder(List<Integer> indexes) {
Context context = Context.getCurrent();
for (int i = indexes.size() - 1; i >= 0; i--) {
int row = indexes.get(i);
Object value = storage.getBoxed(row);
Object value = storage.getItemBoxed(row);
if (ignoreNothing && value == null) {
continue;
}
Expand All @@ -62,7 +62,7 @@ private Object lastBySpecifiedOrder(List<Integer> indexes) {
new OrderedMultiValueKey(this.orderByColumns, row, this.orderByDirections);
if (key == null || key.compareTo(newKey) < 0) {
key = newKey;
current = storage.getBoxed(row);
current = storage.getItemBoxed(row);
}

context.safepoint();
Expand All @@ -74,7 +74,7 @@ private Object lastBySpecifiedOrder(List<Integer> indexes) {
private Object lastByRowOrder(List<Integer> indexes) {
Context context = Context.getCurrent();
for (int i = indexes.size() - 1; i >= 0; i--) {
Object value = storage.getBoxed(indexes.get(i));
Object value = storage.getItemBoxed(indexes.get(i));
if (!ignoreNothing || value != null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void accumulate(
ColumnAggregatedProblemAggregator innerAggregator =
new ColumnAggregatedProblemAggregator(problemAggregator);
for (int i : indexes) {
Object value = storage.getBoxed(i);
Object value = storage.getItemBoxed(i);
if (value != null) {
Double dValue = NumericConverter.tryConvertingToDouble(value);
if (dValue == null) {
Expand Down Expand Up @@ -136,7 +136,7 @@ void accumulate(
new ColumnAggregatedProblemAggregator(problemAggregator);
Context context = Context.getCurrent();
for (int i : indexes) {
Object value = storage.getBoxed(i);
Object value = storage.getItemBoxed(i);
if (value != null) {
try {
BigDecimal valueAsBigDecimal = NumericConverter.coerceToBigDecimal(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public Object aggregate(List<Integer> indexes, ProblemAggregator problemAggregat
Context context = Context.getCurrent();
Object current = null;
for (int row : indexes) {
Object value = storage.getBoxed(row);
Object value = storage.getItemBoxed(row);
if (value != null) {
try {
if (current == null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Object aggregate(List<Integer> indexes, ProblemAggregator problemAggregat
int count = 0;
Map<Object, Integer> currentMap = null;
for (int row : indexes) {
Object value = storage.getBoxed(row);
Object value = storage.getItemBoxed(row);
if (value != null) {
// Merge all numbers onto a Long if possible or a Double if needed
Long lValue = NumericConverter.tryConvertingToLong(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public Object aggregate(List<Integer> indexes, ProblemAggregator problemAggregat
int count = 0;
SortedMap<Double, Integer> currentMap = new TreeMap<>();
for (int row : indexes) {
Object value = storage.getBoxed(row);
Object value = storage.getItemBoxed(row);
if (value != null) {
Double dValue = NumericConverter.tryConvertingToDouble(value);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public Object aggregate(List<Integer> indexes, ProblemAggregator problemAggregat
Object current = null;

for (int row : indexes) {
Object value = storage.getBoxed(row);
Object value = storage.getItemBoxed(row);
if (value != null) {
if (!(value instanceof String asString)) {
innerAggregator.reportColumnAggregatedProblem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public Object aggregate(List<Integer> indexes, ProblemAggregator problemAggregat
Context context = Context.getCurrent();
Calculation current = null;
for (int row : indexes) {
Object value = storage.getBoxed(row);
Object value = storage.getItemBoxed(row);
if (value != null) {
Double dValue = NumericConverter.tryConvertingToDouble(value);
if (dValue == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ void accumulate(List<Integer> indexes, Storage<?> storage) {
}
} else if (storage instanceof BigIntegerStorage bigIntegerStorage) {
for (int row : indexes) {
BigInteger value = bigIntegerStorage.getBoxed(row);
BigInteger value = bigIntegerStorage.getItemBoxed(row);
if (value != null) {
addBigInteger(value);
}
context.safepoint();
}
} else {
for (int row : indexes) {
add(storage.getBoxed(row));
add(storage.getItemBoxed(row));
context.safepoint();
}
}
Expand Down Expand Up @@ -177,7 +177,7 @@ void accumulate(List<Integer> indexes, Storage<?> storage) {
}
} else {
for (int row : indexes) {
add(storage.getBoxed(row));
add(storage.getItemBoxed(row));
context.safepoint();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void appendBulkStorage(Storage<?> storage) {
if (storage.getType() instanceof DateType) {
Context context = Context.getCurrent();
for (long i = 0; i < storage.getSize(); ++i) {
var date = storage.getBoxed(i);
var date = storage.getItemBoxed(i);
if (date == null) {
appendNulls(1);
} else if (date instanceof LocalDate localDate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void appendBulkStorage(Storage<?> storage) {
if (storage instanceof BigIntegerStorage bigIntegerStorage) {
long n = bigIntegerStorage.getSize();
for (long i = 0; i < n; i++) {
BigInteger item = bigIntegerStorage.getBoxed(i);
BigInteger item = bigIntegerStorage.getItemBoxed(i);
if (item == null) {
appendNulls(1);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void appendBulkStorage(Storage<?> storage) {
appendNulls(Math.toIntExact(storage.getSize()));
} else {
for (long i = 0; i < storage.getSize(); i++) {
append(storage.getBoxed(i));
append(storage.getItemBoxed(i));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void appendBulkStorage(Storage<?> storage) {
appendNulls(Math.toIntExact(storage.getSize()));
} else {
for (long i = 0; i < storage.getSize(); i++) {
append(storage.getBoxed(i));
append(storage.getItemBoxed(i));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void appendBulkStorage(Storage<?> storage) {
for (long i = 0; i < storage.getSize(); i++) {
if (!storage.isNothing(i)) {
throw new IllegalArgumentException(
"NullBuilder can only append nulls, but got " + storage.getBoxed(i));
"NullBuilder can only append nulls, but got " + storage.getItemBoxed(i));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void appendBulkStorage(Storage<?> storage) {
} else {
long n = storage.getSize();
for (long i = 0; i < n; i++) {
append(storage.getBoxed(i));
append(storage.getItemBoxed(i));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static long compute(ColumnStorage<?> storage, long sampleSize, Context co
var rng = new Random(RANDOM_SEED);
for (int i = 0; i < sampleSize; i++) {
long idx = rng.nextLong(size);
var val = storage.getBoxed(idx);
var val = storage.getItemBoxed(idx);
if (val instanceof String str && Text_Utils.has_leading_trailing_whitespace(str)) {
count++;
}
Expand All @@ -50,7 +50,7 @@ public static long compute(ColumnStorage<?> storage, long sampleSize, Context co
count = Math.min(size, (long) Math.ceil((double) count / sampleSize * size));
} else {
for (long i = 0; i < storage.getSize(); i++) {
var val = storage.getBoxed(i);
var val = storage.getItemBoxed(i);
if (val instanceof String str && Text_Utils.has_leading_trailing_whitespace(str)) {
count++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static Column mapFunction(
nothingUnchanged,
storageBuilder,
i -> {
Value result = function.apply(column.getStorage().getBoxed(i));
Value result = function.apply(column.getStorage().getItemBoxed(i));
Object converted = Polyglot_Utils.convertPolyglotValue(result);
storageBuilder.append(converted);
});
Expand Down Expand Up @@ -116,7 +116,7 @@ static void applyOverObjectStorage(
Builder builder,
Consumer<Object> function) {
applyStorageInner(
objectStorage, nothingUnchanged, builder, i -> function.accept(objectStorage.getBoxed(i)));
objectStorage, nothingUnchanged, builder, i -> function.accept(objectStorage.getItemBoxed(i)));
}

/** Applies the operation to the given Boolean Storage. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private Storage<BigDecimal> convertBigIntegerStorage(
Builder.getForBigDecimal(bigIntegerStorage.getSize()),
bigIntegerStorage,
(i) -> {
BigInteger x = bigIntegerStorage.getBoxed(i);
BigInteger x = bigIntegerStorage.getItemBoxed(i);
return new BigDecimal(x);
});
}
Expand All @@ -87,7 +87,7 @@ private Storage<BigDecimal> castFromMixed(
Builder.getForBigDecimal(storage.getSize()),
storage,
(i) -> {
Object o = storage.getBoxed(i);
Object o = storage.getItemBoxed(i);
return switch (o) {
case Boolean b -> booleanAsBigDecimal(b);
case Long l -> BigDecimal.valueOf(l);
Expand Down
Loading

0 comments on commit 1af40f2

Please sign in to comment.