Range range = new ExclusiveRange(1,3); if (range.contains(x)) { ... }
/** * Returns the number of elements in this ExclusiveRange. * * @return the number of elements in this ExclusiveRange. */ @Pure public int size() { return (isEmpty()) ? 0 : Math.abs(last - first) + 1; }
private String findIndent(final String line) { if ((line != null)) { int _length = line.length(); ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _length, true); for (final Integer i : _doubleDotLessThan) { int _indexOf = " \t".indexOf(line.charAt((i).intValue())); boolean _lessThan = (_indexOf < 0); if (_lessThan) { return line.substring(0, (i).intValue()); } } } return line; }
/** * Returns the number of elements in this ExclusiveRange. * * @return the number of elements in this ExclusiveRange. */ @Pure public int size() { return (isEmpty()) ? 0 : Math.abs(last - first) + 1; }
@Override @Pure public String toString() { String _xblockexpression = null; { final StringBuilder buffer = new StringBuilder(); final int len = this.scopes.length; if ((len > 0)) { buffer.append(this.scopes[0]); ExclusiveRange _doubleDotLessThan = new ExclusiveRange(1, len, true); for (final Integer i : _doubleDotLessThan) { { buffer.append(" || "); buffer.append(this.scopes[(i).intValue()]); } } } _xblockexpression = buffer.toString(); } return _xblockexpression; }
/** * Checks whether this contains the given number, i.e. whether the iterator will yield the number. This is different * from interval containment: <code>0..2.by(2)</code> will <em>not</em> contain 1. * * @param number * the number to be checked for containment. * @return whether this sequence contains the given number or not. */ @Pure public boolean contains(int number) { if (isEmpty()) return false; if(step == -1) return number <= first && number >= last; else return number >= first && number <= last; }
@Override @Pure public String toString() { String _xblockexpression = null; { final StringBuilder buffer = new StringBuilder(); int len = this.scopes.length; if ((len > 0)) { buffer.append(this.scopes[0]); ExclusiveRange _doubleDotLessThan = new ExclusiveRange(1, len, true); for (final Integer i : _doubleDotLessThan) { { buffer.append(" ^ "); buffer.append(this.scopes[(i).intValue()]); } } } _xblockexpression = buffer.toString(); } return _xblockexpression; }
/** * Checks whether this contains the given number, i.e. whether the iterator will yield the number. This is different * from interval containment: <code>0..2.by(2)</code> will <em>not</em> contain 1. * * @param number * the number to be checked for containment. * @return whether this sequence contains the given number or not. */ @Pure public boolean contains(int number) { if (isEmpty()) return false; if(step == -1) return number <= first && number >= last; else return number >= first && number <= last; }
@Override @Pure public String toString() { String _xblockexpression = null; { final StringBuilder buffer = new StringBuilder(); final int len = this.scopes.length; if ((len > 0)) { buffer.append(this.scopes[0]); ExclusiveRange _doubleDotLessThan = new ExclusiveRange(1, len, true); for (final Integer i : _doubleDotLessThan) { { buffer.append(" && "); buffer.append(this.scopes[(i).intValue()]); } } } _xblockexpression = buffer.toString(); } return _xblockexpression; }
/** * @return a read-only {@link ListIterator} for this. */ @Override @Pure public ListIterator<Integer> iterator() { return isEmpty() ? EMPTY_LIST_ITERATOR : new RangeIterator(); }
/** * The <code>>..</code> operator yields an {@link ExclusiveRange} that decrements from a * (exclusive) down to b. * * @param a the start of the range (exclusive). * @param b the end of the range. * @return a decrementing {@link ExclusiveRange}. Never <code>null</code>. * @since 2.4 */ @Pure @Inline(value="new $3($1, $2, false)", imported=ExclusiveRange.class, statementExpression=false) public static ExclusiveRange operator_greaterThanDoubleDot(final int a, final int b) { return new ExclusiveRange(a, b, false); }
/** * @return a read-only {@link ListIterator} for this. */ @Override @Pure public ListIterator<Integer> iterator() { return isEmpty() ? EMPTY_LIST_ITERATOR : new RangeIterator(); }
protected List<SemanticHighlightingInformation> appendEmptyLineTokens(final List<SemanticHighlightingInformation> infos, final Document document) { final int lineCount = document.getLineCount(); final Function<SemanticHighlightingInformation, Integer> _function = (SemanticHighlightingInformation it) -> { return Integer.valueOf(it.getLine()); }; final HashMap<Integer, SemanticHighlightingInformation> tokens = Maps.<Integer, SemanticHighlightingInformation>newHashMap(Maps.<Integer, SemanticHighlightingInformation>uniqueIndex(infos, _function)); ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, lineCount, true); for (final Integer i : _doubleDotLessThan) { boolean _containsKey = tokens.containsKey(i); boolean _not = (!_containsKey); if (_not) { SemanticHighlightingInformation _semanticHighlightingInformation = new SemanticHighlightingInformation((i).intValue(), null); tokens.put(i, _semanticHighlightingInformation); } } return IterableExtensions.<SemanticHighlightingInformation>toList(tokens.values()); }
/** * The <code>>..</code> operator yields an {@link ExclusiveRange} that decrements from a * (exclusive) down to b. * * @param a the start of the range (exclusive). * @param b the end of the range. * @return a decrementing {@link ExclusiveRange}. Never <code>null</code>. * @since 2.4 */ @Pure @Inline(value="new $3($1, $2, false)", imported=ExclusiveRange.class, statementExpression=false) public static ExclusiveRange operator_greaterThanDoubleDot(final int a, final int b) { return new ExclusiveRange(a, b, false); }
/** * The <code>..<</code> operator yields an {@link ExclusiveRange} that increments from * a to b (exclusive). * * @param a the start of the range. * @param b the end of the range (exclusive). * @return an incrementing {@link ExclusiveRange}. Never <code>null</code>. * @since 2.4 */ @Pure @Inline(value="new $3($1, $2, true)", imported=ExclusiveRange.class, statementExpression=false) public static ExclusiveRange operator_doubleDotLessThan(final int a, final int b) { return new ExclusiveRange(a, b, true); }
/** * The <code>..<</code> operator yields an {@link ExclusiveRange} that increments from * a to b (exclusive). * * @param a the start of the range. * @param b the end of the range (exclusive). * @return an incrementing {@link ExclusiveRange}. Never <code>null</code>. * @since 2.4 */ @Pure @Inline(value="new $3($1, $2, true)", imported=ExclusiveRange.class, statementExpression=false) public static ExclusiveRange operator_doubleDotLessThan(final int a, final int b) { return new ExclusiveRange(a, b, true); }
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()]); 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()]); 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()]);
@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; }
protected JvmTypeReference toTypeReference(final JvmType type, final int arrayDimensions) { if ((type == null)) { return null; } JvmParameterizedTypeReference _createJvmParameterizedTypeReference = TypesFactory.eINSTANCE.createJvmParameterizedTypeReference(); final Procedure1<JvmParameterizedTypeReference> _function = (JvmParameterizedTypeReference it) -> { it.setType(type); }; JvmTypeReference resultTypeRef = ObjectExtensions.<JvmParameterizedTypeReference>operator_doubleArrow(_createJvmParameterizedTypeReference, _function); ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, arrayDimensions, true); for (final Integer i : _doubleDotLessThan) { { final JvmGenericArrayTypeReference arrayRef = TypesFactory.eINSTANCE.createJvmGenericArrayTypeReference(); arrayRef.setComponentType(resultTypeRef); resultTypeRef = arrayRef; } } return resultTypeRef; }