Examples of FamixAssociation


Examples of org.evolizer.famix.model.entities.FamixAssociation

            FamixMethod caller = getCurrMethod();
            FamixMethod callee = createMethodFromInvocation();
   
            if ((caller != null) && (callee != null)) {
                callee = (FamixMethod) getModel().addElement(callee);
                FamixAssociation invocation = getFactory().createInvocation(caller, callee);
                invocation.setSourceAnchor(getSourceAnchor());
                invocation.setStatement(getASTNode().toString());
                getModel().addRelation(invocation);
            }
        } catch (NullPointerException e) {
            sLogger.error("Error processing invocation in method "
                    + (getCurrMethod() != null ? getCurrMethod().getUniqueName() : "<no method>") + "\n"
View Full Code Here

Examples of org.evolizer.famix.model.entities.FamixAssociation

            EdgeRealizer edgeRealizer = fPanel.getGraph().getRealizer(edge);
            if (fPanel.getViewConfigModel().getAssociationTypeVisibility().get(associationType).booleanValue()) {
                // check whether from and to node are also visible
                // if edge is an aggregated edge then check if the source and target node of the first lower level edge are visible
                List<Edge> lowLevelEdges = fPanel.getGraph().getLowLevelEdges(edge);
                FamixAssociation association;
                if (lowLevelEdges != null && lowLevelEdges.size() > 0) {
                    association = fPanel.getGraph().getAssociation(lowLevelEdges.get(0));
                } else {
                    association = fPanel.getGraph().getAssociation(edge);
                }
                NodeRealizer fromRealizer = fPanel.getGraph().getRealizer(fPanel.getGraph().getNode(association.getFrom()));
                NodeRealizer toRealizer = fPanel.getGraph().getRealizer(fPanel.getGraph().getNode(association.getTo()));
                if (fromRealizer != null && toRealizer != null) {
                    if (fromRealizer.isVisible() && toRealizer.isVisible()) {
                        edgeRealizer.setVisible(true);
                    } else {
                        edgeRealizer.setVisible(false);
View Full Code Here

Examples of org.evolizer.famix.model.entities.FamixAssociation

                lField.setDeclaredClass(getDataType());

                // If there is any initialization to this field then we write them as an access by <init> or <clinit>
                Expression lInit = fragment.getInitializer();
                if (lInit != null) {
                    FamixAssociation access = getFactory().createAccess(getCurrMethod(), lField);
                    access.setSourceAnchor(getSourceAnchor(fragment));
                    getModel().addRelation(access);

                    lInit.accept(getCrawler());
                }
            } else {
View Full Code Here

Examples of org.evolizer.famix.model.entities.FamixAssociation

        ITypeBinding lBinding = getASTNode().resolveTypeBinding();

        try {
            FamixClass lClass = getClass(lBinding, getASTNode().getType(), false);
            lClass = (FamixClass) getModel().addElement(lClass);
            FamixAssociation castTo = getFactory().createCastTo(getCurrMethod(), lClass);
            castTo.setSourceAnchor(getSourceAnchor());
            getModel().addRelation(castTo);
        } catch (NullPointerException e) {
            sLogger.error("Error processing cast expression in method "
                    + (getCurrMethod() != null ? getCurrMethod().getUniqueName() : "<no method>") + "\n"
                    + getASTNode().toString()
View Full Code Here

Examples of org.evolizer.famix.model.entities.FamixAssociation

    fSessionHandler = null;
  }
 
  @Test
  public void testFamixAssociationAndSourceAnchorConnection() throws EvolizerException{
    FamixAssociation association = new FamixAssociation();
    SourceAnchor anchor = new SourceAnchor("someFile", new Integer(1),new Integer(2));
    association.setSourceAnchor(anchor);
    fEvolizerSession.startTransaction();
    fEvolizerSession.saveObject(anchor);
    fEvolizerSession.saveObject(association);
    fEvolizerSession.endTransaction();
    fEvolizerSession.close();
   
    fEvolizerSession = fSessionHandler.getCurrentSession(fDBUrl);
   
    List<FamixAssociation> associationResults = fEvolizerSession.query("from FamixAssociation", FamixAssociation.class);
    assertEquals(1,associationResults.size());
    FamixAssociation associationResult = associationResults.get(0);
    SourceAnchor anchorresult = associationResult.getSourceAnchor();
    assertEquals("someFile", anchorresult.getFile());
    assertEquals(2, anchorresult.getEndPos().intValue());
    assertEquals(1, anchorresult.getStartPos().intValue());
  }
View Full Code Here

Examples of org.evolizer.famix.model.entities.FamixAssociation

    public void testSourceAnchorClassInheritance() throws Exception {
        //        FamixClass interfaceBase = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.IBase", null));
        FamixClass classBase = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.Base", null));
        FamixClass classSum = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.Sum", null));

        FamixAssociation inheritance = null;
        for (FamixAssociation ass : aModel.getAssociations(classSum)) {
            if (ass instanceof FamixInheritance && ass.getTo().equals(classBase)) {
                inheritance = ass;
                break;
            }
        }
        assertNotNull("The class Sum must contain 1 inheritance associtaino to class Base", inheritance);

        SourceAnchor anchor = inheritance.getSourceAnchor();
        assertNotNull("Source anchor file of invocation " + inheritance.getFrom().getUniqueName() + " - " + inheritance.getTo().getUniqueName() + " must not be null", anchor);
        assertEquals("Source anchor file of invocation " + inheritance.getFrom().getUniqueName() + " - " + inheritance.getTo().getUniqueName() + " must be", "/TestProject1/src/testPackage/Sum.java", anchor.getFile());
        assertTrue("The start must be before the end position", anchor.getStartPos() <= anchor.getEndPos());
        InputStream fileStream = ResourcesPlugin.getWorkspace().getRoot().getFile(Path.fromPortableString(anchor.getFile())).getContents();
        String fileContent = TestHelper.getFileContent(fileStream);
        String extendsStatement = fileContent.substring(anchor.getStartPos(), anchor.getEndPos());
        assertEquals("FamixInheritance of "  + inheritance.getFrom().getUniqueName() + " - " + inheritance.getTo().getUniqueName() + " must be 'Base'", "Base", extendsStatement);
    }
View Full Code Here

Examples of org.evolizer.famix.model.entities.FamixAssociation

    assertEquals(1, anchorresult.getStartPos().intValue());
  }
 
  @Test
  public void testAssiocationAndFamixEntityConnection() throws EvolizerException{
    FamixAssociation association = new FamixAssociation();
    FamixMethod functionTo = new FamixMethod("functionTo");
    FamixMethod functionFrom = new FamixMethod("functionFrom");
    association.setFrom(functionFrom);
    association.setTo(functionTo);
   
   
    fEvolizerSession.startTransaction();
    fEvolizerSession.saveObject(functionTo);
    fEvolizerSession.saveObject(functionFrom);
    fEvolizerSession.saveObject(association);
    fEvolizerSession.endTransaction();
    fEvolizerSession.close();
   
    fEvolizerSession = fSessionHandler.getCurrentSession(fDBUrl);
   
    List<FamixAssociation> associationResults = fEvolizerSession.query("from FamixAssociation", FamixAssociation.class);
    assertEquals(1, associationResults.size());
   
    FamixAssociation associationResult = associationResults.get(0);
    assertEquals("functionTo", associationResult.getTo().getName());
    assertEquals("functionFrom", associationResult.getFrom().getName());
  }
View Full Code Here

Examples of org.evolizer.famix.model.entities.FamixAssociation

        List<FamixAssociation> associations = new ArrayList<FamixAssociation>();
        for (Edge edge : edges) {
            List<Edge> lowLevelEdges = getLowLevelEdges(edge);
            if (lowLevelEdges != null && lowLevelEdges.size() > 0) {
                for (Edge lowLevelEdge : lowLevelEdges) {
                    FamixAssociation association = getAssociation(lowLevelEdge);
                    if (association != null) {
                        associations.add(association);
                    } else {
                        sLogger.error("Could not determine FAMIX association of edge " + edge);
                    }
                }
            } else {
                FamixAssociation association = getAssociation(edge);
                if (association != null) {
                    associations.add(association);
                } else {
                    sLogger.error("Could not determine FAMIX association of edge " + edge);
                }
View Full Code Here

Examples of org.evolizer.famix.model.entities.FamixAssociation

     * @return The reinserted edge (if it has been successfully reinserted and replaced the old one).
     */
    public Edge reinsertLowLevelEdge(Edge lowLevelEdge) {
        Edge reinsertedEdge = null;

        FamixAssociation association = this.getAssociation(lowLevelEdge);
        if (association != null) {
            Node from = this.getNode(association.getFrom());
            Node to = this.getNode(association.getTo());
            reinsertedEdge = getHierarchyManager().createEdge(from, to);

            getEdgeToFamixMap().set(lowLevelEdge, null); // delete old edge

            getEdgeToFamixMap().set(reinsertedEdge, association); // add link between new low level edge and association
View Full Code Here

Examples of org.evolizer.famix.model.entities.FamixAssociation

            edgeToCheck = edge;
        }

        Class<? extends FamixAssociation> type = null;
        try {
            FamixAssociation a = this.getAssociation(edgeToCheck);
            type = a.getClass();
        } catch (NullPointerException npe) {
            sLogger.error("Error obtaining edge type " + edge.toString() + " association not contained in edge map");
            throw new EvolizerRuntimeException("Error obtaining edge type " + edge.toString(), npe);
        }
        return type;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.