use of org.eclipse.xtext.xbase.lib.IntegerRange in project xtext-xtend by eclipse.
the class Case_0 method foo.
public String foo(final String a, final String b) {
String _xblockexpression = null;
{
ArrayList<String> list = CollectionLiterals.<String>newArrayList();
int _size = list.size();
int _minus = (_size - 1);
IntegerRange _upTo = new IntegerRange(0, _minus);
for (final Integer i : _upTo) {
String _string = i.toString();
String _plus = (_string + " ");
String _get = list.get((i).intValue());
String _plus_1 = (_plus + _get);
InputOutput.<String>println(_plus_1);
}
String _xifexpression = null;
boolean _isUpper = this.isUpper(a);
if (_isUpper) {
_xifexpression = this.another(a, (b + "holla"));
} else {
String _xblockexpression_1 = null;
{
String x = a;
char[] _charArray = b.toCharArray();
for (final char y : _charArray) {
x = (x + Character.valueOf(y));
}
_xblockexpression_1 = x;
}
_xifexpression = _xblockexpression_1;
}
_xblockexpression = _xifexpression;
}
return _xblockexpression;
}
use of org.eclipse.xtext.xbase.lib.IntegerRange in project xtext-xtend by eclipse.
the class Case_3 method testReturnExpression_07.
public void testReturnExpression_07(final Class<?> c) {
boolean _notEquals = (!Objects.equal(Case_3.class, c));
if (_notEquals) {
final Function1<Integer, Integer> _function = (Integer i) -> {
return (i).intValue();
};
final Function1<? super Integer, ? extends Integer> closure = _function;
IntegerRange _upTo = new IntegerRange(1, 100);
for (final Integer x : _upTo) {
closure.apply(x);
}
}
}
use of org.eclipse.xtext.xbase.lib.IntegerRange in project xtext-xtend by eclipse.
the class RichStringToLineModel method acceptSemanticText.
@Override
public void acceptSemanticText(final CharSequence text, final RichStringLiteral origin) {
super.acceptSemanticText(text, origin);
if ((!this.content)) {
if (((text.length() > 0) && (IterableExtensions.<Integer, Boolean>fold(new IntegerRange(0, (text.length() - 1)), Boolean.valueOf(false), ((Function2<Boolean, Integer, Boolean>) (Boolean v, Integer i) -> {
return Boolean.valueOf(((v).booleanValue() || (!Character.isWhitespace(text.charAt((i).intValue())))));
}))).booleanValue())) {
this.startContent();
}
}
int _length = text.length();
int _plus = (this.offset + _length);
this.offset = _plus;
}
use of org.eclipse.xtext.xbase.lib.IntegerRange in project xtext-xtend by eclipse.
the class XtendFormatter method _format.
protected void _format(final XtendEnum enumeration, @Extension final IFormattableDocument format) {
this.formatAnnotations(enumeration, format, XbaseFormatterPreferenceKeys.newLineAfterClassAnnotations);
this.formatModifiers(enumeration, format);
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> {
it.oneSpace();
};
format.append(this.textRegionExtensions.regionFor(enumeration).keyword("enum"), _function);
final ISemanticRegion open = this.textRegionExtensions.regionFor(enumeration).keyword("{");
final ISemanticRegion close = this.textRegionExtensions.regionFor(enumeration).keyword("}");
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it) -> {
it.indent();
};
format.<ISemanticRegion, ISemanticRegion>interior(open, close, _function_1);
format.prepend(open, XbaseFormatterPreferenceKeys.bracesInNewLine);
boolean _isEmpty = enumeration.getMembers().isEmpty();
boolean _not = (!_isEmpty);
if (_not) {
format.append(open, XtendFormatterPreferenceKeys.blankLinesBeforeFirstMember);
int _size = enumeration.getMembers().size();
int _minus = (_size - 1);
IntegerRange _upTo = new IntegerRange(0, _minus);
for (final Integer i : _upTo) {
{
final XtendMember current = enumeration.getMembers().get((i).intValue());
format.<XtendMember>format(current);
int _size_1 = enumeration.getMembers().size();
int _minus_1 = (_size_1 - 1);
boolean _lessThan = ((i).intValue() < _minus_1);
if (_lessThan) {
final Procedure1<IHiddenRegionFormatter> _function_2 = (IHiddenRegionFormatter it) -> {
it.noSpace();
};
format.append(format.prepend(this.textRegionExtensions.immediatelyFollowing(current).keyword(","), _function_2), XtendFormatterPreferenceKeys.blankLinesBetweenEnumLiterals);
} else {
format.<XtendMember>append(current, XtendFormatterPreferenceKeys.blankLinesAfterLastMember);
}
}
}
} else {
final Procedure1<IHiddenRegionFormatter> _function_2 = (IHiddenRegionFormatter it) -> {
it.newLine();
};
format.append(open, _function_2);
}
}
use of org.eclipse.xtext.xbase.lib.IntegerRange in project xtext-xtend by eclipse.
the class XtendFormatter method formatBody.
protected ISemanticRegion formatBody(final XtendTypeDeclaration type, @Extension final IFormattableDocument format) {
ISemanticRegion _xblockexpression = null;
{
final ISemanticRegion open = this.textRegionExtensions.regionFor(type).keyword("{");
final ISemanticRegion close = this.textRegionExtensions.regionFor(type).keyword("}");
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> {
it.indent();
};
format.<ISemanticRegion, ISemanticRegion>interior(open, close, _function);
format.prepend(open, XbaseFormatterPreferenceKeys.bracesInNewLine);
ISemanticRegion _xifexpression = null;
boolean _isEmpty = type.getMembers().isEmpty();
boolean _not = (!_isEmpty);
if (_not) {
format.append(open, XtendFormatterPreferenceKeys.blankLinesBeforeFirstMember);
int _size = type.getMembers().size();
int _minus = (_size - 1);
IntegerRange _upTo = new IntegerRange(0, _minus);
for (final Integer i : _upTo) {
{
final XtendMember current = type.getMembers().get((i).intValue());
format.<XtendMember>format(current);
int _size_1 = type.getMembers().size();
int _minus_1 = (_size_1 - 1);
boolean _lessThan = ((i).intValue() < _minus_1);
if (_lessThan) {
final XtendMember next = type.getMembers().get(((i).intValue() + 1));
if (((current instanceof XtendField) && (next instanceof XtendField))) {
format.<XtendMember>append(current, XtendFormatterPreferenceKeys.blankLinesBetweenFields);
} else {
if (((current instanceof XtendFunction) && (next instanceof XtendFunction))) {
format.<XtendMember>append(current, XtendFormatterPreferenceKeys.blankLinesBetweenMethods);
} else {
format.<XtendMember>append(current, XtendFormatterPreferenceKeys.blankLinesBetweenFieldsAndMethods);
}
}
} else {
final XtendMember member = type.getMembers().get((i).intValue());
format.<XtendMember>append(member, XtendFormatterPreferenceKeys.blankLinesAfterLastMember);
}
}
}
} else {
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it) -> {
it.newLine();
};
_xifexpression = format.append(open, _function_1);
}
_xblockexpression = _xifexpression;
}
return _xblockexpression;
}
Aggregations