Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BasicSpreadsheetEngineContext.fractioner dependency removed #5284

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import walkingkooka.collect.list.Lists;
import walkingkooka.collect.set.SortedSets;
import walkingkooka.convert.provider.ConverterSelector;
import walkingkooka.math.Fraction;
import walkingkooka.net.AbsoluteUrl;
import walkingkooka.plugin.ProviderContext;
import walkingkooka.plugin.ProviderContextDelegator;
Expand Down Expand Up @@ -59,14 +58,12 @@
import walkingkooka.tree.expression.function.provider.ExpressionFunctionAliasSet;
import walkingkooka.tree.text.TextNode;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;

Expand All @@ -85,7 +82,6 @@ static BasicSpreadsheetEngineContext with(final AbsoluteUrl serverUrl,
final Supplier<LocalDateTime> now,
final SpreadsheetMetadata metadata,
final SpreadsheetEngine engine,
final Function<BigDecimal, Fraction> fractioner,
final SpreadsheetStoreRepository storeRepository,
final SpreadsheetMetadataPropertyName<ExpressionFunctionAliasSet> functionAliases,
final SpreadsheetProvider spreadsheetProvider,
Expand All @@ -94,7 +90,6 @@ static BasicSpreadsheetEngineContext with(final AbsoluteUrl serverUrl,
Objects.requireNonNull(now, "now");
Objects.requireNonNull(metadata, "metadata");
Objects.requireNonNull(engine, "engine");
Objects.requireNonNull(fractioner, "fractioner");
Objects.requireNonNull(storeRepository, "storeRepository");
Objects.requireNonNull(functionAliases, "functionAliases");
Objects.requireNonNull(spreadsheetProvider, "spreadsheetProvider");
Expand All @@ -106,7 +101,6 @@ static BasicSpreadsheetEngineContext with(final AbsoluteUrl serverUrl,
now,
metadata,
engine,
fractioner,
storeRepository,
functionAliases,
spreadsheetProvider,
Expand All @@ -121,7 +115,6 @@ private BasicSpreadsheetEngineContext(final AbsoluteUrl serverUrl,
final Supplier<LocalDateTime> now,
final SpreadsheetMetadata metadata,
final SpreadsheetEngine engine,
final Function<BigDecimal, Fraction> fractioner,
final SpreadsheetStoreRepository storeRepository,
final SpreadsheetMetadataPropertyName<ExpressionFunctionAliasSet> functionAliases,
final SpreadsheetProvider spreadsheetProvider,
Expand All @@ -138,7 +131,6 @@ private BasicSpreadsheetEngineContext(final AbsoluteUrl serverUrl,
this
);

this.fractioner = fractioner;
this.storeRepository = storeRepository;

this.labelNameResolver = SpreadsheetLabelNameResolvers.labelStore(
Expand Down Expand Up @@ -232,7 +224,6 @@ public SpreadsheetEngineContext spreadsheetEngineContext(final SpreadsheetMetada
this.now,
this.metadata,
this.engine,
this.fractioner,
this.storeRepository,
functionAliases,
this.spreadsheetProvider,
Expand Down Expand Up @@ -334,11 +325,6 @@ public LocalDateTime now() {

private final Supplier<LocalDateTime> now;

/**
* Used to convert a number into a fraction within expressions.
*/
private final Function<BigDecimal, Fraction> fractioner;

// formatValue......................................................................................................

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package walkingkooka.spreadsheet.engine;

import walkingkooka.math.Fraction;
import walkingkooka.net.AbsoluteUrl;
import walkingkooka.plugin.ProviderContext;
import walkingkooka.reflect.PublicStaticHelper;
Expand All @@ -27,9 +26,7 @@
import walkingkooka.spreadsheet.store.repo.SpreadsheetStoreRepository;
import walkingkooka.tree.expression.function.provider.ExpressionFunctionAliasSet;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.function.Function;
import java.util.function.Supplier;

public final class SpreadsheetEngineContexts implements PublicStaticHelper {
Expand All @@ -41,7 +38,6 @@ public static SpreadsheetEngineContext basic(final AbsoluteUrl serverUrl,
final Supplier<LocalDateTime> now,
final SpreadsheetMetadata metadata,
final SpreadsheetEngine engine,
final Function<BigDecimal, Fraction> fractioner,
final SpreadsheetStoreRepository storeRepository,
final SpreadsheetMetadataPropertyName<ExpressionFunctionAliasSet> functionAliases,
final SpreadsheetProvider spreadsheetProvider,
Expand All @@ -51,7 +47,6 @@ public static SpreadsheetEngineContext basic(final AbsoluteUrl serverUrl,
now,
metadata,
engine,
fractioner,
storeRepository,
functionAliases,
spreadsheetProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import walkingkooka.datetime.FakeDateTimeContext;
import walkingkooka.math.DecimalNumberContext;
import walkingkooka.math.DecimalNumberContexts;
import walkingkooka.math.Fraction;
import walkingkooka.net.AbsoluteUrl;
import walkingkooka.net.Url;
import walkingkooka.plugin.ProviderContext;
Expand Down Expand Up @@ -91,7 +90,6 @@
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function;

import static org.junit.jupiter.api.Assertions.assertThrows;

Expand Down Expand Up @@ -292,18 +290,6 @@ public ExpressionFunctionInfoSet expressionFunctionInfos() {

private final static SpreadsheetEngine ENGINE = SpreadsheetEngines.fake();

private final Function<BigDecimal, Fraction> FRACTIONER = new Function<>() {
@Override
public Fraction apply(final BigDecimal bigDecimal) {
throw new UnsupportedOperationException();
}

@Override
public String toString() {
return "Fractioner123";
}
};

private final static SpreadsheetStoreRepository STORE_REPOSITORY = SpreadsheetStoreRepositories.fake();

private final static SpreadsheetMetadataPropertyName<ExpressionFunctionAliasSet> FUNCTION_ALIASES = SpreadsheetMetadataPropertyName.FORMULA_FUNCTIONS;
Expand All @@ -317,7 +303,6 @@ public void testWithNullServerUrlFails() {
NOW,
METADATA,
ENGINE,
FRACTIONER,
STORE_REPOSITORY,
FUNCTION_ALIASES,
SPREADSHEET_PROVIDER,
Expand All @@ -335,7 +320,6 @@ public void testWithNullNowFails() {
null,
METADATA,
ENGINE,
FRACTIONER,
STORE_REPOSITORY,
FUNCTION_ALIASES,
SPREADSHEET_PROVIDER,
Expand All @@ -353,7 +337,6 @@ public void testWithNullMetadataFails() {
NOW,
null,
ENGINE,
FRACTIONER,
STORE_REPOSITORY,
FUNCTION_ALIASES,
SPREADSHEET_PROVIDER,
Expand All @@ -371,25 +354,6 @@ public void testWithNullEngineFails() {
NOW,
METADATA,
null,
FRACTIONER,
STORE_REPOSITORY,
FUNCTION_ALIASES,
SPREADSHEET_PROVIDER,
PROVIDER_CONTEXT
)
);
}

@Test
public void testWithNullFractionerFails() {
assertThrows(
NullPointerException.class,
() -> BasicSpreadsheetEngineContext.with(
SERVER_URL,
NOW,
METADATA,
ENGINE,
null,
STORE_REPOSITORY,
FUNCTION_ALIASES,
SPREADSHEET_PROVIDER,
Expand All @@ -407,7 +371,6 @@ public void testWithNullStoreRepositoryFails() {
NOW,
METADATA,
ENGINE,
FRACTIONER,
null,
FUNCTION_ALIASES,
SPREADSHEET_PROVIDER,
Expand All @@ -425,7 +388,6 @@ public void testWithNullFunctionAliasesFails() {
NOW,
METADATA,
ENGINE,
FRACTIONER,
STORE_REPOSITORY,
null,
SPREADSHEET_PROVIDER,
Expand All @@ -443,7 +405,6 @@ public void testWithNullSpreadsheetProviderFails() {
NOW,
METADATA,
ENGINE,
FRACTIONER,
STORE_REPOSITORY,
FUNCTION_ALIASES,
null,
Expand All @@ -461,7 +422,6 @@ public void testWithNullProviderContextFails() {
NOW,
METADATA,
ENGINE,
FRACTIONER,
STORE_REPOSITORY,
FUNCTION_ALIASES,
SPREADSHEET_PROVIDER,
Expand Down Expand Up @@ -1410,7 +1370,6 @@ private BasicSpreadsheetEngineContext createContext(final SpreadsheetMetadata me
NOW,
metadata,
ENGINE,
FRACTIONER,
new FakeSpreadsheetStoreRepository() {

@Override
Expand Down
Loading