ReaderTGFF { protected Application<Task, Dependency> toApplication(List<String> in) { Application<Task, Dependency> application = new Application<Task, Dependency>(); Iterator<String> it = in.iterator(); String currentLine; while (it.hasNext()) { currentLine = it.next(); if (currentLine.contains(HYPERPERIOD)) { this.hyperperiod = importHyperperiod(currentLine); } else if (currentLine.contains(COMMUN_QUANT)) { this.messageSizes = importMessageSizes(it); } else if (currentLine.contains(TASK_GRAPH)) { importTaskGraph(currentLine, it, application); } } return application; }  SpecificationTypeBased read(String filename); SpecificationTypeBased read(File file); SpecificationTypeBased read(InputStream in); SpecificationTypeBased toSpecification(List<String> in); static final String TGFF_TYPE; static final String PERIOD; static final String MSG_SIZE; static final String RES_ATTRIBUTES; static final String RES_VALUES; static final String HARD_DEADLINE; static final String SOFT_DEADLINE; static final String WIRE; }
@Test public void testToApplication() { List<String> in = Arrays.asList("@HYPERPERIOD 300", "@COMMUN_QUANT 0 {", "# type quantity", "0 5", "1 6", "}", "@TASK_GRAPH 0 {", "PERIOD 300", "TASK t0_0 TYPE 1", "TASK t0_1 TYPE 2", "TASK t0_2 TYPE 2", "TASK t0_3 TYPE 2", "ARC a0_0 FROM t0_0 TO t0_1 TYPE 0", "ARC a0_1 FROM t0_1 TO t0_2 TYPE 0", "ARC a0_2 FROM t0_0 TO t0_3 TYPE 1", "HARD_DEADLINE d0_0 ON t0_2 AT 300", "SOFT_DEADLINE d0_1 ON t0_3 AT 200", "}"); Application<Task, Dependency> application = new ReaderTGFF().toApplication(in); Assert.assertNotNull(application); Assert.assertEquals(7, application.getVertexCount()); Assert.assertEquals(6, application.getEdgeCount()); List<String> ids = new ArrayList<String>( Arrays.asList("t0_0_0", "t0_1_0", "t0_2_0", "t0_3_0", "a0_0", "a0_1", "a0_2")); for (Task task : application.getVertices()) { Assert.assertTrue(ids.contains(task.getId())); } List<String> edges = new ArrayList<String>( Arrays.asList("a0_0_0", "a0_0_1", "a0_1_0", "a0_1_1", "a0_2_0", "a0_2_1")); for (Dependency edge : application.getEdges()) { Assert.assertTrue(edges.contains(edge.getId())); } }