本文整理汇总了Java中net.hydromatic.linq4j.function.Function1类的典型用法代码示例。如果您正苦于以下问题:Java Function1类的具体用法?Java Function1怎么用?Java Function1使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Function1类属于net.hydromatic.linq4j.function包,在下文中一共展示了Function1类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkSql
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
private void checkSql(String sql, String model, Function1<ResultSet, Void> fn)
throws SQLException {
Connection connection = null;
Statement statement = null;
try {
Properties info = new Properties();
info.put("model", "target/test-classes/" + model + ".json");
connection = DriverManager.getConnection("jdbc:optiq:", info);
statement = connection.createStatement();
final ResultSet resultSet =
statement.executeQuery(
sql);
fn.apply(resultSet);
} finally {
close(connection, statement);
}
}
开发者ID:OSBI,项目名称:optiq-solr,代码行数:18,代码来源:CsvTest.java
示例2: checkSql
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
private void checkSql(String sql, String model, Function1<ResultSet, Void> fn)
throws SQLException {
Connection connection = null;
Statement statement = null;
try {
Properties info = new Properties();
info.put("model", "target/test-classes/" + model + ".json");
connection = DriverManager.getConnection("jdbc:optiq:", info);
statement = connection.createStatement();
final ResultSet resultSet =
statement.executeQuery(
sql);
fn.apply(resultSet);
} finally {
close(connection, statement);
}
}
开发者ID:apache,项目名称:incubator-optiq-csv,代码行数:18,代码来源:CsvTest.java
示例3: checkSql
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
private void checkSql(String model, String sql, final String expected)
throws SQLException {
checkSql(sql, model, new Function1<ResultSet, Void>() {
public Void apply(ResultSet resultSet) {
try {
String actual = SQLTest.toString(resultSet);
if (!expected.equals(actual)) {
System.out.println("Assertion failure:");
System.out.println("\tExpected: '" + expected + "'");
System.out.println("\tActual: '" + actual + "'");
}
assertTrue(expected.equals(actual));
} catch (SQLException e) {
throw new RuntimeException(e);
}
return null;
}
});
}
开发者ID:HenryOlson,项目名称:optiq-web,代码行数:20,代码来源:SQLTest.java
示例4: accept
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
public void accept(ExpressionWriter writer) {
String modifiers = Modifier.toString(modifier);
writer.append(modifiers);
if (!modifiers.isEmpty()) {
writer.append(' ');
}
writer
.append(resultType)
.append(' ')
.append(name)
.list("(", ", ", ")",
Functions.adapt(parameters,
new Function1<ParameterExpression, String>() {
public String apply(ParameterExpression a0) {
return a0.declString();
}
}))
.append(' ')
.append(body);
writer.newlineAndIndent();
}
开发者ID:apache,项目名称:incubator-optiq-linq4j,代码行数:22,代码来源:MethodDeclaration.java
示例5: testCompile
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
@Test public void testCompile() throws NoSuchMethodException {
// Creating a parameter for the expression tree.
ParameterExpression param = Expressions.parameter(String.class);
// Creating an expression for the method call and specifying its
// parameter.
MethodCallExpression methodCall =
Expressions.call(
Integer.class,
"valueOf",
Collections.<Expression>singletonList(param));
// The following statement first creates an expression tree,
// then compiles it, and then runs it.
int x =
Expressions.<Function1<String, Integer>>lambda(
methodCall,
new ParameterExpression[] { param })
.getFunction()
.apply("1234");
assertEquals(1234, x);
}
开发者ID:apache,项目名称:incubator-optiq-linq4j,代码行数:23,代码来源:ExpressionTest.java
示例6: StratosphereSqlProjectionMapOperator
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
public StratosphereSqlProjectionMapOperator(Function1<DataContext, Object[]> function,
Set<StratosphereRexUtils.ProjectionFieldProperties> fields, String sourceCode) {
this.function = function;
this.fields = fields;
for(StratosphereRexUtils.ProjectionFieldProperties f: fields) {
if(f.trivialProjection) {
continue;
}
isTrivial = false;
break;
}
if(!isTrivial) {
String newSrc = "public class "+RexExecutable.GENERATED_CLASS_NAME+" "
+ "implements net.hydromatic.linq4j.function.Function1, java.io.Serializable { "+sourceCode+" }";
try {
map.put(RexExecutable.GENERATED_CLASS_NAME+".java", newSrc.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Error while encoding the generated source", e);
}
}
}
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:23,代码来源:StratosphereSqlProjection.java
示例7: checkSql
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
private void checkSql(String sql, String model, Function1<ResultSet, Void> fn)
throws SQLException {
Connection connection = null;
Statement statement = null;
try {
Properties info = new Properties();
info.put("model", "target/test-classes/" + model + ".json");
connection = DriverManager.getConnection("jdbc:calcite:", info);
statement = connection.createStatement();
final ResultSet resultSet =
statement.executeQuery(
sql);
fn.apply(resultSet);
} finally {
close(connection, statement);
}
}
开发者ID:julianhyde,项目名称:optiq-csv,代码行数:18,代码来源:CsvTest.java
示例8: output
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
private Function1<ResultSet, Void> output() {
return new Function1<ResultSet, Void>() {
public Void apply(ResultSet resultSet) {
try {
output(resultSet, System.out);
} catch (SQLException e) {
throw new RuntimeException(e);
}
return null;
}
};
}
开发者ID:apache,项目名称:incubator-optiq-csv,代码行数:13,代码来源:CsvTest.java
示例9: expect
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
/** Returns a function that checks the contents of a result set against an
* expected string. */
private static Function1<ResultSet, Void> expect(final String... expected) {
return new Function1<ResultSet, Void>() {
public Void apply(ResultSet resultSet) {
try {
final List<String> lines = new ArrayList<String>();
CsvTest.collect(lines, resultSet);
Assert.assertEquals(Arrays.asList(expected), lines);
} catch (SQLException e) {
throw new RuntimeException(e);
}
return null;
}
};
}
开发者ID:apache,项目名称:incubator-optiq-csv,代码行数:17,代码来源:CsvTest.java
示例10: readObject
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
private void readObject(java.io.ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
if(!isTrivial) {
// initialize generated code.
ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
ResourceFinder srcFinder = new MapResourceFinder(map);
JavaSourceClassLoader janinoClassLoader = new JavaSourceClassLoader(currentClassLoader, srcFinder, "UTF-8");
Thread.currentThread().setContextClassLoader(janinoClassLoader);
Class<Function1> gen = (Class<Function1>) Class.forName(RexExecutable.GENERATED_CLASS_NAME, true, janinoClassLoader);
function = InstantiationUtil.instantiate(gen, Function1.class);
}
}
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:14,代码来源:StratosphereSqlProjection.java
示例11: prepareEvaluation
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
public void prepareEvaluation() {
try {
this.function = (Function1<DataContext, Object[]>) ClassBodyEvaluator.createFastClassBodyEvaluator(
new Scanner(null, new StringReader(source)),
RexExecutable.GENERATED_CLASS_NAME,
Utilities.class,
new Class[]{Function1.class , Serializable.class},
getClass().getClassLoader());
} catch (Exception e) {
throw new RuntimeException("Error while compiling the generated code");
}
}
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:13,代码来源:Filter.java
示例12: listToEnumerable
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
/** Returns a lambda that converts a list to an enumerable. */
public static <E> Function1<List<E>, Enumerable<E>> listToEnumerable() {
//noinspection unchecked
return (Function1<List<E>, Enumerable<E>>) (Function1) LIST_AS_ENUMERABLE;
}
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:6,代码来源:SqlFunctions.java
示例13: ClassDeclarationFinder
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
/**
* Creates optimizer with no parent.
*/
private ClassDeclarationFinder(
Function1<ClassDeclarationFinder, ClassDeclarationFinder> childFactory) {
this.parent = null;
this.childFactory = childFactory;
}
开发者ID:apache,项目名称:incubator-optiq-linq4j,代码行数:9,代码来源:ClassDeclarationFinder.java
示例14: thenBy
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
/**
* Performs a subsequent ordering of the elements in a sequence in
* ascending order according to a key.
*/
<TKey extends Comparable<TKey>> OrderedQueryable<T> thenBy(
FunctionExpression<Function1<T, TKey>> keySelector);
开发者ID:apache,项目名称:incubator-optiq-linq4j,代码行数:7,代码来源:ExtendedOrderedQueryable.java
示例15: thenByDescending
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
/**
* Performs a subsequent ordering of the elements in a sequence in
* descending order according to a key.
*/
<TKey extends Comparable<TKey>> OrderedQueryable<T> thenByDescending(
FunctionExpression<Function1<T, TKey>> keySelector);
开发者ID:apache,项目名称:incubator-optiq-linq4j,代码行数:7,代码来源:ExtendedOrderedQueryable.java
示例16: createOrderedEnumerable
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
/**
* Performs a subsequent ordering of the elements in an
* {@link OrderedEnumerable} according to a key, using a specified
* comparator.
*
* <p>The functionality provided by this method is like that provided by
* {@link #thenBy(net.hydromatic.linq4j.function.Function1, java.util.Comparator) thenBy}
* or {@link #thenByDescending(net.hydromatic.linq4j.function.Function1, java.util.Comparator) thenByDescending},
* depending on whether descending is true or false. They both perform a
* subordinate ordering of an already sorted sequence of type
* {@link OrderedEnumerable}.</p>
*/
<TKey> OrderedEnumerable<T> createOrderedEnumerable(
Function1<T, TKey> keySelector, Comparator<TKey> comparator,
boolean descending);
开发者ID:apache,项目名称:incubator-optiq-linq4j,代码行数:16,代码来源:ExtendedOrderedEnumerable.java
示例17: thenBy
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
/**
* Performs a subsequent ordering of the elements in a sequence in
* ascending order according to a key.
*/
<TKey extends Comparable<TKey>> OrderedEnumerable<T> thenBy(
Function1<T, TKey> keySelector);
开发者ID:apache,项目名称:incubator-optiq-linq4j,代码行数:7,代码来源:ExtendedOrderedEnumerable.java
示例18: thenByDescending
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
/**
* Performs a subsequent ordering of the elements in a sequence in
* descending order according to a key.
*/
<TKey extends Comparable<TKey>> OrderedEnumerable<T> thenByDescending(
Function1<T, TKey> keySelector);
开发者ID:apache,项目名称:incubator-optiq-linq4j,代码行数:7,代码来源:ExtendedOrderedEnumerable.java
示例19: create
import net.hydromatic.linq4j.function.Function1; //导入依赖的package包/类
/**
* Creates visitor that uses given factory to create optimizers.
*
* @param childFactory factory that creates optimizers
* @return optimizing visitor
*/
public static ClassDeclarationFinder create(
Function1<ClassDeclarationFinder, ClassDeclarationFinder> childFactory) {
return new ClassDeclarationFinder(childFactory);
}
开发者ID:apache,项目名称:incubator-optiq-linq4j,代码行数:11,代码来源:ClassDeclarationFinder.java
注:本文中的net.hydromatic.linq4j.function.Function1类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论