All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.calcite.linq4j.QueryableRecorder Maven / Gradle / Ivy

The newest version!
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to you under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.calcite.linq4j;

import org.apache.calcite.linq4j.function.BigDecimalFunction1;
import org.apache.calcite.linq4j.function.DoubleFunction1;
import org.apache.calcite.linq4j.function.EqualityComparer;
import org.apache.calcite.linq4j.function.FloatFunction1;
import org.apache.calcite.linq4j.function.Function1;
import org.apache.calcite.linq4j.function.Function2;
import org.apache.calcite.linq4j.function.IntegerFunction1;
import org.apache.calcite.linq4j.function.LongFunction1;
import org.apache.calcite.linq4j.function.NullableBigDecimalFunction1;
import org.apache.calcite.linq4j.function.NullableDoubleFunction1;
import org.apache.calcite.linq4j.function.NullableFloatFunction1;
import org.apache.calcite.linq4j.function.NullableIntegerFunction1;
import org.apache.calcite.linq4j.function.NullableLongFunction1;
import org.apache.calcite.linq4j.function.Predicate1;
import org.apache.calcite.linq4j.function.Predicate2;
import org.apache.calcite.linq4j.tree.FunctionExpression;

import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.Comparator;

import static org.apache.calcite.linq4j.QueryableDefaults.NonLeafReplayableQueryable;

/**
 * Implementation of {@link QueryableFactory} that records each event
 * and returns an object that can replay the event when you call its
 * {@link org.apache.calcite.linq4j.QueryableDefaults.ReplayableQueryable#replay(QueryableFactory)}
 * method.
 *
 * @param  Element type
 */
public class QueryableRecorder implements QueryableFactory {
  private static final QueryableRecorder INSTANCE = new QueryableRecorder();

  @SuppressWarnings("unchecked")
  public static  QueryableRecorder instance() {
    return INSTANCE;
  }

