Java Code Examples for org.eclipse.xtext.xbase.lib.Functions#Function0

The following examples show how to use org.eclipse.xtext.xbase.lib.Functions#Function0 . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClosureClient.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.3
 */
public String concatStrings(Functions.Function0<String> function1, Functions.Function0<String> function2) {
	StringBuilder result = new StringBuilder("twoArgs:");
	result.append(function1.apply());
	result.append(function2.apply());
	return result.toString();
}
 
Example 2
Source File: ClosureClient.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.3
 */
@SafeVarargs
public final String concatStrings(Functions.Function0<String>... functions) {
	StringBuilder result = new StringBuilder("varArgs:");
	for(Functions.Function0<String> function: functions) {
		result.append(function.apply());
	}
	return result.toString();
}
 
Example 3
Source File: ClosureClient.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.3
 */
public String concatStrings(Functions.Function0<String> function1, Functions.Function0<String> function2) {
	StringBuilder result = new StringBuilder("twoArgs:");
	result.append(function1.apply());
	result.append(function2.apply());
	return result.toString();
}
 
Example 4
Source File: EvaluationCompilerTest.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected Functions.Function0<Object> compile(String code) {
	String javaCode = compileToJavaCode(code);
	try {
		Function0<Object> function = javaCompiler.createFunction(javaCode, Object.class);
		return function;
	} catch (Exception e) {
		throw new RuntimeException("Java compilation failed. Java code was : \n" + javaCode, e);
	}
}
 
Example 5
Source File: ClosureClient2.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@SafeVarargs
public ClosureClient2(Functions.Function0<String>... functions) {
	StringBuilder builder = new StringBuilder("varArgs:");
	for(Functions.Function0<String> function: functions) {
		builder.append(function.apply());
	}
	value = builder.toString();
}
 
Example 6
Source File: ClosureClient.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.3
 */
@SuppressWarnings("unchecked")
public String concatStrings(Functions.Function0<String>... functions) {
	StringBuilder result = new StringBuilder("varArgs:");
	for(Functions.Function0<String> function: functions) {
		result.append(function.apply());
	}
	return result.toString();
}
 
Example 7
Source File: ClosureClient2.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@SafeVarargs
public ClosureClient2(Functions.Function0<String>... functions) {
	StringBuilder builder = new StringBuilder("varArgs:");
	for(Functions.Function0<String> function: functions) {
		builder.append(function.apply());
	}
	value = builder.toString();
}
 
Example 8
Source File: ClosureClient.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.3
 */
@SafeVarargs
public final String concatStrings(Functions.Function0<String>... functions) {
	StringBuilder result = new StringBuilder("varArgs:");
	for(Functions.Function0<String> function: functions) {
		result.append(function.apply());
	}
	return result.toString();
}
 
Example 9
Source File: ClosureClient.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.3
 */
public String concatStrings(Functions.Function0<String> function1, Functions.Function0<String> function2) {
	StringBuilder result = new StringBuilder("twoArgs:");
	result.append(function1.apply());
	result.append(function2.apply());
	return result.toString();
}
 
Example 10
Source File: ClosureClient.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public <T> T invoke0(Functions.Function0<T> fun) {
	return fun.apply();
}
 
Example 11
Source File: ClosureClient.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public void infiniteApply(Functions.Function0<Object> fun) {
	while(true) {
		fun.apply();
	}
}
 
Example 12
Source File: ClosureClient.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void infiniteApply(Functions.Function0<Object> fun) {
	while(true) {
		fun.apply();
	}
}
 
Example 13
Source File: ClosureClient.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public <T> T invoke0(Functions.Function0<T> fun) {
	return fun.apply();
}
 
Example 14
Source File: ClosureClient2.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public ClosureClient2(Functions.Function0<String> function1, Functions.Function0<String> function2) {
	StringBuilder builder = new StringBuilder("twoArgs:");
	builder.append(function1.apply());
	builder.append(function2.apply());
	value = builder.toString();
}
 
Example 15
Source File: ClosureClient.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public void infiniteApply(Functions.Function0<Object> fun) {
	while(true) {
		fun.apply();
	}
}
 
Example 16
Source File: ClosureClient2.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public ClosureClient2(Functions.Function0<String> function1, Functions.Function0<String> function2) {
	StringBuilder builder = new StringBuilder("twoArgs:");
	builder.append(function1.apply());
	builder.append(function2.apply());
	value = builder.toString();
}
 
Example 17
Source File: OnTheFlyJavaCompiler.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public <RT> Functions.Function0<RT> createFunction(String expression,
		Class<RT> returnType) {
	return (Function0<RT>) internalCreateFunction(expression, returnType);
}
 
Example 18
Source File: ClosureClient.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public void infiniteApply(Functions.Function0<Object> fun) {
	while(true) {
		fun.apply();
	}
}
 
Example 19
Source File: ClosureClient.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public <T> T invoke0(Functions.Function0<T> fun) {
	return fun.apply();
}
 
Example 20
Source File: ClosureClient2.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public ClosureClient2(Functions.Function0<String> function1, Functions.Function0<String> function2) {
	StringBuilder builder = new StringBuilder("twoArgs:");
	builder.append(function1.apply());
	builder.append(function2.apply());
	value = builder.toString();
}