本文整理汇总了Java中org.apache.calcite.linq4j.Enumerator.moveNext方法的典型用法代码示例。如果您正苦于以下问题:Java Enumerator.moveNext方法的具体用法?Java Enumerator.moveNext怎么用?Java Enumerator.moveNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.linq4j.Enumerator
的用法示例。
在下文中一共展示了Enumerator.moveNext方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDefaultIfEmpty
import org.apache.calcite.linq4j.Enumerator; //导入方法依赖的package包/类
@Test public void testDefaultIfEmpty() {
final List<String> experience = Arrays.asList("jimi", "mitch", "noel");
final Enumerable<String> notEmptyEnumerable = Linq4j.asEnumerable(experience).defaultIfEmpty();
final Enumerator<String> notEmptyEnumerator = notEmptyEnumerable.enumerator();
notEmptyEnumerator.moveNext();
assertEquals("jimi", notEmptyEnumerator.current());
notEmptyEnumerator.moveNext();
assertEquals("mitch", notEmptyEnumerator.current());
notEmptyEnumerator.moveNext();
assertEquals("noel", notEmptyEnumerator.current());
final Enumerable<String> emptyEnumerable =
Linq4j.asEnumerable(Linq4j.<String>emptyEnumerable()).defaultIfEmpty();
final Enumerator<String> emptyEnumerator = emptyEnumerable.enumerator();
assertTrue(emptyEnumerator.moveNext());
assertNull(emptyEnumerator.current());
assertFalse(emptyEnumerator.moveNext());
}
示例2: testDefaultIfEmpty2
import org.apache.calcite.linq4j.Enumerator; //导入方法依赖的package包/类
@Test public void testDefaultIfEmpty2() {
final List<String> experience = Arrays.asList("jimi", "mitch", "noel");
final Enumerable<String> notEmptyEnumerable =
Linq4j.asEnumerable(experience).defaultIfEmpty("dummy");
final Enumerator<String> notEmptyEnumerator = notEmptyEnumerable.enumerator();
notEmptyEnumerator.moveNext();
assertEquals("jimi", notEmptyEnumerator.current());
notEmptyEnumerator.moveNext();
assertEquals("mitch", notEmptyEnumerator.current());
notEmptyEnumerator.moveNext();
assertEquals("noel", notEmptyEnumerator.current());
final Enumerable<String> emptyEnumerable =
Linq4j.asEnumerable(Linq4j.<String>emptyEnumerable()).defaultIfEmpty("N/A");
final Enumerator<String> emptyEnumerator = emptyEnumerable.enumerator();
assertTrue(emptyEnumerator.moveNext());
assertEquals("N/A", emptyEnumerator.current());
assertFalse(emptyEnumerator.moveNext());
}
示例3: count
import org.apache.calcite.linq4j.Enumerator; //导入方法依赖的package包/类
private static int count(Enumerator<String> enumerator) {
int n = 0;
while (enumerator.moveNext()) {
if (enumerator.current() != null) {
++n;
}
}
return n;
}
示例4: checkResults
import org.apache.calcite.linq4j.Enumerator; //导入方法依赖的package包/类
private void checkResults(Enumerator<Integer[]> e, Integer[][] expected) {
List<Integer[]> res = Lists.newArrayList();
while (e.moveNext()) {
res.add(e.current());
}
Integer[][] actual = res.toArray(new Integer[res.size()][]);
assertArrayEquals(expected, actual);
}
示例5: implement
import org.apache.calcite.linq4j.Enumerator; //导入方法依赖的package包/类
public Node implement(final InterpreterImplementor implementor) {
return new Node() {
public void run() throws InterruptedException {
final Sink sink =
implementor.relSinks.get(EnumerableBindable.this).get(0);
final Enumerable<Object[]> enumerable = bind(implementor.dataContext);
final Enumerator<Object[]> enumerator = enumerable.enumerator();
while (enumerator.moveNext()) {
sink.send(Row.asCopy(enumerator.current()));
}
}
};
}
示例6: run
import org.apache.calcite.linq4j.Enumerator; //导入方法依赖的package包/类
public void run() throws InterruptedException {
final Enumerator<Object[]> enumerator = enumerable.enumerator();
while (enumerator.moveNext()) {
Object[] values = enumerator.current();
sink.send(Row.of(values));
}
}
示例7: size
import org.apache.calcite.linq4j.Enumerator; //导入方法依赖的package包/类
@Override public int size() {
int n = 0;
Enumerator<Integer> e = enumerator();
while (e.moveNext()) {
++n;
}
return n;
}
示例8: setSourceEnumerable
import org.apache.calcite.linq4j.Enumerator; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override public void setSourceEnumerable(Enumerable<Row> enumerable)
throws InterruptedException {
// just copy over the source into the local list
final Enumerator<Row> enumerator = enumerable.enumerator();
while (enumerator.moveNext()) {
this.send(enumerator.current());
}
enumerator.close();
}