Skip to content

Commit

Permalink
BasicExpressionEvaluationContext implements DateTimeContextDelegate D…
Browse files Browse the repository at this point in the history
…ecimalNumberContextDelegate
  • Loading branch information
mP1 committed Jan 11, 2025
1 parent 3e3e873 commit f3dff8c
Showing 1 changed file with 17 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
import walkingkooka.Cast;
import walkingkooka.Either;
import walkingkooka.convert.ConverterContext;
import walkingkooka.datetime.DateTimeContext;
import walkingkooka.datetime.DateTimeContextDelegator;
import walkingkooka.math.DecimalNumberContext;
import walkingkooka.math.DecimalNumberContextDelegator;
import walkingkooka.text.CaseSensitivity;
import walkingkooka.tree.expression.function.ExpressionFunction;
import walkingkooka.tree.expression.function.ExpressionFunctionParameter;

import java.math.MathContext;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
Expand All @@ -38,7 +40,9 @@
* values are also converted to the parameter's type.
* This is useful for languages or environments that have auto converting of value semantics, think Javascript.
*/
final class BasicExpressionEvaluationContext implements ExpressionEvaluationContext {
final class BasicExpressionEvaluationContext implements ExpressionEvaluationContext,
DateTimeContextDelegator,
DecimalNumberContextDelegator {

/**
* Factory that creates a {@link BasicExpressionEvaluationContext}
Expand Down Expand Up @@ -102,108 +106,32 @@ public boolean isText(final Object value) {
return value instanceof Character || value instanceof CharSequence;
}

// DateTimeContext.................................................................................................

@Override
public List<String> ampms() {
return this.converterContext.ampms();
}

@Override
public int defaultYear() {
return this.converterContext.defaultYear();
}

@Override
public List<String> monthNames() {
return this.converterContext.monthNames();
}

@Override
public List<String> monthNameAbbreviations() {
return this.converterContext.monthNameAbbreviations();
}

@Override
public LocalDateTime now() {
return this.converterContext.now();
public ExpressionNumberKind expressionNumberKind() {
return this.expressionNumberKind;
}

@Override
public int twoToFourDigitYear(final int year) {
return this.converterContext.twoToFourDigitYear(year);
}
private final ExpressionNumberKind expressionNumberKind;

@Override
public int twoDigitYear() {
return this.converterContext.twoDigitYear();
public Locale locale() {
return this.converterContext.locale();
}

@Override
public List<String> weekDayNames() {
return this.converterContext.weekDayNames();
}
// DateTimeContext.................................................................................................

@Override
public List<String> weekDayNameAbbreviations() {
return this.converterContext.weekDayNameAbbreviations();
public DateTimeContext dateTimeContext() {
return this.converterContext;
}

// DecimalNumberContext............................................................................................

@Override
public String currencySymbol() {
return this.converterContext.currencySymbol();
}

@Override
public char decimalSeparator() {
return this.converterContext.decimalSeparator();
}

@Override
public String exponentSymbol() {
return this.converterContext.exponentSymbol();
}

@Override
public char groupSeparator() {
return this.converterContext.groupSeparator();
public DecimalNumberContext decimalNumberContext() {
return this.converterContext;
}

@Override
public char percentageSymbol() {
return this.converterContext.percentageSymbol();
}

@Override
public char negativeSign() {
return this.converterContext.negativeSign();
}

@Override
public char positiveSign() {
return this.converterContext.positiveSign();
}


@Override
public Locale locale() {
return this.converterContext.locale();
}

@Override
public MathContext mathContext() {
return this.converterContext.mathContext();
}

@Override
public ExpressionNumberKind expressionNumberKind() {
return this.expressionNumberKind;
}

private final ExpressionNumberKind expressionNumberKind;

// Convert..........................................................................................................

@Override
Expand Down

0 comments on commit f3dff8c

Please sign in to comment.