  public T aggregate(final Queryable source,
      final FunctionExpression> func) {
    return new QueryableDefaults.NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.aggregate(source, func);
      }
    }.single(); // CHECKSTYLE: IGNORE 0
  }

  public  TAccumulate aggregate(final Queryable source,
      final TAccumulate seed,
      final FunctionExpression> func) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.aggregate(source, seed, func);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public  TResult aggregate(final Queryable source,
      final TAccumulate seed,
      final FunctionExpression> func,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.aggregate(source, seed, func, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public boolean all(final Queryable source,
      final FunctionExpression> predicate) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.all(source, predicate);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public boolean any(final Queryable source) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.any(source);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public boolean any(final Queryable source,
      final FunctionExpression> predicate) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.any(source, predicate);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public BigDecimal averageBigDecimal(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.averageBigDecimal(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public BigDecimal averageNullableBigDecimal(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.averageNullableBigDecimal(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public double averageDouble(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.averageDouble(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public Double averageNullableDouble(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.averageNullableDouble(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public int averageInteger(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.averageInteger(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public Integer averageNullableInteger(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.averageNullableInteger(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public float averageFloat(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.averageFloat(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public Float averageNullableFloat(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.averageNullableFloat(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public long averageLong(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.averageLong(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public Long averageNullableLong(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.averageNullableLong(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable cast(final Queryable source,
      final Class clazz) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.cast(source, clazz);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public Queryable concat(final Queryable source,
      final Enumerable source2) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.concat(source, source2);
      }
    };
  }

  public boolean contains(final Queryable source, final T element) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.contains(source, element);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public boolean contains(final Queryable source, final T element,
      final EqualityComparer comparer) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.contains(source, element, comparer);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public int count(final Queryable source) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.count(source);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public int count(final Queryable source,
      final FunctionExpression> func) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.count(source, func);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public Queryable defaultIfEmpty(final Queryable source) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.defaultIfEmpty(source);
      }
    };
  }

  public Queryable defaultIfEmpty(final Queryable source, final T value) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.defaultIfEmpty(source, value);
      }
    };
  }

  public Queryable distinct(final Queryable source) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.distinct(source);
      }
    };
  }

  public Queryable distinct(final Queryable source,
      final EqualityComparer comparer) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.distinct(source, comparer);
      }
    };
  }

  public T elementAt(final Queryable source, final int index) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.elementAt(source, index);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public T elementAtOrDefault(final Queryable source, final int index) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.elementAtOrDefault(source, index);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public Queryable except(final Queryable source,
      final Enumerable enumerable) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.except(source, enumerable);
      }
    };
  }

  public Queryable except(final Queryable source,
      final Enumerable enumerable, final EqualityComparer comparer) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.except(source, enumerable, comparer);
      }
    };
  }

  public T first(final Queryable source) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.first(source);
      }
    }.single(); // CHECKSTYLE: IGNORE 0
  }

  public T first(final Queryable source,
      final FunctionExpression> predicate) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.first(source, predicate);
      }
    }.single(); // CHECKSTYLE: IGNORE 0
  }

  public T firstOrDefault(final Queryable source) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.firstOrDefault(source);
      }
    }.single(); // CHECKSTYLE: IGNORE 0
  }

  public T firstOrDefault(final Queryable source,
      final FunctionExpression> predicate) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.firstOrDefault(source, predicate);
      }
    }.single(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable> groupBy(final Queryable source,
      final FunctionExpression> keySelector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.groupBy(source, keySelector);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable> groupBy(final Queryable source,
      final FunctionExpression> keySelector,
      final EqualityComparer comparer) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.groupBy(source, keySelector, comparer);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable> groupBy(
      final Queryable source,
      final FunctionExpression> keySelector,
      final FunctionExpression> elementSelector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.groupBy(source, keySelector, elementSelector);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable> groupBy(
      final Queryable source,
      final FunctionExpression> keySelector,
      final FunctionExpression> elementSelector,
      final EqualityComparer comparer) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.groupBy(source, keySelector, elementSelector, comparer);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable groupByK(
      final Queryable source,
      final FunctionExpression> keySelector,
      final FunctionExpression, TResult>> resultSelector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.groupByK(source, keySelector, resultSelector);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable groupByK(final Queryable source,
      final FunctionExpression> keySelector,
      final FunctionExpression, TResult>> resultSelector,
      final EqualityComparer comparer) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.groupByK(source, keySelector, resultSelector, comparer);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable groupBy(
      final Queryable source,
      final FunctionExpression> keySelector,
      final FunctionExpression> elementSelector,
      final FunctionExpression, TResult>> resultSelector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.groupBy(source, keySelector, elementSelector, resultSelector);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable groupBy(
      final Queryable source,
      final FunctionExpression> keySelector,
      final FunctionExpression> elementSelector,
      final FunctionExpression, TResult>> resultSelector,
      final EqualityComparer comparer) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.groupBy(source, keySelector, elementSelector, resultSelector,
            comparer);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable groupJoin(
      final Queryable source, final Enumerable inner,
      final FunctionExpression> outerKeySelector,
      final FunctionExpression> innerKeySelector,
      final FunctionExpression, TResult>> resultSelector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.groupJoin(source, inner, outerKeySelector, innerKeySelector,
            resultSelector);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable groupJoin(
      final Queryable source, final Enumerable inner,
      final FunctionExpression> outerKeySelector,
      final FunctionExpression> innerKeySelector,
      final FunctionExpression, TResult>> resultSelector,
      final EqualityComparer comparer) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.groupJoin(source, inner, outerKeySelector, innerKeySelector,
            resultSelector, comparer);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public Queryable intersect(final Queryable source,
      final Enumerable enumerable) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.intersect(source, enumerable);
      }
    };
  }

  public Queryable intersect(final Queryable source,
      final Enumerable enumerable, final EqualityComparer comparer) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.intersect(source, enumerable, comparer);
      }
    };
  }

  public  Queryable join(
      final Queryable source, final Enumerable inner,
      final FunctionExpression> outerKeySelector,
      final FunctionExpression> innerKeySelector,
      final FunctionExpression> resultSelector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.join(source, inner, outerKeySelector, innerKeySelector,
            resultSelector);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable join(
      final Queryable source, final Enumerable inner,
      final FunctionExpression> outerKeySelector,
      final FunctionExpression> innerKeySelector,
      final FunctionExpression> resultSelector,
      final EqualityComparer comparer) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.join(source, inner, outerKeySelector, innerKeySelector,
            resultSelector, comparer);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public T last(final Queryable source) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.last(source);
      }
    }.single(); // CHECKSTYLE: IGNORE 0
  }

  public T last(final Queryable source,
      final FunctionExpression> predicate) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.last(source, predicate);
      }
    }.single(); // CHECKSTYLE: IGNORE 0
  }

  public T lastOrDefault(final Queryable source) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.lastOrDefault(source);
      }
    }.single(); // CHECKSTYLE: IGNORE 0
  }

  public T lastOrDefault(final Queryable source,
      final FunctionExpression> predicate) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.lastOrDefault(source, predicate);
      }
    }.single(); // CHECKSTYLE: IGNORE 0
  }

  public long longCount(final Queryable source) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.longCount(source);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public long longCount(final Queryable source,
      final FunctionExpression> predicate) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.longCount(source, predicate);
      }
    }.longCount(); // CHECKSTYLE: IGNORE 0
  }

  public T max(final Queryable source) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.max(source);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public > TResult max(
      final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.max(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public T min(final Queryable source) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.min(source);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public > TResult min(
      final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.min(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable ofType(final Queryable source,
      final Class clazz) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.ofType(source, clazz);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public  OrderedQueryable orderBy(
      final Queryable source,
      final FunctionExpression> keySelector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.orderBy(source, keySelector);
      }
    };
  }

  public  OrderedQueryable orderBy(final Queryable source,
      final FunctionExpression> keySelector,
      final Comparator comparator) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.orderBy(source, keySelector, comparator);
      }
    };
  }

  public  OrderedQueryable orderByDescending(
      final Queryable source,
      final FunctionExpression> keySelector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.orderByDescending(source, keySelector);
      }
    };
  }

  public  OrderedQueryable orderByDescending(final Queryable source,
      final FunctionExpression> keySelector,
      final Comparator comparator) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.orderByDescending(source, keySelector, comparator);
      }
    };
  }

  public Queryable reverse(final Queryable source) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.reverse(source);
      }
    };
  }

  public  Queryable select(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.select(source, selector);
      }

      @Override public Type getElementType() {
        return selector.body.type;
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable selectN(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.selectN(source, selector);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable selectMany(final Queryable source,
      final FunctionExpression>> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.selectMany(source, selector);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable selectManyN(final Queryable source,
      final FunctionExpression>>
        selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.selectManyN(source, selector);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable selectMany(
      final Queryable source,
      final FunctionExpression>>
        collectionSelector,
      final FunctionExpression>
        resultSelector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.selectMany(source, collectionSelector, resultSelector);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public  Queryable selectManyN(
      final Queryable source,
      final FunctionExpression>>
        collectionSelector,
      final FunctionExpression>
        resultSelector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.selectManyN(source, collectionSelector, resultSelector);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }

  public boolean sequenceEqual(final Queryable source,
      final Enumerable enumerable) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.sequenceEqual(source, enumerable);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public boolean sequenceEqual(final Queryable source,
      final Enumerable enumerable, final EqualityComparer comparer) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.sequenceEqual(source, enumerable, comparer);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public T single(final Queryable source) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.single(source);
      }
    }.single(); // CHECKSTYLE: IGNORE 0
  }

  public T single(final Queryable source,
      final FunctionExpression> predicate) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.single(source, predicate);
      }
    }.single(); // CHECKSTYLE: IGNORE 0
  }

  public T singleOrDefault(final Queryable source) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.singleOrDefault(source);
      }
    }.single(); // CHECKSTYLE: IGNORE 0
  }

  public T singleOrDefault(final Queryable source,
      final FunctionExpression> predicate) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.singleOrDefault(source, predicate);
      }
    }.single(); // CHECKSTYLE: IGNORE 0
  }

  public Queryable skip(final Queryable source, final int count) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.skip(source, count);
      }
    };
  }

  public Queryable skipWhile(final Queryable source,
      final FunctionExpression> predicate) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.skipWhile(source, predicate);
      }
    };
  }

  public Queryable skipWhileN(final Queryable source,
      final FunctionExpression> predicate) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.skipWhileN(source, predicate);
      }
    };
  }

  public BigDecimal sumBigDecimal(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.sumBigDecimal(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public BigDecimal sumNullableBigDecimal(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.sumNullableBigDecimal(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public double sumDouble(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.sumDouble(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public Double sumNullableDouble(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.sumNullableDouble(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public int sumInteger(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.sumInteger(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public Integer sumNullableInteger(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.sumNullableInteger(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public long sumLong(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.sumLong(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public Long sumNullableLong(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.sumNullableLong(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public float sumFloat(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.sumFloat(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public Float sumNullableFloat(final Queryable source,
      final FunctionExpression> selector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.sumNullableFloat(source, selector);
      }
    }.castSingle(); // CHECKSTYLE: IGNORE 0
  }

  public Queryable take(final Queryable source, final int count) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.take(source, count);
      }
    };
  }

  public Queryable takeWhile(final Queryable source,
      final FunctionExpression> predicate) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.takeWhile(source, predicate);
      }
    };
  }

  public Queryable takeWhileN(final Queryable source,
      final FunctionExpression> predicate) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.takeWhileN(source, predicate);
      }
    };
  }

  public > OrderedQueryable thenBy(
      final OrderedQueryable source,
      final FunctionExpression> keySelector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.thenBy(source, keySelector);
      }
    };
  }

  public  OrderedQueryable thenBy(final OrderedQueryable source,
      final FunctionExpression> keySelector,
      final Comparator comparator) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.thenBy(source, keySelector, comparator);
      }
    };
  }

  public > OrderedQueryable thenByDescending(
      final OrderedQueryable source,
      final FunctionExpression> keySelector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.thenByDescending(source, keySelector);
      }
    };
  }

  public  OrderedQueryable thenByDescending(
      final OrderedQueryable source,
      final FunctionExpression> keySelector,
      final Comparator comparator) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.thenByDescending(source, keySelector, comparator);
      }
    };
  }

  public Queryable union(final Queryable source,
      final Enumerable source1) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.union(source, source1);
      }
    };
  }

  public Queryable union(final Queryable source,
      final Enumerable source1, final EqualityComparer comparer) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.union(source, source1, comparer);
      }
    };
  }

  public Queryable where(final Queryable source,
      final FunctionExpression> predicate) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.where(source, predicate);
      }
    };
  }

  public Queryable whereN(final Queryable source,
      final FunctionExpression> predicate) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.whereN(source, predicate);
      }
    };
  }

  public  Queryable zip(final Queryable source,
      final Enumerable source1,
      final FunctionExpression> resultSelector) {
    return new NonLeafReplayableQueryable(source) {
      public void replay(QueryableFactory factory) {
        factory.zip(source, source1, resultSelector);
      }
    }.castQueryable(); // CHECKSTYLE: IGNORE 0
  }
}

// End QueryableRecorder.java




© 2015 - 2024 Weber Informatics LLC | Privacy Policy