本文整理汇总了Java中org.eclipse.xtext.xbase.lib.IntegerRange类的典型用法代码示例。如果您正苦于以下问题:Java IntegerRange类的具体用法?Java IntegerRange怎么用?Java IntegerRange使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntegerRange类属于org.eclipse.xtext.xbase.lib包,在下文中一共展示了IntegerRange类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _generateArguments
import org.eclipse.xtext.xbase.lib.IntegerRange; //导入依赖的package包/类
private List<ParameterValueMapping> _generateArguments(final TAbstractMessages tMessage, final Operation operation, final Lifeline lifeline) {
List<ParameterValueMapping> _xblockexpression = null;
{
final List<ParameterValueMapping> result = CollectionLiterals.<ParameterValueMapping>newArrayList();
EList<Parameter> _parameters = operation.getParameters();
boolean _isEmpty = _parameters.isEmpty();
boolean _equals = (_isEmpty == false);
if (_equals) {
EList<Parameter> _parameters_1 = operation.getParameters();
int _length = ((Object[])Conversions.unwrapArray(_parameters_1, Object.class)).length;
int _minus = (_length - 1);
IntegerRange _upTo = new IntegerRange(0, _minus);
for (final Integer i : _upTo) {
EList<Parameter> _parameters_2 = operation.getParameters();
Parameter _get = _parameters_2.get((i).intValue());
EList<TParameter> _arguments = tMessage.getArguments();
TParameter _get_1 = _arguments.get((i).intValue());
ParameterValueMapping _createParameterValueMapping = this.createParameterValueMapping(_get, _get_1, lifeline);
result.add(_createParameterValueMapping);
}
}
_xblockexpression = result;
}
return _xblockexpression;
}
示例2: generateParameters
import org.eclipse.xtext.xbase.lib.IntegerRange; //导入依赖的package包/类
public void generateParameters(final JvmExecutable it, final ITreeAppendable appendable, final GeneratorConfig config) {
boolean _isEmpty = it.getParameters().isEmpty();
boolean _not = (!_isEmpty);
if (_not) {
int _size = it.getParameters().size();
int _minus = (_size - 1);
IntegerRange _upTo = new IntegerRange(0, _minus);
for (final Integer i : _upTo) {
{
int _size_1 = it.getParameters().size();
final boolean last = (((i).intValue() + 1) == _size_1);
final JvmFormalParameter p = it.getParameters().get((i).intValue());
this.generateParameter(p, appendable, (last && it.isVarArgs()), config);
if ((!last)) {
appendable.append(", ");
}
}
}
}
}
示例3: getIndentation
import org.eclipse.xtext.xbase.lib.IntegerRange; //导入依赖的package包/类
public String getIndentation(final int levels) {
String _xifexpression = null;
if ((levels > 0)) {
String _xblockexpression = null;
{
final String indent = this.cfg.get(BasicFormatterPreferenceKeys.indentation);
final Function1<Integer, String> _function = (Integer it) -> {
return indent;
};
_xblockexpression = IterableExtensions.join(IterableExtensions.<Integer, String>map(new IntegerRange(0, (levels - 1)), _function));
}
_xifexpression = _xblockexpression;
} else {
_xifexpression = "";
}
return _xifexpression;
}
示例4: getWrap
import org.eclipse.xtext.xbase.lib.IntegerRange; //导入依赖的package包/类
public String getWrap(final int levels) {
String _xifexpression = null;
if ((levels > 0)) {
String _xblockexpression = null;
{
final String sep = this.cfg.get(BasicFormatterPreferenceKeys.lineSeparator);
final Function1<Integer, String> _function = (Integer it) -> {
return sep;
};
_xblockexpression = IterableExtensions.join(IterableExtensions.<Integer, String>map(new IntegerRange(0, (levels - 1)), _function));
}
_xifexpression = _xblockexpression;
} else {
_xifexpression = "";
}
return _xifexpression;
}
示例5: testValidity
import org.eclipse.xtext.xbase.lib.IntegerRange; //导入依赖的package包/类
@Test
public void testValidity() {
new IntegerRange(0, 0, 1);
new IntegerRange(0, 0, -1);
new IntegerRange(0, 2, 1);
new IntegerRange(-1, 2, 1);
new IntegerRange(-2, -1, 1);
new IntegerRange(2, 0, -1);
new IntegerRange(2, -1, -1);
new IntegerRange(-1, -2, -1);
new IntegerRange(-2, 0, 1);
new IntegerRange(Integer.MIN_VALUE, 0, 1);
new IntegerRange(Integer.MAX_VALUE, 0, -1);
assertInvalid(0, 1, 0);
assertInvalid(0, 2, -1);
assertInvalid(-1, 2, -1);
assertInvalid(-2, -1, -1);
assertInvalid(2, 0, 1);
assertInvalid(2, -1, 1);
assertInvalid(-1, -2, 1);
}
示例6: testLongInputManyTasks
import org.eclipse.xtext.xbase.lib.IntegerRange; //导入依赖的package包/类
@Test
public void testLongInputManyTasks() {
final int expectation = 100000;
StringConcatenation _builder = new StringConcatenation();
_builder.append("/*");
_builder.newLine();
{
IntegerRange _upTo = new IntegerRange(1, expectation);
for(final Integer i : _upTo) {
_builder.append(" ");
_builder.append("* FIXME this cannot work");
_builder.newLine();
}
}
_builder.append(" ");
_builder.append("*/");
_builder.newLine();
final String source = _builder.toString();
final List<Task> parsed = this.parser.parseTasks(LineDelimiters.toUnix(source), this.definitions);
Assert.assertEquals(expectation, parsed.size());
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, expectation, true);
for (final Integer i_1 : _doubleDotLessThan) {
Assert.assertEquals(((i_1).intValue() + 2), parsed.get((i_1).intValue()).getLineNumber());
}
}
示例7: test_rates
import org.eclipse.xtext.xbase.lib.IntegerRange; //导入依赖的package包/类
@Test
public void test_rates() {
try {
final PropertyNode m = Metrics.create();
IntegerRange _upTo = new IntegerRange(1, 8);
for (final Integer i : _upTo) {
IntegerRange _upTo_1 = new IntegerRange(1, 10);
for (final Integer j : _upTo_1) {
{
m.<Long>record(Metrics.happened("de.mxro.test.meter1"));
Thread.sleep(100);
}
}
}
double _fiveMinuteRate = m.<Meter>retrieve("de.mxro.test.meter1", Meter.class).get().getFiveMinuteRate();
boolean _greaterThan = (_fiveMinuteRate > 8.0);
TestMeter.<Boolean, Boolean>operator_doubleArrow(Boolean.valueOf(_greaterThan), Boolean.valueOf(true));
double _fiveMinuteRate_1 = m.<Meter>retrieve("de.mxro.test.meter1", Meter.class).get().getFiveMinuteRate();
boolean _lessThan = (_fiveMinuteRate_1 < 12.0);
TestMeter.<Boolean, Boolean>operator_doubleArrow(Boolean.valueOf(_lessThan), Boolean.valueOf(true));
m.stop().get();
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例8: isWhitespace
import org.eclipse.xtext.xbase.lib.IntegerRange; //导入依赖的package包/类
protected boolean isWhitespace(final String doc) {
int _length = doc.length();
int _minus = (_length - 1);
final Function1<Integer, Boolean> _function = (Integer it) -> {
return Boolean.valueOf(Character.isWhitespace(doc.charAt((it).intValue())));
};
return IterableExtensions.<Integer>forall(new IntegerRange(0, _minus), _function);
}
示例9: testBlockExpression_03
import org.eclipse.xtext.xbase.lib.IntegerRange; //导入依赖的package包/类
@IgnoredBySmokeTest("Do not run smoke test with 1000s of nested expressions")
@Test
public void testBlockExpression_03() throws Exception {
String input = "{ val s1 = \'\'\n";
final int max = 1000;
IntegerRange _upTo = new IntegerRange(1, max);
for (final Integer i : _upTo) {
input = (((((input + " val s") + Integer.valueOf(((i).intValue() + 1))) + " = s") + i) + "\n");
}
input = (((input + " s") + Integer.valueOf((max + 1))) + "}");
this.resolvesTo(input, "String");
}
示例10: assertInvalid
import org.eclipse.xtext.xbase.lib.IntegerRange; //导入依赖的package包/类
protected void assertInvalid(int start, int end, int step) {
try {
new IntegerRange(start, end, step);
fail("Invalid step not detected");
} catch (IllegalArgumentException e) {
// expected exception
}
}
示例11: testContains_0
import org.eclipse.xtext.xbase.lib.IntegerRange; //导入依赖的package包/类
@Test
public void testContains_0() {
IntegerRange range = new IntegerRange(-1, 1, 2);
assertFalse(range.contains(-2));
assertTrue(range.contains(-1));
assertFalse(range.contains(0));
assertTrue(range.contains(1));
assertFalse(range.contains(2));
}
示例12: testContains_1
import org.eclipse.xtext.xbase.lib.IntegerRange; //导入依赖的package包/类
@Test
public void testContains_1() {
IntegerRange range = new IntegerRange(-1, 2, 2);
assertFalse(range.contains(-2));
assertTrue(range.contains(-1));
assertFalse(range.contains(0));
assertTrue(range.contains(1));
assertFalse(range.contains(2));
}
示例13: testSize
import org.eclipse.xtext.xbase.lib.IntegerRange; //导入依赖的package包/类
@Test
public void testSize() {
final IntegerRange myRange = new IntegerRange(-1, 1);
assertEquals(3, myRange.getSize());
assertEquals(2, myRange.withStep(2).getSize());
assertEquals(1, myRange.withStep(3).getSize());
final IntegerRange myRange2 = new IntegerRange(1, -1);
assertEquals(3, myRange2.getSize());
assertEquals(2, myRange2.withStep(-2).getSize());
assertEquals(1, myRange2.withStep(-3).getSize());
}
示例14: testWeirdTemplateString
import org.eclipse.xtext.xbase.lib.IntegerRange; //导入依赖的package包/类
@Test
public void testWeirdTemplateString() {
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("fooo bar");
_builder.newLine();
_builder.append("d ");
{
if ((2 > 1)) {
_builder.append("s");
_builder.newLineIfNotEmpty();
_builder.append("\t ");
_builder.append("ee ");
{
IntegerRange _upTo = new IntegerRange(1, 4);
for(final Integer i : _upTo) {
_builder.newLineIfNotEmpty();
_builder.newLineIfNotEmpty();
CharSequence _other = TemplateNodeTest.this.other();
_builder.append(_other);
_builder.append(" ");
_builder.append(i);
_builder.newLineIfNotEmpty();
String _multiLineString = TemplateNodeTest.this.multiLineString();
_builder.append(_multiLineString);
_builder.append(" ");
String _multiLineString_1 = TemplateNodeTest.this.multiLineString();
_builder.append(_multiLineString_1);
_builder.newLineIfNotEmpty();
}
}
}
}
}
};
this.assertEquals(_client);
}
示例15: phone
import org.eclipse.xtext.xbase.lib.IntegerRange; //导入依赖的package包/类
public static CharSequence phone() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("1");
_builder.append(Collections.<String>unmodifiableSet(CollectionLiterals.<String>newHashSet("1", "3", "5", "8")), "");
_builder.append(".get(RandomUtils.nextInt(0, 3))»");
IntegerRange _upTo = new IntegerRange(0, 8);
final Function1<Integer, String> _function = (Integer it) -> {
Integer _singleNumber = Randoms.singleNumber();
return _singleNumber.toString();
};
Iterable<String> _map = IterableExtensions.<Integer, String>map(_upTo, _function);
String _join = IterableExtensions.join(_map);
_builder.append(_join, "");
return _builder;
}