Skip to content

Commit

Permalink
Removed unused class StructureSequence.
Browse files Browse the repository at this point in the history
It's been logically unused for a while, and physically unused now that I got rid of the `@AutoCodec` annotation (9491df0).

PiperOrigin-RevId: 432962874
  • Loading branch information
haxorz authored and copybara-github committed Mar 7, 2022
1 parent 82d16f2 commit 3b57ffa
Showing 1 changed file with 1 addition and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -968,56 +968,6 @@ public int hashCode() {
}
}

/**
* A sequence of structure values. Exists as a memory optimization - a typical build can contain
* millions of feature values, so getting rid of the overhead of {@code StructureValue} objects
* significantly reduces memory overhead.
*/
@Immutable
private static final class StructureSequence extends VariableValueAdapter {
private final ImmutableList<ImmutableMap<String, VariableValue>> values;

private StructureSequence(ImmutableList<ImmutableMap<String, VariableValue>> values) {
Preconditions.checkNotNull(values);
this.values = values;
}

@Override
public Iterable<? extends VariableValue> getSequenceValue(String variableName) {
final ImmutableList.Builder<VariableValue> sequences = ImmutableList.builder();
for (ImmutableMap<String, VariableValue> value : values) {
sequences.add(new StructureValue(value));
}
return sequences.build();
}

@Override
public String getVariableTypeName() {
return Sequence.SEQUENCE_VARIABLE_TYPE_NAME;
}

@Override
public boolean isTruthy() {
return !values.isEmpty();
}

@Override
public boolean equals(Object other) {
if (!(other instanceof StructureSequence)) {
return false;
}
if (this == other) {
return true;
}
return Objects.equals(values, ((StructureSequence) other).values);
}

@Override
public int hashCode() {
return values.hashCode();
}
}

/**
* A sequence of simple string values. Exists as a memory optimization - a typical build can
* contain millions of feature values, so getting rid of the overhead of {@code StringValue}
Expand Down Expand Up @@ -1135,7 +1085,7 @@ public int hashCode() {

/**
* Single structure value. Be careful not to create sequences of single structures, as the memory
* overhead is prohibitively big. Use optimized {@link StructureSequence} instead.
* overhead is prohibitively big.
*/
@Immutable
private static final class StructureValue extends VariableValueAdapter {
Expand Down

0 comments on commit 3b57ffa

Please sign in to comment.