use of org.eclipse.xtext.xbase.lib.ExclusiveRange in project xtext-xtend by eclipse.
the class AbstractExecutableBuilder method appendParameters.
protected ISourceAppender appendParameters(final ISourceAppender appendable) {
ISourceAppender _xblockexpression = null;
{
appendable.append("(");
final HashSet<String> notAllowed = CollectionLiterals.<String>newHashSet();
boolean _isEmpty = this.parameterBuilders.isEmpty();
boolean _not = (!_isEmpty);
if (_not) {
AbstractParameterBuilder _last = IterableExtensions.<AbstractParameterBuilder>last(this.parameterBuilders);
_last.setVarArgsFlag(this.varArgsFlag);
}
int _size = this.parameterBuilders.size();
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
for (final Integer i : _doubleDotLessThan) {
{
final AbstractParameterBuilder parameterBuilder = this.parameterBuilders.get((i).intValue());
final VariableNameAcceptor acceptor = new VariableNameAcceptor(notAllowed);
String _name = parameterBuilder.getName();
boolean _tripleEquals = (_name == null);
if (_tripleEquals) {
this._jdtVariableCompletions.getVariableProposals(parameterBuilder.getType().getIdentifier(), this.getContext(), JdtVariableCompletions.VariableType.PARAMETER, notAllowed, acceptor);
parameterBuilder.setName(acceptor.getVariableName());
}
parameterBuilder.build(appendable);
int _size_1 = this.parameterBuilders.size();
int _minus = (_size_1 - 1);
boolean _notEquals = ((i).intValue() != _minus);
if (_notEquals) {
appendable.append(", ");
}
}
}
_xblockexpression = appendable.append(")");
}
return _xblockexpression;
}
use of org.eclipse.xtext.xbase.lib.ExclusiveRange in project xtext-xtend by eclipse.
the class XtendTaskFinderTest method assertContainsTasks.
private void assertContainsTasks(final Resource resource, final List<Task> expectedTasks) {
final List<Task> actualTasks = this.finder.findTasks(resource);
Assert.assertEquals(expectedTasks.size(), actualTasks.size());
int _size = expectedTasks.size();
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
for (final Integer i : _doubleDotLessThan) {
XtendTaskFinderTest.assertExactMatch(expectedTasks.get((i).intValue()), actualTasks.get((i).intValue()));
}
}
use of org.eclipse.xtext.xbase.lib.ExclusiveRange in project xtext-xtend by eclipse.
the class CompilationUnitImpl method translate.
protected Object translate(final Object object) {
if ((object instanceof XAnnotation[])) {
final AnnotationReference[] result = new AnnotationReference[((Object[]) object).length];
int _length = ((Object[]) object).length;
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _length, true);
for (final Integer i : _doubleDotLessThan) {
result[(i).intValue()] = this.translateAnnotation(((XAnnotation[]) object)[(i).intValue()]);
}
return result;
}
if ((object instanceof XAnnotation)) {
return this.translateAnnotation(((XAnnotation) object));
}
if ((object instanceof JvmTypeReference[])) {
final TypeReference[] result_1 = new TypeReference[((Object[]) object).length];
int _length_1 = ((Object[]) object).length;
ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, _length_1, true);
for (final Integer i_1 : _doubleDotLessThan_1) {
Object _translate = this.translate(((Object[]) object)[(i_1).intValue()]);
result_1[(i_1).intValue()] = ((TypeReference) _translate);
}
return result_1;
}
if ((object instanceof JvmTypeReference)) {
return this.toTypeReference(((JvmTypeReference) object));
}
if ((object instanceof JvmEnumerationLiteral[])) {
final EnumerationValueDeclaration[] result_2 = new EnumerationValueDeclaration[((Object[]) object).length];
int _length_2 = ((Object[]) object).length;
ExclusiveRange _doubleDotLessThan_2 = new ExclusiveRange(0, _length_2, true);
for (final Integer i_2 : _doubleDotLessThan_2) {
Object _translate_1 = this.translate(((Object[]) object)[(i_2).intValue()]);
result_2[(i_2).intValue()] = ((EnumerationValueDeclaration) _translate_1);
}
return result_2;
}
if ((object instanceof JvmEnumerationLiteral)) {
return this.toMemberDeclaration(((JvmMember) object));
}
return object;
}
use of org.eclipse.xtext.xbase.lib.ExclusiveRange in project xtext-xtend by eclipse.
the class ResolvedExecutableImpl method getResolvedParameters.
@Override
public Iterable<? extends ResolvedParameter> getResolvedParameters() {
Iterable<? extends ResolvedParameter> _xblockexpression = null;
{
if ((this.resolvedParameters == null)) {
int _size = this.getDelegate().getDeclaration().getParameters().size();
final Function1<Integer, ResolvedParameterImpl> _function = (Integer i) -> {
ParameterDeclaration _parameterDeclaration = this.getCompilationUnit().toParameterDeclaration(this.getDelegate().getDeclaration().getParameters().get((i).intValue()));
TypeReference _typeReference = this.getCompilationUnit().toTypeReference(this.getDelegate().getResolvedParameterTypes().get((i).intValue()));
return new ResolvedParameterImpl(_parameterDeclaration, _typeReference);
};
this.resolvedParameters = IterableExtensions.<Integer, ResolvedParameterImpl>map(new ExclusiveRange(0, _size, true), _function);
}
_xblockexpression = this.resolvedParameters;
}
return _xblockexpression;
}
use of org.eclipse.xtext.xbase.lib.ExclusiveRange in project xtext-xtend by eclipse.
the class SwtBotProjectHelper method getLineAndColumn.
protected static Pair<Integer, Integer> getLineAndColumn(final String content, final int offset) {
Pair<Integer, Integer> _xblockexpression = null;
{
int line = 0;
int column = 0;
String ignoreNext = null;
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, offset, true);
for (final Integer i : _doubleDotLessThan) {
String _substring = content.substring((i).intValue(), ((i).intValue() + 1));
boolean _matched = false;
if (Objects.equal(_substring, ignoreNext)) {
_matched = true;
ignoreNext = null;
}
if (!_matched) {
if (Objects.equal(_substring, "\n")) {
_matched = true;
column = 0;
line = (line + 1);
ignoreNext = "\r";
}
}
if (!_matched) {
if (Objects.equal(_substring, "\r")) {
_matched = true;
column = 0;
line = (line + 1);
ignoreNext = "\n";
}
}
if (!_matched) {
{
ignoreNext = null;
column = (column + 1);
}
}
}
_xblockexpression = Pair.<Integer, Integer>of(Integer.valueOf(line), Integer.valueOf(column));
}
return _xblockexpression;
}
Aggregations