本文整理汇总了Java中net.hydromatic.linq4j.Enumerator类的典型用法代码示例。如果您正苦于以下问题:Java Enumerator类的具体用法?Java Enumerator怎么用?Java Enumerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Enumerator类属于net.hydromatic.linq4j包,在下文中一共展示了Enumerator类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: cursor
import net.hydromatic.linq4j.Enumerator; //导入依赖的package包/类
public Cursor cursor(Enumerator<T> enumerator) {
// noinspection unchecked
return new EnumeratorCursor<T>(enumerator) {
protected Getter createGetter(final int ordinal) {
return new Getter() {
public Object getObject() {
return get(current(), ordinal);
}
public boolean wasNull() {
return getObject() == null;
}
};
}
};
}
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:17,代码来源:KylinMetaImpl.java
示例2: getElementType
import net.hydromatic.linq4j.Enumerator; //导入依赖的package包/类
/**
* Returns the element type of a {@link Collection}, {@link Iterable}
* (including {@link net.hydromatic.linq4j.Queryable Queryable} and
* {@link net.hydromatic.linq4j.Enumerable Enumerable}), {@link Iterator},
* {@link Enumerator}, or an array.
*
* <p>Returns null if the type is not one of these.</p>
*/
public static Type getElementType(Type type) {
if (type instanceof ArrayType) {
return ((ArrayType) type).getComponentType();
}
if (type instanceof GenericArrayType) {
return ((GenericArrayType) type).getGenericComponentType();
}
Class clazz = toClass(type);
if (clazz.isArray()) {
return clazz.getComponentType();
}
if (Collection.class.isAssignableFrom(clazz)
|| Iterable.class.isAssignableFrom(clazz)
|| Iterator.class.isAssignableFrom(clazz)
|| Enumerator.class.isAssignableFrom(clazz)) {
if (type instanceof ParameterizedType) {
return ((ParameterizedType) type).getActualTypeArguments()[0];
}
return Object.class;
}
return null;
}
开发者ID:apache,项目名称:incubator-optiq-linq4j,代码行数:31,代码来源:Types.java
示例3: enumerator
import net.hydromatic.linq4j.Enumerator; //导入依赖的package包/类
public Enumerator<Object[]> enumerator() {
OLAPContext olapContext = OLAPContext.getThreadLocalContextById(contextId);
switch (type) {
case INDEX:
return new CubeEnumerator(olapContext, optiqContext);
case LOOKUP_TABLE:
return new LookupTableEnumerator(olapContext);
case HIVE:
return new HiveEnumerator(olapContext);
default:
throw new IllegalArgumentException("Wrong type " + type + "!");
}
}
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:14,代码来源:OLAPQuery.java
示例4: asQueryable
import net.hydromatic.linq4j.Enumerator; //导入依赖的package包/类
@Override
public <T> Queryable<T> asQueryable(QueryProvider queryProvider, SchemaPlus schema, String tableName) {
return new AbstractTableQueryable<T>(queryProvider, schema, this, tableName) {
@SuppressWarnings("unchecked")
public Enumerator<T> enumerator() {
final OLAPQuery query = new OLAPQuery(EnumeratorTypeEnum.INDEX, 0);
return (Enumerator<T>) query.enumerator();
}
};
}
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:11,代码来源:OLAPTable.java
示例5: PrepareResult
import net.hydromatic.linq4j.Enumerator; //导入依赖的package包/类
public PrepareResult(String sql, List<AvaticaParameter> parameterList, Enumerator<Object[]> enumerator, ColumnMetaData.StructType structType) {
super();
this.sql = sql;
this.parameterList = parameterList;
this.enumerator = enumerator;
this.structType = structType;
}
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:8,代码来源:KylinPrepare.java
示例6: prepare
import net.hydromatic.linq4j.Enumerator; //导入依赖的package包/类
public AvaticaPrepareResult prepare(AvaticaStatement statement, String sql) {
RemoteClient client = factory.newRemoteClient(conn);
DataSet<Object[]> result = null;
try {
result = (DataSet<Object[]>) client.query(statement, sql);
} catch (Exception e) {
logger.error(e.getLocalizedMessage(), e);
throw new RuntimeException("Failed to query kylin server with exception " + e.getLocalizedMessage());
}
return new KylinPrepare.PrepareResult(sql, null, (Enumerator<Object[]>) result.getEnumerator(), ColumnMetaData.struct(result.getMeta()));
}
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:14,代码来源:KylinMetaImpl.java
示例7: query
import net.hydromatic.linq4j.Enumerator; //导入依赖的package包/类
@Override
public DataSet<Object[]> query(AvaticaStatement statement, String sql) {
List<Object[]> data = new ArrayList<Object[]>();
Object[] row = new Object[] { "foo", "bar", "tool" };
data.add(row);
Enumerator<Object[]> enumerator = new KylinEnumerator<Object[]>(data);
List<ColumnMetaData> meta = new ArrayList<ColumnMetaData>();
meta.add(ColumnMetaData.dummy(ColumnMetaData.scalar(Types.VARCHAR, "varchar", Rep.STRING), true));
meta.add(ColumnMetaData.dummy(ColumnMetaData.scalar(Types.VARCHAR, "varchar", Rep.STRING), true));
meta.add(ColumnMetaData.dummy(ColumnMetaData.scalar(Types.VARCHAR, "varchar", Rep.STRING), true));
return new DataSet<Object[]>(meta, enumerator);
}
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:14,代码来源:DummyClient.java
示例8: filter
import net.hydromatic.linq4j.Enumerator; //导入依赖的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
示例9: DataSet
import net.hydromatic.linq4j.Enumerator; //导入依赖的package包/类
/**
* @param meta
* @param enumerator
*/
public DataSet(List<ColumnMetaData> meta, Enumerator<E> enumerator) {
this.meta = meta;
this.enumerator = enumerator;
}
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:9,代码来源:DataSet.java
示例10: getEnumerator
import net.hydromatic.linq4j.Enumerator; //导入依赖的package包/类
public Enumerator<E> getEnumerator() {
return enumerator;
}
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:4,代码来源:DataSet.java
示例11: enumerator
import net.hydromatic.linq4j.Enumerator; //导入依赖的package包/类
@Override
public Enumerator<T> enumerator() {
return Linq4j.enumerator(new ArrayList<T>());
}
开发者ID:joshelser,项目名称:cosmos,代码行数:6,代码来源:DataTable.java
注:本文中的net.hydromatic.linq4j.Enumerator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论