当前位置: 首页>>代码示例>>Java>>正文


Java Linq4j类代码示例

本文整理汇总了Java中net.hydromatic.linq4j.Linq4j的典型用法代码示例。如果您正苦于以下问题:Java Linq4j类的具体用法?Java Linq4j怎么用?Java Linq4j使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Linq4j类属于net.hydromatic.linq4j包,在下文中一共展示了Linq4j类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: JsonEnumerator

import net.hydromatic.linq4j.Linq4j; //导入依赖的package包/类
public JsonEnumerator(File file) {
  try {
    final ObjectMapper mapper = new ObjectMapper();
    mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
    mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
    mapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
    //noinspection unchecked
    List<Object> list = mapper.readValue(file, List.class);
    enumerator = Linq4j.enumerator(list);
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:apache,项目名称:incubator-optiq-csv,代码行数:14,代码来源:JsonEnumerator.java

示例2: filter

import net.hydromatic.linq4j.Linq4j; //导入依赖的package包/类
public static <K, V> MapStream<K, V> filter(final MapStream<K, V> s,
    final BiPredicate<? super K, ? super V> predicate) {
  return new AbstractMapStream<K, V>() {
    public Iterable<BiValue<K, V>> asIterable() {
      final Enumerator<BiValue<K, V>> enumerator =
          Linq4j.iterableEnumerator(s);
      final Enumerator<BiValue<K, V>> enumerator2 =
          new Enumerator<BiValue<K, V>>() {
            public BiValue<K, V> current() {
              return enumerator.current();
            }

            public boolean moveNext() {
              while (enumerator.moveNext()) {
                BiValue<K, V> o = enumerator.current();
                if (predicate.eval(o.getKey(), o.getValue())) {
                  return true;
                }
              }
              return false;
            }

            public void reset() {
              enumerator.reset();
            }

            public void close() {
              enumerator.close();
            }
          };
      return new Iterable<BiValue<K, V>>() {
        public Iterator<BiValue<K, V>> iterator() {
          return Linq4j.enumeratorIterator(enumerator2);
        }
      };
    }
  };
}
 
开发者ID:apache,项目名称:incubator-optiq-linq4j,代码行数:39,代码来源:MapStream.java

示例3: substitute

import net.hydromatic.linq4j.Linq4j; //导入依赖的package包/类
public static <T> Mapper<T, T> substitute(final T subOut, final T subIn) {
  return new Mapper<T, T>() {
    public T map(T t) {
      return Linq4j.equals(subOut, t) ? subIn : t;
    }

    public <V> Mapper<T, V> compose(Mapper<? super T, ? extends V> after) {
      return chain(this, after);
    }
  };
}
 
开发者ID:apache,项目名称:incubator-optiq-linq4j,代码行数:12,代码来源:Mappers.java

示例4: visit

import net.hydromatic.linq4j.Linq4j; //导入依赖的package包/类
public Expression visit(NewExpression newExpression,
    List<Expression> arguments, List<MemberDeclaration> memberDeclarations) {
  return arguments.equals(newExpression.arguments)
      && Linq4j.equals(memberDeclarations, newExpression.memberDeclarations)
      ? newExpression
      : Expressions.new_(newExpression.type, arguments, memberDeclarations);
}
 
开发者ID:apache,项目名称:incubator-optiq-linq4j,代码行数:8,代码来源:Visitor.java

示例5: testAssign2

import net.hydromatic.linq4j.Linq4j; //导入依赖的package包/类
@Test public void testAssign2() {
  // long x = 0;
  // final long y = System.currentTimeMillis();
  // if (System.currentTimeMillis() > 0) {
  //   x = y;
  // }
  //
  // Make sure we don't fold two calls to System.currentTimeMillis into one.
  final ParameterExpression x_ = Expressions.parameter(long.class, "x");
  final ParameterExpression y_ = Expressions.parameter(long.class, "y");
  final Method mT = Linq4j.getMethod("java.lang.System", "currentTimeMillis");
  final ConstantExpression zero = Expressions.constant(0L);
  assertThat(
      optimize(
          Expressions.block(
              Expressions.declare(0, x_, zero),
              Expressions.declare(Modifier.FINAL, y_, Expressions.call(mT)),
              Expressions.ifThen(
                  Expressions.greaterThan(Expressions.call(mT), zero),
                  Expressions.statement(Expressions.assign(x_, y_))))),
      equalTo(
          "{\n"
          + "  long x = 0L;\n"
          + "  if (System.currentTimeMillis() > 0L) {\n"
          + "    x = System.currentTimeMillis();\n"
          + "  }\n"
          + "}\n"));
}
 
开发者ID:apache,项目名称:incubator-optiq-linq4j,代码行数:29,代码来源:OptimizerTest.java

示例6: apply

import net.hydromatic.linq4j.Linq4j; //导入依赖的package包/类
public void apply(Object o) {
  Linq4j.requireNonNull(o);
}
 
开发者ID:apache,项目名称:incubator-optiq-linq4j,代码行数:4,代码来源:Blocks.java

示例7: equal

import net.hydromatic.linq4j.Linq4j; //导入依赖的package包/类
public boolean equal(Object v1, Object v2) {
  return Linq4j.equals(v1, v2);
}
 
开发者ID:apache,项目名称:incubator-optiq-linq4j,代码行数:4,代码来源:Functions.java

示例8: testAssign

import net.hydromatic.linq4j.Linq4j; //导入依赖的package包/类
@Test public void testAssign() {
  // long x = 0;
  // final long y = System.currentTimeMillis();
  // if (System.nanoTime() > 0) {
  //   x = y;
  // }
  // System.out.println(x);
  //
  // In bug https://github.com/julianhyde/linq4j/issues/27, this was
  // incorrectly optimized to
  //
  // if (System.nanoTime() > 0L) {
  //    System.currentTimeMillis();
  // }
  // System.out.println(0L);
  final ParameterExpression x_ = Expressions.parameter(long.class, "x");
  final ParameterExpression y_ = Expressions.parameter(long.class, "y");
  final Method mT = Linq4j.getMethod("java.lang.System", "currentTimeMillis");
  final Method mNano = Linq4j.getMethod("java.lang.System", "nanoTime");
  final ConstantExpression zero = Expressions.constant(0L);
  assertThat(
      optimize(
          Expressions.block(
              Expressions.declare(0, x_, zero),
              Expressions.declare(Modifier.FINAL, y_, Expressions.call(mT)),
              Expressions.ifThen(
                  Expressions.greaterThan(Expressions.call(mNano), zero),
                  Expressions.statement(Expressions.assign(x_, y_))),
              Expressions.statement(
                  Expressions.call(
                      Expressions.field(null, System.class, "out"),
                      "println",
                      x_)))),
      equalTo(
          "{\n"
          + "  long x = 0L;\n"
          + "  if (System.nanoTime() > 0L) {\n"
          + "    x = System.currentTimeMillis();\n"
          + "  }\n"
          + "  System.out.println(x);\n"
          + "}\n"));
}
 
开发者ID:apache,项目名称:incubator-optiq-linq4j,代码行数:43,代码来源:OptimizerTest.java

示例9: iterator

import net.hydromatic.linq4j.Linq4j; //导入依赖的package包/类
@Override
public Iterator<T> iterator() {
	return Linq4j.enumeratorIterator(enumerator());
}
 
开发者ID:joshelser,项目名称:cosmos,代码行数:5,代码来源:DataTable.java

示例10: enumerator

import net.hydromatic.linq4j.Linq4j; //导入依赖的package包/类
@Override
public Enumerator<T> enumerator() {

	return Linq4j.enumerator(new ArrayList<T>());
}
 
开发者ID:joshelser,项目名称:cosmos,代码行数:6,代码来源:DataTable.java

示例11: accumulate

import net.hydromatic.linq4j.Linq4j; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Enumerable<T> accumulate(List<String> fieldNames) {
	Plan query = plans.poll();

	Plan aggregatePlan = aggregationPlans.poll();

	Preconditions.checkNotNull(query);

	resultSet = (BaseIterable<T>) metadata.iterator(fieldNames, query,
			aggregatePlan);

	return Linq4j.asEnumerable(resultSet);
}
 
开发者ID:joshelser,项目名称:cosmos,代码行数:14,代码来源:DataTable.java


注:本文中的net.hydromatic.linq4j.Linq4j类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。