use of org.eclipse.xtext.ide.server.TopologicalSorter in project xtext-core by eclipse.
the class BuildOrderTest method testCycle1.
@Test
public void testCycle1() {
ProjectDescription _projectDescription = new ProjectDescription();
final Procedure1<ProjectDescription> _function = (ProjectDescription it) -> {
it.setName("a");
it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("a")));
};
final ProjectDescription a = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription, _function);
final ArrayList<ProjectDescription> cyclic = CollectionLiterals.<ProjectDescription>newArrayList();
final Procedure1<ProjectDescription> _function_1 = (ProjectDescription it) -> {
cyclic.add(it);
};
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList()), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), _function_1));
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), cyclic);
}
use of org.eclipse.xtext.ide.server.TopologicalSorter in project xtext-core by eclipse.
the class BuildOrderTest method testJustOne.
@Test
public void testJustOne() {
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");
};
final ProjectDescription b = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_1, _function_1);
final Procedure1<ProjectDescription> _function_2 = (ProjectDescription it) -> {
Assert.fail();
};
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), _function_2));
final Procedure1<ProjectDescription> _function_3 = (ProjectDescription it) -> {
Assert.fail();
};
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(b)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(b)), _function_3));
}
use of org.eclipse.xtext.ide.server.TopologicalSorter in project xtext-core by eclipse.
the class BuildOrderTest method testDiamond_1.
@Test
public void testDiamond_1() {
ProjectDescription _projectDescription = new ProjectDescription();
final Procedure1<ProjectDescription> _function = (ProjectDescription it) -> {
it.setName("a");
it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("b", "c", "d")));
};
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));
}
use of org.eclipse.xtext.ide.server.TopologicalSorter in project xtext-core by eclipse.
the class BuildOrderTest method testCycle.
@Test
public void testCycle() {
ProjectDescription _projectDescription = new ProjectDescription();
final Procedure1<ProjectDescription> _function = (ProjectDescription it) -> {
it.setName("a");
it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("b", "c")));
};
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", "d")));
};
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("b")));
};
final ProjectDescription d = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_3, _function_3);
ProjectDescription _projectDescription_4 = new ProjectDescription();
final Procedure1<ProjectDescription> _function_4 = (ProjectDescription it) -> {
it.setName("e");
it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList()));
};
final ProjectDescription e = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_4, _function_4);
final ArrayList<ProjectDescription> cyclic = CollectionLiterals.<ProjectDescription>newArrayList();
final Procedure1<ProjectDescription> _function_5 = (ProjectDescription it) -> {
cyclic.add(it);
};
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(e)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d, e)), _function_5));
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(b, d, c, a)), cyclic);
}
use of org.eclipse.xtext.ide.server.TopologicalSorter in project xtext-core by eclipse.
the class BuildOrderTest method testDiamond.
@Test
public void testDiamond() {
ProjectDescription _projectDescription = new ProjectDescription();
final Procedure1<ProjectDescription> _function = (ProjectDescription it) -> {
it.setName("a");
it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("b", "c")));
};
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));
}
Aggregations