Search in sources :

Example 11 with ExclusiveRange

use of org.eclipse.xtext.xbase.lib.ExclusiveRange in project xtext-core by eclipse.

the class ChunkedResourceDescriptions method readExternal.

@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);
        }
    }
}
Also used : ResourceDescriptionsData(org.eclipse.xtext.resource.impl.ResourceDescriptionsData) IResourceDescription(org.eclipse.xtext.resource.IResourceDescription) ArrayList(java.util.ArrayList) ExclusiveRange(org.eclipse.xtext.xbase.lib.ExclusiveRange)

Example 12 with ExclusiveRange

use of org.eclipse.xtext.xbase.lib.ExclusiveRange in project xtext-core by eclipse.

the class SerializableResourceDescription method readExternal.

@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));
    }
}
Also used : SerializableEObjectDescription(org.eclipse.xtext.resource.persistence.SerializableEObjectDescription) SerializableReferenceDescription(org.eclipse.xtext.resource.persistence.SerializableReferenceDescription) QualifiedName(org.eclipse.xtext.naming.QualifiedName) ArrayList(java.util.ArrayList) ExclusiveRange(org.eclipse.xtext.xbase.lib.ExclusiveRange)

Example 13 with ExclusiveRange

use of org.eclipse.xtext.xbase.lib.ExclusiveRange in project xtext-core by eclipse.

the class SerializableResourceDescriptionTest method assertDescriptionsEqual.

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());
        }
    }
}
Also used : SerializableEObjectDescription(org.eclipse.xtext.resource.persistence.SerializableEObjectDescription) SerializableReferenceDescription(org.eclipse.xtext.resource.persistence.SerializableReferenceDescription) ExclusiveRange(org.eclipse.xtext.xbase.lib.ExclusiveRange)

Example 14 with ExclusiveRange

use of org.eclipse.xtext.xbase.lib.ExclusiveRange in project xtext-core by eclipse.

the class DefaultTaskFinderTest 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) {
        TaskAssert.assertExactMatch(expectedTasks.get((i).intValue()), actualTasks.get((i).intValue()));
    }
}
Also used : Task(org.eclipse.xtext.tasks.Task) ExclusiveRange(org.eclipse.xtext.xbase.lib.ExclusiveRange)

Example 15 with ExclusiveRange

use of org.eclipse.xtext.xbase.lib.ExclusiveRange in project xtext-core by eclipse.

the class DefaultTaskParserTest method testLongInputManyTasks.

@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());
    }
}
Also used : Task(org.eclipse.xtext.tasks.Task) IntegerRange(org.eclipse.xtext.xbase.lib.IntegerRange) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) ExclusiveRange(org.eclipse.xtext.xbase.lib.ExclusiveRange) Test(org.junit.Test)

Aggregations

ExclusiveRange (org.eclipse.xtext.xbase.lib.ExclusiveRange)17 Task (org.eclipse.xtext.tasks.Task)4 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)3 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 TypeReference (org.eclipse.xtend.lib.macro.declaration.TypeReference)2 SerializableEObjectDescription (org.eclipse.xtext.resource.persistence.SerializableEObjectDescription)2 SerializableReferenceDescription (org.eclipse.xtext.resource.persistence.SerializableReferenceDescription)2 TaskTag (org.eclipse.xtext.tasks.TaskTag)2 LightweightTypeReference (org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference)2 Splitter (com.google.common.base.Splitter)1 HashSet (java.util.HashSet)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 URI (org.eclipse.emf.common.util.URI)1 EObject (org.eclipse.emf.ecore.EObject)1 WidgetNotFoundException (org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException)1 ResolvedParameterImpl (org.eclipse.xtend.core.macro.declaration.ResolvedParameterImpl)1 AbstractParameterBuilder (org.eclipse.xtend.ide.codebuilder.AbstractParameterBuilder)1 VariableNameAcceptor (org.eclipse.xtend.ide.codebuilder.VariableNameAcceptor)1 AnnotationReference (org.eclipse.xtend.lib.macro.declaration.AnnotationReference)1