Package org.evolizer.daforjava.graph.data

Examples of org.evolizer.daforjava.graph.data.DependencyGraph


     *
     * @param node The node to configure.
     */
    private void configureNode(Node node) {
        Graph2D graph = (Graph2D) node.getGraph();
        DependencyGraph rootGraph = (DependencyGraph) graph.getHierarchyManager().getRootGraph();
        AbstractFamixEntity entity = rootGraph.getFamixEntity(node);

        NodeRealizer nr = graph.getRealizer(node);
        NodeRealizer newNodeRealizer = null;
        if (nr instanceof GroupNodeRealizer) {
            newNodeRealizer = new FamixGroupNodeRealizer(nr);
View Full Code Here


     *
     * @param edge the edge
     */
    private void configureHighLevelEdge(Edge edge) {
        Graph2D graph = (Graph2D) edge.getGraph();
        DependencyGraph rootGraph = (DependencyGraph) graph.getHierarchyManager().getRootGraph();

        Class<? extends FamixAssociation> associationType = rootGraph.getEdgeType(edge);
        EdgeRealizer er = graph.getRealizer(edge);
        EdgeRealizer newEdgeRealizer = null;
        if (associationType.equals(FamixInvocation.class)) {
            newEdgeRealizer = new DefaultFamixEdgeRealizer(er);
        } else if (associationType.equals(FamixInheritance.class)) {
            newEdgeRealizer = new DeltaEdgeRealizer(er);
        } else if (associationType.equals(FamixSubtyping.class)) {
            newEdgeRealizer = new DashedDeltaEdgeRealizer(er);
        } else if (associationType.equals(FamixCastTo.class)) {
            newEdgeRealizer = new DefaultFamixEdgeRealizer(er);
        } else if (associationType.equals(FamixCheckInstanceOf.class)) {
            newEdgeRealizer = new DefaultFamixEdgeRealizer(er);
        } else if (associationType.equals(FamixAccess.class)) {
            newEdgeRealizer = new DefaultFamixEdgeRealizer(er);
        } else {
            sLogger.warn("Edgetype of " + associationType + " currently not supported - using default");
            newEdgeRealizer = new DefaultFamixEdgeRealizer(er);
        }

        List<Edge> lowLevelEdges = rootGraph.getLowLevelEdges(edge);
        int nrLowLevelEdges = 1;
        if (lowLevelEdges != null) {
            nrLowLevelEdges = lowLevelEdges.size();
        }

View Full Code Here

            final AbstractSelectionStrategy postLayout) {

        //        try {
        // fToolbar.updateUndoRedoButtons(fCommandController.canUndo(),fCommandController.canRedo());
        // getGraphElementsVisibilityController().updateGraphElementsVisibility();
        final DependencyGraph graph = (DependencyGraph) fGraphView.getGraph2D();
        if (doLayout) {
            final LayoutModule layoutModule = graph.getLayoutModule();

            layoutModule.addModuleListener(new ModuleListener() {
                public void moduleEventHappened(ModuleEvent event) {
                    if (event.getEventType() == ModuleEvent.TYPE_MODULE_MAIN_RUN_FINISHED) {
                        if (postLayout != null) {
View Full Code Here

                queryResult,
                fGraphPanel.getGraphLoader(),
                fGraphPanel.getEdgeGrouper());
        command.execute();

        DependencyGraph graph = fGraphPanel.getGraph();

        org.evolizer.famix.model.entities.FamixClass planetClass = new org.evolizer.famix.model.entities.FamixClass("thebigvoid.Planet", null);
        Assert.assertTrue("Graph must contain FAMIX entity " + planetClass.getUniqueName(), graph.contains(planetClass));
        org.evolizer.famix.model.entities.FamixClass galaxyClass = new org.evolizer.famix.model.entities.FamixClass("thebigvoid.Galaxy", null);
        Assert.assertTrue("Graph must contain FAMIX entity " + galaxyClass.getUniqueName(), graph.contains(galaxyClass));
        org.evolizer.famix.model.entities.FamixMethod galaxyContstructor = new org.evolizer.famix.model.entities.FamixMethod("thebigvoid.Galaxy.<init>(java.lang.String)", null);
        Assert.assertTrue("Graph must contain FAMIX entity " + galaxyContstructor.getUniqueName(), graph.contains(galaxyContstructor));

        Assert.assertTrue("Command should add entities", command.getEditedEntities().size() > 0);
        Assert.assertTrue("Command should add associations", command.getEditedAssociations().size() > 0);
        Assert.assertTrue("Command should add class " + galaxyClass, command.getEditedEntities().contains(galaxyClass));
        Assert.assertTrue("Command should add method " + galaxyContstructor, command.getEditedEntities().contains(galaxyContstructor));

        Node planetClassNode = graph.getNode(planetClass);
        Node galaxyClassNode = graph.getNode(galaxyClass);
        Node galaxyConstructorNode = graph.getNode(galaxyContstructor);
        Assert.assertEquals("Parent node of " + galaxyConstructorNode + " has to be " + galaxyClassNode, galaxyClassNode, graph.getHierarchyManager().getParentNode(galaxyConstructorNode));

        Edge invocation = galaxyClassNode.getEdge(planetClassNode);
        Assert.assertNotNull("There should be an edge between " + galaxyClassNode + " and " + planetClassNode, invocation);
    }
View Full Code Here

    @Test
    public void addIncomingInvocationsToPlanet() {
        showClassPlanet();

        DependencyGraph graph = fGraphPanel.getGraph();
        org.evolizer.famix.model.entities.FamixPackage thebigvoidPackage = new org.evolizer.famix.model.entities.FamixPackage("thebigvoid", null);
        Assert.assertTrue("Graph must contain FAMIX entity " + thebigvoidPackage.getUniqueName(), graph.contains(thebigvoidPackage));
        org.evolizer.famix.model.entities.FamixClass planetClass = new org.evolizer.famix.model.entities.FamixClass("thebigvoid.Planet", null);
        Assert.assertTrue("Graph must contain FAMIX entity " + planetClass.getUniqueName(), graph.contains(planetClass));
        org.evolizer.famix.model.entities.FamixMethod planetContstructor = new org.evolizer.famix.model.entities.FamixMethod("thebigvoid.Planet.<init>(java.lang.String,java.awt.Color)", null);
        Assert.assertTrue("Graph must contain FAMIX entity " + planetContstructor.getUniqueName(), graph.contains(planetContstructor));

        Node thebigvoidPackageNode = graph.getNode(thebigvoidPackage);
        Node planetClassNode = graph.getNode(planetClass);
        //    Node planetConstructorNode = graph.getNode(planetContstructor);
        Assert.assertEquals(thebigvoidPackageNode + " node should have 1 child nodes before adding the associations", 1, graph.getHierarchyManager().getChildren(thebigvoidPackageNode).size());

        AbstractGraphEditCommand command = new AddEntitiesViaInDependenciesCommand(
                planetClassNode,
                fGraphPanel.getGraphLoader(),
                fGraphPanel.getEdgeGrouper(),
                org.evolizer.famix.model.entities.FamixInvocation.class);
        command.execute();

        org.evolizer.famix.model.entities.FamixClass galaxyClass = new org.evolizer.famix.model.entities.FamixClass("thebigvoid.Galaxy", null);
        Assert.assertTrue("Graph must contain FAMIX entity " + galaxyClass.getUniqueName(), graph.contains(galaxyClass));
        org.evolizer.famix.model.entities.FamixMethod galaxyContstructor = new org.evolizer.famix.model.entities.FamixMethod("thebigvoid.Galaxy.<init>(java.lang.String)", null);
        Assert.assertTrue("Graph must contain FAMIX entity " + galaxyContstructor.getUniqueName(), graph.contains(galaxyContstructor));
        Node galaxyClassNode = graph.getNode(galaxyClass);
        Node galaxyConstructorNode = graph.getNode(galaxyContstructor);

        //    fGraphPanel.getHierarchicEdgeGrouper().handleOpenFolder(planetClassNode);
        //    fGraphPanel.getHierarchicEdgeGrouper().handleOpenFolder(galaxyClassNode);

        Assert.assertEquals("Parent node of " + galaxyClassNode + " has to be " + thebigvoidPackageNode, thebigvoidPackageNode, graph.getHierarchyManager().getParentNode(galaxyClassNode));
        Assert.assertEquals("Parent node of " + galaxyConstructorNode + " has to be " + galaxyClassNode, galaxyClassNode, graph.getHierarchyManager().getParentNode(galaxyConstructorNode));
        Assert.assertEquals(thebigvoidPackageNode + " node should have 2 child nodes after adding the associations", 2, graph.getHierarchyManager().getChildren(thebigvoidPackageNode).size());
        Assert.assertEquals(galaxyClassNode + " node should have only 1 child node", 1, graph.getHierarchyManager().getChildren(galaxyClassNode).size());
        Assert.assertEquals(galaxyClassNode + " should have 1 edge", 1, galaxyClassNode.edges().size());
        // class folder nodes are closed
        Assert.assertNotNull("There should be an edge between " + galaxyClassNode + " and " + planetClassNode, galaxyClassNode.getEdge(planetClassNode));
    }
View Full Code Here

    @Test
    public void addOutgoingAllDependenciesFromPlanet() {
        showClassPlanet();

        DependencyGraph graph = fGraphPanel.getGraph();
        org.evolizer.famix.model.entities.FamixPackage thebigvoidPackage = new org.evolizer.famix.model.entities.FamixPackage("thebigvoid", null);
        Assert.assertTrue("Graph must contain FAMIX entity " + thebigvoidPackage.getUniqueName(), graph.contains(thebigvoidPackage));
        org.evolizer.famix.model.entities.FamixClass planetClass = new org.evolizer.famix.model.entities.FamixClass("thebigvoid.Planet", null);
        Assert.assertTrue("Graph must contain FAMIX entity " + planetClass.getUniqueName(), graph.contains(planetClass));
        org.evolizer.famix.model.entities.FamixMethod planetContstructor = new org.evolizer.famix.model.entities.FamixMethod("thebigvoid.Planet.<init>(java.lang.String,java.awt.Color)", null);
        Assert.assertTrue("Graph must contain FAMIX entity " + planetContstructor.getUniqueName(), graph.contains(planetContstructor));

        Node thebigvoidPackageNode = graph.getNode(thebigvoidPackage);
        Node planetClassNode = graph.getNode(planetClass);
        //    Node planetConstructorNode = graph.getNode(planetContstructor);
        Assert.assertEquals(thebigvoidPackageNode + " node should have 1 child nodes before adding the associations", 1, graph.getHierarchyManager().getChildren(thebigvoidPackageNode).size());

        AbstractGraphEditCommand command = new AddEntitiesViaOutDependenciesCommand(
                planetClassNode,
                fGraphPanel.getGraphLoader(),
                fGraphPanel.getEdgeGrouper(),
                null);
        command.execute();

        org.evolizer.famix.model.entities.FamixClass stellarObjectClass = new org.evolizer.famix.model.entities.FamixClass("thebigvoid.StellarObject", null);
        Assert.assertTrue("Graph must contain FAMIX entity " + stellarObjectClass.getUniqueName(), graph.contains(stellarObjectClass));
        org.evolizer.famix.model.entities.FamixAttribute stellarObjectName = new org.evolizer.famix.model.entities.FamixAttribute("thebigvoid.StellarObject.name", null);
        Assert.assertTrue("Graph must contain FAMIX entity " + stellarObjectName.getUniqueName(), graph.contains(stellarObjectName));
        Node stellarObjectClassNode = graph.getNode(stellarObjectClass);
        Node stellarObjectNameNode = graph.getNode(stellarObjectName);

        Assert.assertEquals("Parent node of " + stellarObjectClassNode + " has to be " + thebigvoidPackageNode, thebigvoidPackageNode, graph.getHierarchyManager().getParentNode(stellarObjectClassNode));
        Assert.assertEquals("Parent node of " + stellarObjectNameNode + " has to be " + stellarObjectClassNode, stellarObjectClassNode, graph.getHierarchyManager().getParentNode(stellarObjectNameNode));
        Assert.assertEquals(thebigvoidPackageNode + " node should have 2 child nodes after adding the associations", 2, graph.getHierarchyManager().getChildren(thebigvoidPackageNode).size());
        Assert.assertEquals(stellarObjectClassNode + " node should have only 1 child node", 1, graph.getHierarchyManager().getChildren(stellarObjectClassNode).size());
        Assert.assertEquals(stellarObjectClassNode + " should have 2 edge", 2, stellarObjectClassNode.edges().size());
        // class folder nodes are closed
        //    Assert.assertNotNull("There should be an edge between " + stellarObjectClassNode + " and " + planetClassNode, planetClassNode.getEdge(stellarObjectClassNode));
        for (EdgeCursor ec = stellarObjectClassNode.inEdges(); ec.ok(); ec.next()) {
            Assert.assertEquals("Edge should have " + planetClassNode + " as source node", planetClassNode, ec.edge().source());
View Full Code Here

TOP

Related Classes of org.evolizer.daforjava.graph.data.DependencyGraph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.