Java Code Examples for org.eclipse.xtext.xbase.XSetLiteral#getElements()

The following examples show how to use org.eclipse.xtext.xbase.XSetLiteral#getElements() . 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: PyExpressionGenerator.java    From sarl with Apache License 2.0 6 votes vote down vote up
/** Generate the given object.
 *
 * @param literal the set literal.
 * @param it the target for the generated content.
 * @param context the context.
 * @return the literal.
 */
protected XExpression _generate(XSetLiteral literal, IAppendable it, IExtraLanguageGeneratorContext context) {
	appendReturnIfExpectedReturnedExpression(it, context);
	it.append("{"); //$NON-NLS-1$
	boolean first = true;
	for (final XExpression value : literal.getElements()) {
		if (first) {
			first = false;
		} else {
			it.append(", "); //$NON-NLS-1$
		}
		generate(value, it, context);
	}
	it.append("}"); //$NON-NLS-1$
	return literal;
}
 
Example 2
Source File: XbaseCompiler.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @param isReferenced unused in this context but necessary for dispatch signature 
 */
protected void _toJavaStatement(final XSetLiteral literal, ITreeAppendable b, boolean isReferenced) {
	for(XExpression element: literal.getElements()) 
		internalToJavaStatement(element, b, true);
}