Search in sources :

Example 6 with TopologicalSorter

use of org.eclipse.xtext.ide.server.TopologicalSorter in project xtext-core by eclipse.

the class BuildOrderTest method testChain.

@Test
public void testChain() {
    ProjectDescription _projectDescription = new ProjectDescription();
    final Procedure1<ProjectDescription> _function = (ProjectDescription it) -> {
        it.setName("a");
        it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("b")));
    };
    final ProjectDescription a = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription, _function);
    ProjectDescription _projectDescription_1 = new ProjectDescription();
    final Procedure1<ProjectDescription> _function_1 = (ProjectDescription it) -> {
        it.setName("b");
        it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("c")));
    };
    final ProjectDescription b = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_1, _function_1);
    ProjectDescription _projectDescription_2 = new ProjectDescription();
    final Procedure1<ProjectDescription> _function_2 = (ProjectDescription it) -> {
        it.setName("c");
        it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("d")));
    };
    final ProjectDescription c = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_2, _function_2);
    ProjectDescription _projectDescription_3 = new ProjectDescription();
    final Procedure1<ProjectDescription> _function_3 = (ProjectDescription it) -> {
        it.setName("d");
        it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList()));
    };
    final ProjectDescription d = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_3, _function_3);
    final Procedure1<ProjectDescription> _function_4 = (ProjectDescription it) -> {
        Assert.fail();
    };
    this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(d, c, b, a)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d)), _function_4));
}
Also used : TopologicalSorter(org.eclipse.xtext.ide.server.TopologicalSorter) ProjectDescription(org.eclipse.xtext.resource.impl.ProjectDescription) Test(org.junit.Test)

Aggregations

TopologicalSorter (org.eclipse.xtext.ide.server.TopologicalSorter)6 ProjectDescription (org.eclipse.xtext.resource.impl.ProjectDescription)6 Test (org.junit.Test)6