@Test public void readingNotation() throws IOException { Resource coffeeResource = loadResource("SuperBrewer3000.coffee"); Resource notationResource = loadResource("SuperBrewer3000.coffeenotation"); WorkflowFacade facade = new WorkflowFacade(coffeeResource, notationResource); Machine machine = (Machine) coffeeResource.getContents().get(0); Workflow workflow = machine.getWorkflows().get(0); Node preHeat = workflow.getNodes().get(0); Optional<DiagramElement> diagramElement = facade.findDiagramElement(preHeat); assertTrue(diagramElement.isPresent()); assertTrue(diagramElement.get() instanceof Shape); Shape preHeatShape = (Shape) diagramElement.get(); assertEquals(23.0, preHeatShape.getPosition().getX()); assertEquals(46.0, preHeatShape.getPosition().getY()); }
public <T extends DiagramElement> Optional<T> findDiagramElement(EObject semanticElement, Class<T> clazz) { return findDiagramElement(semanticElement).map(elem -> safeCast(elem, clazz)); }
WorkflowFacade { public <T extends DiagramElement> Optional<T> findDiagramElement(EObject semanticElement, Class<T> clazz) { return findDiagramElement(semanticElement).map(elem -> safeCast(elem, clazz)); } }
WorkflowFacade { public <T extends DiagramElement> Optional<T> findDiagramElement(EObject semanticElement, Class<T> clazz) { return findDiagramElement(semanticElement).map(elem -> safeCast(elem, clazz)); } WorkflowFacade(Resource coffeeResource, Resource notationResource); }
WorkflowFacade { public <T extends DiagramElement> Optional<T> findDiagramElement(EObject semanticElement, Class<T> clazz) { return findDiagramElement(semanticElement).map(elem -> safeCast(elem, clazz)); } WorkflowFacade(Resource coffeeResource, Resource notationResource); Resource getSemanticResource(); Resource getNotationResource(); Optional<Machine> getMachine(); Diagram initializeNotation(Workflow workflow); Diagram initializeMissing(Diagram diagram); Shape initializeShape(Node node); Edge initializeEdge(Flow flow); SemanticProxy createProxy(EObject eObject); List<DiagramElement> findUnresolvableElements(Diagram diagram); SemanticProxy resolved(SemanticProxy proxy); SemanticProxy reResolved(SemanticProxy proxy); Optional<T> findDiagramElement(EObject semanticElement, Class<T> clazz); Optional<DiagramElement> findDiagramElement(EObject semanticElement); boolean containsDiagramElementForSemanticElement(EObject diagram, EObject semanticElement); Optional<DiagramElement> findDiagramElement(EObject semanticElement, Workflow workflow); Optional<DiagramElement> findDiagramElement(EObject semanticElement, Optional<Diagram> diagram); boolean isDiagramElementForSemanticElement(DiagramElement diagramElement, EObject semanticElement); Optional<Diagram> findDiagram(Workflow workflow); boolean isDiagramForWorkflow(EObject diagram, Workflow workflow); void setCurrentWorkflowIndex(int workflowIndex); Workflow getCurrentWorkflow(); }
WorkflowFacade { public <T extends DiagramElement> Optional<T> findDiagramElement(EObject semanticElement, Class<T> clazz) { return findDiagramElement(semanticElement).map(elem -> safeCast(elem, clazz)); } WorkflowFacade(Resource coffeeResource, Resource notationResource); Resource getSemanticResource(); Resource getNotationResource(); Optional<Machine> getMachine(); Diagram initializeNotation(Workflow workflow); Diagram initializeMissing(Diagram diagram); Shape initializeShape(Node node); Edge initializeEdge(Flow flow); SemanticProxy createProxy(EObject eObject); List<DiagramElement> findUnresolvableElements(Diagram diagram); SemanticProxy resolved(SemanticProxy proxy); SemanticProxy reResolved(SemanticProxy proxy); Optional<T> findDiagramElement(EObject semanticElement, Class<T> clazz); Optional<DiagramElement> findDiagramElement(EObject semanticElement); boolean containsDiagramElementForSemanticElement(EObject diagram, EObject semanticElement); Optional<DiagramElement> findDiagramElement(EObject semanticElement, Workflow workflow); Optional<DiagramElement> findDiagramElement(EObject semanticElement, Optional<Diagram> diagram); boolean isDiagramElementForSemanticElement(DiagramElement diagramElement, EObject semanticElement); Optional<Diagram> findDiagram(Workflow workflow); boolean isDiagramForWorkflow(EObject diagram, Workflow workflow); void setCurrentWorkflowIndex(int workflowIndex); Workflow getCurrentWorkflow();  }