Skip to content

Commit

Permalink
SpreadsheetCellFindQuery was SpreadsheetCellQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
mP1 committed Nov 9, 2024
1 parent 9537ef5 commit d7e8ec7
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 133 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@
/**
* Captures the parameter values of a cell find.
*/
public final class SpreadsheetCellQuery implements HasUrlFragment,
public final class SpreadsheetCellFindQuery implements HasUrlFragment,
CanBeEmpty,
HasText {

/**
* Parses the given text into a {@link SpreadsheetCellQuery}.
* Parses the given text into a {@link SpreadsheetCellFindQuery}.
* <br>
* Note the query is not verified to be a valid expression syntically in any form.
*/
public static SpreadsheetCellQuery parse(final String text) {
public static SpreadsheetCellFindQuery parse(final String text) {
Objects.requireNonNull(text, "text");

return extract(
Expand All @@ -65,9 +65,9 @@ public static SpreadsheetCellQuery parse(final String text) {
}

/**
* Reads or extracts a {@link SpreadsheetCellQuery} from the parameters probably a {@link UrlQueryString}.
* Reads or extracts a {@link SpreadsheetCellFindQuery} from the parameters probably a {@link UrlQueryString}.
*/
public static SpreadsheetCellQuery extract(final Map<HttpRequestAttribute<?>, ?> parameters) {
public static SpreadsheetCellFindQuery extract(final Map<HttpRequestAttribute<?>, ?> parameters) {
Objects.requireNonNull(parameters, "parameters");

return empty()
Expand Down Expand Up @@ -132,11 +132,11 @@ private static String invalidQueryParameterMessage(final String text,
return "Invalid " + parameter + "=" + CharSequences.quoteAndEscape(text);
}

public static SpreadsheetCellQuery empty() {
public static SpreadsheetCellFindQuery empty() {
return EMPTY;
}

private final static SpreadsheetCellQuery EMPTY = new SpreadsheetCellQuery(
private final static SpreadsheetCellFindQuery EMPTY = new SpreadsheetCellFindQuery(
Optional.empty(), // path
OptionalInt.empty(), // offset
OptionalInt.empty(), // max
Expand All @@ -145,11 +145,11 @@ public static SpreadsheetCellQuery empty() {
);

// VisibleForTesting
SpreadsheetCellQuery(final Optional<SpreadsheetCellRangeReferencePath> path,
final OptionalInt offset,
final OptionalInt max,
final Optional<String> valueType,
final Optional<String> query) {
SpreadsheetCellFindQuery(final Optional<SpreadsheetCellRangeReferencePath> path,
final OptionalInt offset,
final OptionalInt max,
final Optional<String> valueType,
final Optional<String> query) {
this.path = path;
this.offset = offset;
this.max = max;
Expand All @@ -161,7 +161,7 @@ public Optional<SpreadsheetCellRangeReferencePath> path() {
return this.path;
}

public SpreadsheetCellQuery setPath(final Optional<SpreadsheetCellRangeReferencePath> path) {
public SpreadsheetCellFindQuery setPath(final Optional<SpreadsheetCellRangeReferencePath> path) {
Objects.requireNonNull(path, "path");

return this.path.equals(path) ?
Expand All @@ -181,7 +181,7 @@ public OptionalInt offset() {
return this.offset;
}

public SpreadsheetCellQuery setOffset(final OptionalInt offset) {
public SpreadsheetCellFindQuery setOffset(final OptionalInt offset) {
Objects.requireNonNull(offset, "offset");

return this.offset.equals(offset) ?
Expand All @@ -201,7 +201,7 @@ public OptionalInt max() {
return this.max;
}

public SpreadsheetCellQuery setMax(final OptionalInt max) {
public SpreadsheetCellFindQuery setMax(final OptionalInt max) {
Objects.requireNonNull(max, "max");

return this.max.equals(max) ?
Expand All @@ -221,7 +221,7 @@ public Optional<String> valueType() {
return this.valueType;
}

public SpreadsheetCellQuery setValueType(final Optional<String> valueType) {
public SpreadsheetCellFindQuery setValueType(final Optional<String> valueType) {
Objects.requireNonNull(valueType, "valueType");

return this.valueType.equals(valueType) ?
Expand All @@ -241,7 +241,7 @@ public Optional<String> query() {
return this.query;
}

public SpreadsheetCellQuery setQuery(final Optional<String> query) {
public SpreadsheetCellFindQuery setQuery(final Optional<String> query) {
Objects.requireNonNull(query, "query");

return this.query.equals(query) ?
Expand All @@ -257,17 +257,17 @@ public SpreadsheetCellQuery setQuery(final Optional<String> query) {

private final Optional<String> query;

private SpreadsheetCellQuery replace(final Optional<SpreadsheetCellRangeReferencePath> path,
final OptionalInt offset,
final OptionalInt max,
final Optional<String> valueType,
final Optional<String> query) {
private SpreadsheetCellFindQuery replace(final Optional<SpreadsheetCellRangeReferencePath> path,
final OptionalInt offset,
final OptionalInt max,
final Optional<String> valueType,
final Optional<String> query) {
return path.isPresent() ||
offset.isPresent() ||
max.isPresent() ||
valueType.isPresent() ||
query.isPresent() ?
new SpreadsheetCellQuery(
new SpreadsheetCellFindQuery(
path,
offset,
max,
Expand Down Expand Up @@ -473,10 +473,10 @@ public int hashCode() {

public boolean equals(final Object other) {
return this == other ||
other instanceof SpreadsheetCellQuery && this.equals0((SpreadsheetCellQuery) other);
other instanceof SpreadsheetCellFindQuery && this.equals0((SpreadsheetCellFindQuery) other);
}

private boolean equals0(final SpreadsheetCellQuery other) {
private boolean equals0(final SpreadsheetCellFindQuery other) {
return this.path.equals(other.path) &&
this.offset.equals(other.offset) &&
this.max.equals(other.max) &&
Expand All @@ -494,19 +494,19 @@ public String toString() {

static {
JsonNodeContext.register(
JsonNodeContext.computeTypeName(SpreadsheetCellQuery.class),
SpreadsheetCellQuery::unmarshall,
SpreadsheetCellQuery::marshall,
SpreadsheetCellQuery.class
JsonNodeContext.computeTypeName(SpreadsheetCellFindQuery.class),
SpreadsheetCellFindQuery::unmarshall,
SpreadsheetCellFindQuery::marshall,
SpreadsheetCellFindQuery.class
);
}

private JsonNode marshall(final JsonNodeMarshallContext context) {
return context.marshall(this.text());
}

static SpreadsheetCellQuery unmarshall(final JsonNode node,
final JsonNodeUnmarshallContext context) {
static SpreadsheetCellFindQuery unmarshall(final JsonNode node,
final JsonNodeUnmarshallContext context) {
return parse(node.stringOrFail());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import walkingkooka.spreadsheet.SpreadsheetName;
import walkingkooka.spreadsheet.compare.SpreadsheetComparatorAliasSet;
import walkingkooka.spreadsheet.compare.SpreadsheetComparatorNameList;
import walkingkooka.spreadsheet.engine.SpreadsheetCellQuery;
import walkingkooka.spreadsheet.engine.SpreadsheetCellFindQuery;
import walkingkooka.spreadsheet.export.SpreadsheetExporterAliasSet;
import walkingkooka.spreadsheet.format.SpreadsheetColorName;
import walkingkooka.spreadsheet.format.SpreadsheetFormatterAliasSet;
Expand Down Expand Up @@ -177,7 +177,7 @@ protected void visitFindFunctions(final ExpressionFunctionAliasSet aliases) {
}

@Override
protected void visitFindQuery(final SpreadsheetCellQuery query) {
protected void visitFindQuery(final SpreadsheetCellFindQuery query) {
throw new UnsupportedOperationException();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import walkingkooka.spreadsheet.compare.SpreadsheetComparatorAliasSet;
import walkingkooka.spreadsheet.compare.SpreadsheetComparatorName;
import walkingkooka.spreadsheet.compare.SpreadsheetComparatorNameList;
import walkingkooka.spreadsheet.engine.SpreadsheetCellQuery;
import walkingkooka.spreadsheet.engine.SpreadsheetCellFindQuery;
import walkingkooka.spreadsheet.export.SpreadsheetExporterAliasSet;
import walkingkooka.spreadsheet.export.SpreadsheetExporterName;
import walkingkooka.spreadsheet.export.SpreadsheetExporterSelector;
Expand Down Expand Up @@ -208,9 +208,9 @@ private static <T> SpreadsheetMetadataPropertyName<T> registerConstant(final Spr
public static final SpreadsheetMetadataPropertyName<Boolean> FIND_HIGHLIGHTING = registerConstant(SpreadsheetMetadataPropertyNameBooleanFindHighlighting.instance());

/**
* A {@link SpreadsheetMetadataPropertyName} holding the <code>find-query {@link SpreadsheetCellQuery}</code>
* A {@link SpreadsheetMetadataPropertyName} holding the <code>find-query {@link SpreadsheetCellFindQuery}</code>
*/
public static final SpreadsheetMetadataPropertyName<SpreadsheetCellQuery> FIND_QUERY = registerConstant(SpreadsheetMetadataPropertyNameFindQuery.instance());
public static final SpreadsheetMetadataPropertyName<SpreadsheetCellFindQuery> FIND_QUERY = registerConstant(SpreadsheetMetadataPropertyNameFindQuery.instance());

/**
* A {@link SpreadsheetMetadataPropertyName} holding the <code>{@link ConverterSelector}</code> which will be used to convert values during a formatting of values.
Expand Down Expand Up @@ -779,7 +779,7 @@ static SpreadsheetMetadataPropertyName<?> unmarshallName(final JsonNode node) {
ExpressionFunctionAliasSet.parse("hello");
FontFamily.with("MS Sans Serif");
FontSize.with(1);
SpreadsheetCellQuery.empty();
SpreadsheetCellFindQuery.empty();
SpreadsheetComparatorNameList.parse(
SpreadsheetComparatorName.TEXT.toString()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
package walkingkooka.spreadsheet.meta;


import walkingkooka.spreadsheet.engine.SpreadsheetCellQuery;
import walkingkooka.spreadsheet.engine.SpreadsheetCellFindQuery;

import java.util.Locale;
import java.util.Optional;

/**
* Holds the {@link SpreadsheetCellQuery}
* Holds the {@link SpreadsheetCellFindQuery}
*/
final class SpreadsheetMetadataPropertyNameFindQuery extends SpreadsheetMetadataPropertyName<SpreadsheetCellQuery> {
final class SpreadsheetMetadataPropertyNameFindQuery extends SpreadsheetMetadataPropertyName<SpreadsheetCellFindQuery> {

/**
* Singleton
Expand All @@ -43,39 +43,39 @@ private SpreadsheetMetadataPropertyNameFindQuery() {
}

/**
* After checking the type force the {@link SpreadsheetCellQuery}
* After checking the type force the {@link SpreadsheetCellFindQuery}
*/
@Override
SpreadsheetCellQuery checkValue0(final Object value) {
SpreadsheetCellFindQuery checkValue0(final Object value) {
return this.checkValueType(value,
v -> v instanceof SpreadsheetCellQuery);
v -> v instanceof SpreadsheetCellFindQuery);
}

@Override
String expected() {
return SpreadsheetCellQuery.class.getSimpleName();
return SpreadsheetCellFindQuery.class.getSimpleName();
}

@Override
Optional<SpreadsheetCellQuery> extractLocaleAwareValue(final Locale locale) {
Optional<SpreadsheetCellFindQuery> extractLocaleAwareValue(final Locale locale) {
return Optional.empty();
}

@Override
Class<SpreadsheetCellQuery> type() {
return SpreadsheetCellQuery.class;
Class<SpreadsheetCellFindQuery> type() {
return SpreadsheetCellFindQuery.class;
}

@Override
void accept(final SpreadsheetCellQuery value,
void accept(final SpreadsheetCellFindQuery value,
final SpreadsheetMetadataVisitor visitor) {
visitor.visitFindQuery(value);
}

// parseUrlFragmentSaveValue........................................................................................

@Override
public SpreadsheetCellQuery parseUrlFragmentSaveValue0(final String value) {
public SpreadsheetCellFindQuery parseUrlFragmentSaveValue0(final String value) {
return this.failParseUrlFragmentSaveValueUnsupported();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import walkingkooka.spreadsheet.SpreadsheetName;
import walkingkooka.spreadsheet.compare.SpreadsheetComparatorAliasSet;
import walkingkooka.spreadsheet.compare.SpreadsheetComparatorNameList;
import walkingkooka.spreadsheet.engine.SpreadsheetCellQuery;
import walkingkooka.spreadsheet.engine.SpreadsheetCellFindQuery;
import walkingkooka.spreadsheet.export.SpreadsheetExporterAliasSet;
import walkingkooka.spreadsheet.format.SpreadsheetColorName;
import walkingkooka.spreadsheet.format.SpreadsheetFormatterAliasSet;
Expand Down Expand Up @@ -181,7 +181,7 @@ protected void visitFindFunctions(final ExpressionFunctionAliasSet aliases) {
// nop
}

protected void visitFindQuery(final SpreadsheetCellQuery query) {
protected void visitFindQuery(final SpreadsheetCellFindQuery query) {
// nop
}

Expand Down
Loading

0 comments on commit d7e8ec7

Please sign in to comment.