Java 类org.eclipse.xtext.xbase.lib.ExclusiveRange 实例源码

项目:xtext-extras    文件:AbstractConstantExpressionsInterpreter.java   
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;
}
项目:xtext-core    文件:SerializableResourceDescription.java   
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
  this.setURI(SerializationExtensions.readURI(in));
  final int descriptionsSize = in.readInt();
  ArrayList<SerializableEObjectDescription> _arrayList = new ArrayList<SerializableEObjectDescription>(descriptionsSize);
  this.descriptions = _arrayList;
  ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, descriptionsSize, true);
  for (final Integer i : _doubleDotLessThan) {
    this.descriptions.add(SerializationExtensions.<SerializableEObjectDescription>readCastedObject(in));
  }
  final int referencesSize = in.readInt();
  ArrayList<SerializableReferenceDescription> _arrayList_1 = new ArrayList<SerializableReferenceDescription>(referencesSize);
  this.references = _arrayList_1;
  ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, referencesSize, true);
  for (final Integer i_1 : _doubleDotLessThan_1) {
    this.references.add(SerializationExtensions.<SerializableReferenceDescription>readCastedObject(in));
  }
  final int importedNamesSize = in.readInt();
  ArrayList<QualifiedName> _arrayList_2 = new ArrayList<QualifiedName>(importedNamesSize);
  this.importedNames = _arrayList_2;
  ExclusiveRange _doubleDotLessThan_2 = new ExclusiveRange(0, importedNamesSize, true);
  for (final Integer i_2 : _doubleDotLessThan_2) {
    this.importedNames.add(SerializationExtensions.readQualifiedName(in));
  }
}
项目:xtext-core    文件:ChunkedResourceDescriptions.java   
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
  final int numChunks = in.readInt();
  ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, numChunks, true);
  for (final Integer i : _doubleDotLessThan) {
    {
      final String chunkName = in.readUTF();
      final int numDescriptions = in.readInt();
      final ArrayList<IResourceDescription> descriptions = new ArrayList<IResourceDescription>(numDescriptions);
      ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, numDescriptions, true);
      for (final Integer j : _doubleDotLessThan_1) {
        Object _readObject = in.readObject();
        descriptions.add(((IResourceDescription) _readObject));
      }
      ResourceDescriptionsData _resourceDescriptionsData = new ResourceDescriptionsData(descriptions);
      this.chunk2resourceDescriptions.put(chunkName, _resourceDescriptionsData);
    }
  }
}
项目:xtext-core    文件:Source2GeneratedMapping.java   
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
  final int numEntries = in.readInt();
  ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, numEntries, true);
  for (final Integer i : _doubleDotLessThan) {
    {
      final URI source = URI.createURI(in.readUTF());
      final int numGenerated = in.readInt();
      ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, numGenerated, true);
      for (final Integer j : _doubleDotLessThan_1) {
        {
          final URI generated = URI.createURI(in.readUTF());
          final String outputConfig = in.readUTF();
          this.addSource2Generated(source, generated, outputConfig);
        }
      }
    }
  }
}
项目:xtext-core    文件:GeneratorNodeTest.java   
private StringConcatenationClient someCodeGen(final int n) {
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      {
        ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, n, true);
        for(final Integer i : _doubleDotLessThan) {
          _builder.append("before ");
          CompositeGeneratorNode _append = GeneratorNodeTest.this.exts.append(GeneratorNodeTest.this.exts.trace(GeneratorNodeTest.this.loc((10 + (i).intValue()))), "Hello");
          _builder.append(_append);
          _builder.append(" after");
          _builder.newLineIfNotEmpty();
          _builder.append("  ");
          StringConcatenationClient _someCodeGen = GeneratorNodeTest.this.someCodeGen((n - 1));
          _builder.append(_someCodeGen, "  ");
          _builder.newLineIfNotEmpty();
        }
      }
    }
  };
  return _client;
}
项目:xtext-core    文件:GeneratorNodeTest.java   
private String someCodeGen_noTrace(final int n) {
  StringConcatenation _builder = new StringConcatenation();
  {
    ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, n, true);
    for(final Integer i : _doubleDotLessThan) {
      _builder.append("before ");
      _builder.append("Hello");
      _builder.append(" after");
      _builder.newLineIfNotEmpty();
      _builder.append("  ");
      String _someCodeGen_noTrace = this.someCodeGen_noTrace((n - 1));
      _builder.append(_someCodeGen_noTrace, "  ");
      _builder.newLineIfNotEmpty();
    }
  }
  return _builder.toString();
}
项目:xtext-core    文件:DefaultTaskParserTest.java   
@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());
  }
}
项目:RigidBodies    文件:ConnectiveTreeBuilder.java   
public List<Pair<String, RelativeTransformation>> getJointTransformations() {
  boolean _equals = Objects.equal(this.allTransformations, null);
  if (_equals) {
    LinkedList<Pair<String, RelativeTransformation>> _linkedList = new LinkedList<Pair<String, RelativeTransformation>>(this.jointTransformations);
    this.allTransformations = _linkedList;
    this.allTransformations.addAll(this.constraintTransformations);
    List<Pair<String, List<JointMovement>>> _states = this.getStates();
    int _size = _states.size();
    int _size_1 = this.allTransformations.size();
    int _minus = (_size - _size_1);
    ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _minus, true);
    final Consumer<Integer> _function = new Consumer<Integer>() {
      @Override
      public void accept(final Integer it) {
        ConnectiveTreeBuilder.this.allTransformations.add(null);
      }
    };
    _doubleDotLessThan.forEach(_function);
  }
  return this.allTransformations;
}
项目:org.pshdl    文件:JavaCodeGenerator.java   
public StringBuilder schedule(final List<Integer> threadLoad, final List<StringBuilder> threadExecution, final int costs, final CharSequence execution) {
  StringBuilder _xblockexpression = null;
  {
    int min = Integer.MAX_VALUE;
    int tid = (-1);
    int _size = threadLoad.size();
    ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
    for (final Integer i : _doubleDotLessThan) {
      {
        final Integer load = threadLoad.get((i).intValue());
        if (((load).intValue() <= min)) {
          min = (load).intValue();
          tid = (i).intValue();
        }
      }
    }
    Integer _get = threadLoad.get(tid);
    int _plus = ((_get).intValue() + costs);
    threadLoad.set(tid, Integer.valueOf(_plus));
    _xblockexpression = threadExecution.get(tid).append(execution);
  }
  return _xblockexpression;
}
项目:xtext-lib    文件:ExclusiveRangeTest.java   
@Test
public void testContent() {
  Assert.assertEquals("1,2,3,4", IterableExtensions.join(new ExclusiveRange(1, 5, true), ","));
  Assert.assertEquals("", IterableExtensions.join(new ExclusiveRange(0, 0, true), ","));
  Assert.assertEquals("", IterableExtensions.join(new ExclusiveRange(0, (-1), true), ","));
  Assert.assertEquals("-1", IterableExtensions.join(new ExclusiveRange((-1), 0, true), ","));
  Assert.assertEquals("4,3,2,1", IterableExtensions.join(new ExclusiveRange(5, 1, false), ","));
  Assert.assertEquals("", IterableExtensions.join(new ExclusiveRange(0, 0, false), ","));
  Assert.assertEquals("", IterableExtensions.join(new ExclusiveRange((-1), 0, false), ","));
  Assert.assertEquals("-1", IterableExtensions.join(new ExclusiveRange(0, (-1), false), ","));
}
项目:xtext-lib    文件:ExclusiveRangeTest.java   
@Test
public void testSize() {
  Assert.assertEquals(4, new ExclusiveRange(1, 5, true).size());
  Assert.assertEquals(0, new ExclusiveRange(0, 0, true).size());
  Assert.assertEquals(0, new ExclusiveRange(0, (-1), true).size());
  Assert.assertEquals(1, new ExclusiveRange((-1), 0, true).size());
  Assert.assertEquals(4, new ExclusiveRange(5, 1, false).size());
  Assert.assertEquals(0, new ExclusiveRange(0, 0, false).size());
  Assert.assertEquals(0, new ExclusiveRange((-1), 0, false).size());
  Assert.assertEquals(1, new ExclusiveRange(0, (-1), false).size());
}
项目:xtext-lib    文件:ExclusiveRangeTest.java   
@Test
public void testIsEmpty() {
  Assert.assertFalse(new ExclusiveRange(1, 5, true).isEmpty());
  Assert.assertTrue(new ExclusiveRange(0, 0, true).isEmpty());
  Assert.assertTrue(new ExclusiveRange(0, (-1), true).isEmpty());
  Assert.assertFalse(new ExclusiveRange((-1), 0, true).isEmpty());
  Assert.assertFalse(new ExclusiveRange(5, 1, false).isEmpty());
  Assert.assertTrue(new ExclusiveRange(0, 0, false).isEmpty());
  Assert.assertTrue(new ExclusiveRange((-1), 0, false).isEmpty());
  Assert.assertFalse(new ExclusiveRange(0, (-1), false).isEmpty());
}
项目:xtext-lib    文件:ExclusiveRangeTest.java   
@Test
public void testContains() {
  Assert.assertFalse(new ExclusiveRange(1, 5, true).contains(0));
  Assert.assertTrue(new ExclusiveRange(1, 5, true).contains(1));
  Assert.assertTrue(new ExclusiveRange(1, 5, true).contains(2));
  Assert.assertTrue(new ExclusiveRange(1, 5, true).contains(3));
  Assert.assertTrue(new ExclusiveRange(1, 5, true).contains(4));
  Assert.assertFalse(new ExclusiveRange(1, 5, true).contains(5));
  Assert.assertFalse(new ExclusiveRange(0, 0, true).contains(0));
  Assert.assertFalse(new ExclusiveRange(0, (-1), true).contains(0));
  Assert.assertFalse(new ExclusiveRange(0, (-1), true).contains((-1)));
  Assert.assertFalse(new ExclusiveRange((-1), 0, true).contains((-2)));
  Assert.assertTrue(new ExclusiveRange((-1), 0, true).contains((-1)));
  Assert.assertFalse(new ExclusiveRange((-1), 0, true).contains((-0)));
  Assert.assertFalse(new ExclusiveRange(5, 1, false).contains(0));
  Assert.assertTrue(new ExclusiveRange(5, 1, false).contains(1));
  Assert.assertTrue(new ExclusiveRange(5, 1, false).contains(2));
  Assert.assertTrue(new ExclusiveRange(5, 1, false).contains(3));
  Assert.assertTrue(new ExclusiveRange(5, 1, false).contains(4));
  Assert.assertFalse(new ExclusiveRange(5, 1, false).contains(5));
  Assert.assertFalse(new ExclusiveRange(0, 0, false).contains(0));
  Assert.assertFalse(new ExclusiveRange((-1), 0, false).contains(0));
  Assert.assertFalse(new ExclusiveRange((-1), 0, false).contains((-1)));
  Assert.assertFalse(new ExclusiveRange(0, (-1), false).contains((-2)));
  Assert.assertTrue(new ExclusiveRange(0, (-1), false).contains((-1)));
  Assert.assertFalse(new ExclusiveRange(0, (-1), false).contains((-0)));
}
项目:xtext-core    文件:PreferenceTaskTagProvider.java   
public static List<TaskTag> parseTags(final String names, final String priorities) {
  final Splitter splitter = Splitter.on(",").omitEmptyStrings().trimResults();
  final List<String> tags = IterableExtensions.<String>toList(splitter.split(names));
  final List<String> prios = IterableExtensions.<String>toList(splitter.split(priorities));
  final ArrayList<TaskTag> elements = CollectionLiterals.<TaskTag>newArrayList();
  int _size = tags.size();
  ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
  for (final Integer i : _doubleDotLessThan) {
    TaskTag _taskTag = new TaskTag();
    final Procedure1<TaskTag> _function = (TaskTag it) -> {
      it.setName(tags.get((i).intValue()));
      Priority _xifexpression = null;
      int _size_1 = prios.size();
      boolean _greaterEqualsThan = (_size_1 >= (i).intValue());
      if (_greaterEqualsThan) {
        Priority _xtrycatchfinallyexpression = null;
        try {
          _xtrycatchfinallyexpression = Priority.valueOf(prios.get((i).intValue()));
        } catch (final Throwable _t) {
          if (_t instanceof IllegalArgumentException) {
            _xtrycatchfinallyexpression = Priority.NORMAL;
          } else {
            throw Exceptions.sneakyThrow(_t);
          }
        }
        _xifexpression = _xtrycatchfinallyexpression;
      } else {
        _xifexpression = Priority.NORMAL;
      }
      it.setPriority(_xifexpression);
    };
    TaskTag _doubleArrow = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag, _function);
    elements.add(_doubleArrow);
  }
  return elements;
}
项目:xtext-core    文件:DefaultTaskFinderTest.java   
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) {
    TaskAssert.assertExactMatch(expectedTasks.get((i).intValue()), actualTasks.get((i).intValue()));
  }
}
项目:xtext-core    文件:DefaultTaskParserTest.java   
private void assertContainsTasks(final CharSequence source, final List<Task> expectedTasks) {
  final List<Task> actualTasks = this.parser.parseTasks(LineDelimiters.toUnix(source.toString()), this.definitions);
  Assert.assertEquals(expectedTasks.size(), actualTasks.size());
  int _size = expectedTasks.size();
  ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
  for (final Integer i : _doubleDotLessThan) {
    TaskAssert.assertExactMatch(expectedTasks.get((i).intValue()), actualTasks.get((i).intValue()));
  }
}
项目:xtext-core    文件:SerializableResourceDescriptionTest.java   
public void assertDescriptionsEqual(final SerializableResourceDescription before, final SerializableResourceDescription after) {
  Assert.assertEquals(before.getURI(), after.getURI());
  Assert.assertEquals(before.getImportedNames(), after.getImportedNames());
  Assert.assertEquals(before.getReferences().size(), after.getReferences().size());
  int _size = before.getReferences().size();
  ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
  for (final int i : _doubleDotLessThan) {
    {
      final SerializableReferenceDescription beforeRef = before.getReferences().get(i);
      final SerializableReferenceDescription afterRef = after.getReferences().get(i);
      Assert.assertEquals(beforeRef.getContainerEObjectURI(), afterRef.getContainerEObjectURI());
      Assert.assertEquals(beforeRef.getSourceEObjectUri(), afterRef.getSourceEObjectUri());
      Assert.assertEquals(beforeRef.getTargetEObjectUri(), afterRef.getTargetEObjectUri());
      Assert.assertEquals(beforeRef.getEReference(), afterRef.getEReference());
      Assert.assertEquals(beforeRef.getIndexInList(), afterRef.getIndexInList());
    }
  }
  Assert.assertEquals(before.getDescriptions().size(), after.getDescriptions().size());
  int _size_1 = before.getDescriptions().size();
  ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, _size_1, true);
  for (final int i_1 : _doubleDotLessThan_1) {
    {
      final SerializableEObjectDescription beforeDesc = before.getDescriptions().get(i_1);
      final SerializableEObjectDescription afterDesc = after.getDescriptions().get(i_1);
      Assert.assertEquals(beforeDesc.getEClass(), afterDesc.getEClass());
      Assert.assertEquals(beforeDesc.getName(), afterDesc.getName());
      Assert.assertEquals(beforeDesc.qualifiedName, afterDesc.qualifiedName);
      Assert.assertEquals(beforeDesc.userData, afterDesc.userData);
      Assert.assertEquals(beforeDesc.getEObjectURI(), afterDesc.getEObjectURI());
    }
  }
}
项目:RigidBodies    文件:RigidBodiesGenerator.java   
public Integer getMaxJRows(final ConnectiveTreeBuilder ctb) {
  List<Pair<String, List<JointMovement>>> _states = ctb.getStates();
  int _size = _states.size();
  ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
  final Function2<Integer, Integer, Integer> _function = new Function2<Integer, Integer, Integer>() {
    @Override
    public Integer apply(final Integer acc, final Integer idx) {
      int _rowNumForState = RigidBodiesGenerator.this.getRowNumForState(ctb, (idx).intValue());
      return Integer.valueOf(Math.max((acc).intValue(), _rowNumForState));
    }
  };
  return IterableExtensions.<Integer, Integer>fold(_doubleDotLessThan, Integer.valueOf(1), _function);
}
项目:org.pshdl    文件:CommonCompilerExtension.java   
public CommonCompilerExtension(final ExecutableModel em, final int bitWidth) {
  this.em = em;
  int _length = em.variables.length;
  ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _length, true);
  for (final Integer i : _doubleDotLessThan) {
    this.varIdx.put(em.variables[(i).intValue()].name, i);
  }
}
项目:TP4INFO    文件:MemoizeProcessor.java   
public void doTransform(final List<? extends MutableMethodDeclaration> methods, @Extension final TransformationContext context) {
  int _size = methods.size();
  ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
  for (final Integer i : _doubleDotLessThan) {
    {
      final MutableMethodDeclaration it = methods.get((i).intValue());
      List<MutableParameterDeclaration> _parameters = it.getParameters();
      int _size_1 = _parameters.size();
      final int _switchValue = _size_1;
      boolean _matched = false;
      if (!_matched) {
        if (Objects.equal(_switchValue,0)) {
          _matched=true;
          ParamterlessMethodMemoizer _paramterlessMethodMemoizer = new ParamterlessMethodMemoizer(it, context, (i).intValue());
          _paramterlessMethodMemoizer.generate();
        }
      }
      if (!_matched) {
        if (Objects.equal(_switchValue,1)) {
          _matched=true;
          SingleParameterMethodMemoizer _singleParameterMethodMemoizer = new SingleParameterMethodMemoizer(it, context, (i).intValue());
          _singleParameterMethodMemoizer.generate();
        }
      }
      if (!_matched) {
        MultipleParameterMethodMemoizer _multipleParameterMethodMemoizer = new MultipleParameterMethodMemoizer(it, context, (i).intValue());
        _multipleParameterMethodMemoizer.generate();
      }
    }
  }
}