com.hazelcast.jet.sql.impl.opt.logical.ImmutableCalcDropLateItemsTransposeRule Maven / Gradle / Ivy
package com.hazelcast.jet.sql.impl.opt.logical;
import com.hazelcast.shaded.com.google.common.base.MoreObjects;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;
import com.hazelcast.shaded.org.apache.calcite.plan.RelRule;
import com.hazelcast.shaded.org.apache.calcite.tools.RelBuilderFactory;
import org.immutables.value.Generated;
/**
* {@code ImmutableCalcDropLateItemsTransposeRule} contains immutable implementation classes generated from
* abstract value types defined as nested inside {@link CalcDropLateItemsTransposeRule}.
* @see ImmutableCalcDropLateItemsTransposeRule.Config
*/
@Generated(from = "CalcDropLateItemsTransposeRule", generator = "Immutables")
@SuppressWarnings({"all"})
@SuppressFBWarnings
@ParametersAreNonnullByDefault
@javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutableCalcDropLateItemsTransposeRule {
private ImmutableCalcDropLateItemsTransposeRule() {}
/**
* Immutable implementation of {@link CalcDropLateItemsTransposeRule.Config}.
*
* Use the builder to create immutable instances:
* {@code ImmutableCalcDropLateItemsTransposeRule.Config.builder()}.
*/
@Generated(from = "CalcDropLateItemsTransposeRule.Config", generator = "Immutables")
@Immutable
public static final class Config
implements CalcDropLateItemsTransposeRule.Config {
private final RelBuilderFactory relBuilderFactory;
private final @Nullable String description;
private final RelRule.OperandTransform operandSupplier;
private Config(ImmutableCalcDropLateItemsTransposeRule.Config.Builder builder) {
this.description = builder.description;
if (builder.relBuilderFactory != null) {
initShim.relBuilderFactory(builder.relBuilderFactory);
}
if (builder.operandSupplier != null) {
initShim.operandSupplier(builder.operandSupplier);
}
this.relBuilderFactory = initShim.relBuilderFactory();
this.operandSupplier = initShim.operandSupplier();
this.initShim = null;
}
private Config(
RelBuilderFactory relBuilderFactory,
@Nullable String description,
RelRule.OperandTransform operandSupplier) {
this.relBuilderFactory = relBuilderFactory;
this.description = description;
this.operandSupplier = operandSupplier;
this.initShim = null;
}
private static final byte STAGE_INITIALIZING = -1;
private static final byte STAGE_UNINITIALIZED = 0;
private static final byte STAGE_INITIALIZED = 1;
private transient volatile InitShim initShim = new InitShim();
@Generated(from = "CalcDropLateItemsTransposeRule.Config", generator = "Immutables")
private final class InitShim {
private byte relBuilderFactoryBuildStage = STAGE_UNINITIALIZED;
private RelBuilderFactory relBuilderFactory;
RelBuilderFactory relBuilderFactory() {
if (relBuilderFactoryBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (relBuilderFactoryBuildStage == STAGE_UNINITIALIZED) {
relBuilderFactoryBuildStage = STAGE_INITIALIZING;
this.relBuilderFactory = Objects.requireNonNull(relBuilderFactoryInitialize(), "relBuilderFactory");
relBuilderFactoryBuildStage = STAGE_INITIALIZED;
}
return this.relBuilderFactory;
}
void relBuilderFactory(RelBuilderFactory relBuilderFactory) {
this.relBuilderFactory = relBuilderFactory;
relBuilderFactoryBuildStage = STAGE_INITIALIZED;
}
private byte operandSupplierBuildStage = STAGE_UNINITIALIZED;
private RelRule.OperandTransform operandSupplier;
RelRule.OperandTransform operandSupplier() {
if (operandSupplierBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (operandSupplierBuildStage == STAGE_UNINITIALIZED) {
operandSupplierBuildStage = STAGE_INITIALIZING;
this.operandSupplier = Objects.requireNonNull(operandSupplierInitialize(), "operandSupplier");
operandSupplierBuildStage = STAGE_INITIALIZED;
}
return this.operandSupplier;
}
void operandSupplier(RelRule.OperandTransform operandSupplier) {
this.operandSupplier = operandSupplier;
operandSupplierBuildStage = STAGE_INITIALIZED;
}
private String formatInitCycleMessage() {
List attributes = new ArrayList<>();
if (relBuilderFactoryBuildStage == STAGE_INITIALIZING) attributes.add("relBuilderFactory");
if (operandSupplierBuildStage == STAGE_INITIALIZING) attributes.add("operandSupplier");
return "Cannot build Config, attribute initializers form cycle " + attributes;
}
}
private RelBuilderFactory relBuilderFactoryInitialize() {
return CalcDropLateItemsTransposeRule.Config.super.relBuilderFactory();
}
private RelRule.OperandTransform operandSupplierInitialize() {
return CalcDropLateItemsTransposeRule.Config.super.operandSupplier();
}
/**
* @return The value of the {@code relBuilderFactory} attribute
*/
@Override
public RelBuilderFactory relBuilderFactory() {
InitShim shim = this.initShim;
return shim != null
? shim.relBuilderFactory()
: this.relBuilderFactory;
}
/**
* @return The value of the {@code description} attribute
*/
@Override
public @Nullable String description() {
return description;
}
/**
* @return The value of the {@code operandSupplier} attribute
*/
@Override
public RelRule.OperandTransform operandSupplier() {
InitShim shim = this.initShim;
return shim != null
? shim.operandSupplier()
: this.operandSupplier;
}
/**
* Copy the current immutable object by setting a value for the {@link CalcDropLateItemsTransposeRule.Config#relBuilderFactory() relBuilderFactory} attribute.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for relBuilderFactory
* @return A modified copy of the {@code this} object
*/
public final ImmutableCalcDropLateItemsTransposeRule.Config withRelBuilderFactory(RelBuilderFactory value) {
if (this.relBuilderFactory == value) return this;
RelBuilderFactory newValue = Objects.requireNonNull(value, "relBuilderFactory");
return new ImmutableCalcDropLateItemsTransposeRule.Config(newValue, this.description, this.operandSupplier);
}
/**
* Copy the current immutable object by setting a value for the {@link CalcDropLateItemsTransposeRule.Config#description() description} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for description (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCalcDropLateItemsTransposeRule.Config withDescription(@Nullable String value) {
if (Objects.equals(this.description, value)) return this;
return new ImmutableCalcDropLateItemsTransposeRule.Config(this.relBuilderFactory, value, this.operandSupplier);
}
/**
* Copy the current immutable object by setting a value for the {@link CalcDropLateItemsTransposeRule.Config#operandSupplier() operandSupplier} attribute.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for operandSupplier
* @return A modified copy of the {@code this} object
*/
public final ImmutableCalcDropLateItemsTransposeRule.Config withOperandSupplier(RelRule.OperandTransform value) {
if (this.operandSupplier == value) return this;
RelRule.OperandTransform newValue = Objects.requireNonNull(value, "operandSupplier");
return new ImmutableCalcDropLateItemsTransposeRule.Config(this.relBuilderFactory, this.description, newValue);
}
/**
* This instance is equal to all instances of {@code Config} that have equal attribute values.
* @return {@code true} if {@code this} is equal to {@code another} instance
*/
@Override
public boolean equals(@Nullable Object another) {
if (this == another) return true;
return another instanceof ImmutableCalcDropLateItemsTransposeRule.Config
&& equalTo(0, (ImmutableCalcDropLateItemsTransposeRule.Config) another);
}
private boolean equalTo(int synthetic, ImmutableCalcDropLateItemsTransposeRule.Config another) {
return relBuilderFactory.equals(another.relBuilderFactory)
&& Objects.equals(description, another.description)
&& operandSupplier.equals(another.operandSupplier);
}
/**
* Computes a hash code from attributes: {@code relBuilderFactory}, {@code description}, {@code operandSupplier}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 5381;
h += (h << 5) + relBuilderFactory.hashCode();
h += (h << 5) + Objects.hashCode(description);
h += (h << 5) + operandSupplier.hashCode();
return h;
}
/**
* Prints the immutable value {@code Config} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("Config")
.omitNullValues()
.add("relBuilderFactory", relBuilderFactory)
.add("description", description)
.add("operandSupplier", operandSupplier)
.toString();
}
/**
* Creates an immutable copy of a {@link CalcDropLateItemsTransposeRule.Config} value.
* Uses accessors to get values to initialize the new immutable instance.
* If an instance is already immutable, it is returned as is.
* @param instance The instance to copy
* @return A copied immutable Config instance
*/
public static ImmutableCalcDropLateItemsTransposeRule.Config copyOf(CalcDropLateItemsTransposeRule.Config instance) {
if (instance instanceof ImmutableCalcDropLateItemsTransposeRule.Config) {
return (ImmutableCalcDropLateItemsTransposeRule.Config) instance;
}
return ImmutableCalcDropLateItemsTransposeRule.Config.builder()
.from(instance)
.build();
}
/**
* Creates a builder for {@link ImmutableCalcDropLateItemsTransposeRule.Config Config}.
*
* ImmutableCalcDropLateItemsTransposeRule.Config.builder()
* .relBuilderFactory(com.hazelcast.shaded.org.apache.calcite.tools.RelBuilderFactory) // optional {@link CalcDropLateItemsTransposeRule.Config#relBuilderFactory() relBuilderFactory}
* .description(String | null) // nullable {@link CalcDropLateItemsTransposeRule.Config#description() description}
* .operandSupplier(com.hazelcast.shaded.org.apache.calcite.plan.RelRule.OperandTransform) // optional {@link CalcDropLateItemsTransposeRule.Config#operandSupplier() operandSupplier}
* .build();
*
* @return A new Config builder
*/
public static ImmutableCalcDropLateItemsTransposeRule.Config.Builder builder() {
return new ImmutableCalcDropLateItemsTransposeRule.Config.Builder();
}
/**
* Builds instances of type {@link ImmutableCalcDropLateItemsTransposeRule.Config Config}.
* Initialize attributes and then invoke the {@link #build()} method to create an
* immutable instance.
* {@code Builder} is not thread-safe and generally should not be stored in a field or collection,
* but instead used immediately to create instances.
*/
@Generated(from = "CalcDropLateItemsTransposeRule.Config", generator = "Immutables")
@NotThreadSafe
public static final class Builder {
private @Nullable RelBuilderFactory relBuilderFactory;
private @Nullable String description;
private @Nullable RelRule.OperandTransform operandSupplier;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code org.apache.calcite.plan.RelRule.Config} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder from(RelRule.Config instance) {
Objects.requireNonNull(instance, "instance");
from((short) 0, (Object) instance);
return this;
}
/**
* Fill a builder with attribute values from the provided {@code com.hazelcast.jet.sql.impl.opt.logical.CalcDropLateItemsTransposeRule.Config} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder from(CalcDropLateItemsTransposeRule.Config instance) {
Objects.requireNonNull(instance, "instance");
from((short) 0, (Object) instance);
return this;
}
private void from(short _unused, Object object) {
long bits = 0;
if (object instanceof RelRule.Config) {
RelRule.Config instance = (RelRule.Config) object;
if ((bits & 0x2L) == 0) {
relBuilderFactory(instance.relBuilderFactory());
bits |= 0x2L;
}
if ((bits & 0x1L) == 0) {
@Nullable String descriptionValue = instance.description();
if (descriptionValue != null) {
description(descriptionValue);
}
bits |= 0x1L;
}
if ((bits & 0x4L) == 0) {
operandSupplier(instance.operandSupplier());
bits |= 0x4L;
}
}
if (object instanceof CalcDropLateItemsTransposeRule.Config) {
CalcDropLateItemsTransposeRule.Config instance = (CalcDropLateItemsTransposeRule.Config) object;
if ((bits & 0x2L) == 0) {
relBuilderFactory(instance.relBuilderFactory());
bits |= 0x2L;
}
if ((bits & 0x1L) == 0) {
@Nullable String descriptionValue = instance.description();
if (descriptionValue != null) {
description(descriptionValue);
}
bits |= 0x1L;
}
if ((bits & 0x4L) == 0) {
operandSupplier(instance.operandSupplier());
bits |= 0x4L;
}
}
}
/**
* Initializes the value for the {@link CalcDropLateItemsTransposeRule.Config#relBuilderFactory() relBuilderFactory} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link CalcDropLateItemsTransposeRule.Config#relBuilderFactory() relBuilderFactory}.
* @param relBuilderFactory The value for relBuilderFactory
* @return {@code this} builder for use in a chained invocation
*/
public final Builder relBuilderFactory(RelBuilderFactory relBuilderFactory) {
this.relBuilderFactory = Objects.requireNonNull(relBuilderFactory, "relBuilderFactory");
return this;
}
/**
* Initializes the value for the {@link CalcDropLateItemsTransposeRule.Config#description() description} attribute.
* @param description The value for description (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder description(@Nullable String description) {
this.description = description;
return this;
}
/**
* Initializes the value for the {@link CalcDropLateItemsTransposeRule.Config#operandSupplier() operandSupplier} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link CalcDropLateItemsTransposeRule.Config#operandSupplier() operandSupplier}.
* @param operandSupplier The value for operandSupplier
* @return {@code this} builder for use in a chained invocation
*/
public final Builder operandSupplier(RelRule.OperandTransform operandSupplier) {
this.operandSupplier = Objects.requireNonNull(operandSupplier, "operandSupplier");
return this;
}
/**
* Builds a new {@link ImmutableCalcDropLateItemsTransposeRule.Config Config}.
* @return An immutable instance of Config
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableCalcDropLateItemsTransposeRule.Config build() {
return new ImmutableCalcDropLateItemsTransposeRule.Config(this);
}
}
}
}