Package org.evolizer.famix.model.entities

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


     * Computes and sets the return type class of a method declaration.
     */
    private void handleMethodReturnType() {
        if (!getASTNode().isConstructor()) {
            ITypeBinding returnTypeBinding = getASTNode().getReturnType2().resolveBinding();
            FamixClass lReturnType = getClass(returnTypeBinding, getASTNode().getReturnType2(), false);
            lReturnType = (FamixClass) getModel().addElement(lReturnType);
            getCurrMethod().setDeclaredReturnClass(lReturnType);
        }
    }
View Full Code Here


                lParameter.setSourceAnchor(getSourceAnchor((SingleVariableDeclaration) lParamDeclaration));
                getCurrMethod().getParameters().add(lParameter);

                // set data type
                ITypeBinding pBinding = ((SingleVariableDeclaration) lParamDeclaration).getType().resolveBinding();
                FamixClass lDataType = getClass(pBinding, ((SingleVariableDeclaration) lParamDeclaration).getType(), false);
                lDataType = (FamixClass) getModel().addElement(lDataType);
                lParameter.setDeclaredClass(lDataType);

                position++;
            }
View Full Code Here

    }

    @Test
    public void testInitializerAnonymousClassContainer() {
        FamixMethod initializer = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.<oinit>()", null));
        FamixClass anonymClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.ae.Test$1", null));

        assertNotNull("FamixModel must contain initializer testPackage.ae.Test.<oinit>()", initializer);
        assertNotNull("FamixModel must contain anonymous class testPackage.ae.Test$1", anonymClass);

        assertTrue("FamixMethod must contain anonymous class " + anonymClass.getUniqueName(), initializer.getAnonymClasses().contains(anonymClass));
        assertEquals("No or wrong parent method for anonymous class " + anonymClass.getUniqueName(),
                initializer, anonymClass.getParent());
    }
View Full Code Here

                lClassID = convert(pType);
            }
        }

        // check if the class is contained in the model
        FamixClass lClass = getFactory().createClass(lClassID, null);
        if (getModel().contains(lClass)) {
            lClass = (FamixClass) getModel().getElement(lClass);
        }
        return lClass;
    }
View Full Code Here

    }

    @Test
    public void testMethodAnonymousClassContainer() {
        FamixMethod method = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.containsAnonymClass()", null));
        FamixClass anonymClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.ae.Test$3", null));

        assertNotNull("FamixModel must contain initializer testPackage.ae.Test.containsAnonymClass()", method);
        assertNotNull("FamixModel must contain anonymous class testPackage.ae.Test$3", anonymClass);

        assertTrue("FamixMethod must contain anonymous class " + anonymClass.getUniqueName(), method.getAnonymClasses().contains(anonymClass));
        assertEquals("No or wrong parent method for anonymous class " + anonymClass.getUniqueName(),
                method, anonymClass.getParent());
    }
View Full Code Here

                method, anonymClass.getParent());
    }

    @Test
    public void testAnonymousClassMethodContainer() {
        FamixClass anonymClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.ae.Test$1", null));
        FamixMethod initializer = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test$1.<oinit>()", null));
        FamixMethod computeMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test$1.compute()", null));

        assertNotNull("FamixModel must contain anonymous class testPackage.ae.Test$1", anonymClass);
        assertNotNull("FamixModel must contain anonymous class initializer testPackage.ae.Test$1.<oinit>()", initializer);
        assertNotNull("FamixModel must contain ananymous class method testPackage.ae.Test$1.compute()", computeMethod);

        assertTrue("Anonymous class must contain initializer " + initializer.getUniqueName(), anonymClass.getMethods().contains(initializer));
        assertEquals("No or wrong parent class for initializer " + initializer.getUniqueName(),
                anonymClass, initializer.getParent());

        assertTrue("Anonymous class must contain method " + computeMethod.getUniqueName(), anonymClass.getMethods().contains(computeMethod));
        assertEquals("No or wrong parent class for method " + computeMethod.getUniqueName(),
                anonymClass, computeMethod.getParent());
    }
View Full Code Here

                anonymClass, computeMethod.getParent());
    }

    @Test
    public void testAnonymousClassAttributeContainer() {
        FamixClass anonymClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.ae.Test$1", null));
        FamixAttribute anonymAttribute = (FamixAttribute) aModel.getElement(aFactory.createAttribute("testPackage.ae.Test$1.anonymAttribute", null));

        assertNotNull("FamixModel must contain anonymous class testPackage.ae.Test$1", anonymClass);
        assertNotNull("FamixModel must contain ananymous class attribute testPackage.ae.Test$1.anonymAttribute", anonymAttribute);

        assertTrue("Anonymous class must contain attribute " + anonymAttribute.getUniqueName(), anonymClass.getAttributes().contains(anonymAttribute));
        assertEquals("No or wrong parent class for attribute " + anonymAttribute.getUniqueName(),
                anonymClass, anonymAttribute.getParent());
    }
View Full Code Here

        boolean visitChildren = true;
        setASTNode(instanceofExpression);

        try {
            ITypeBinding lBinding = getASTNode().getRightOperand().resolveBinding();
            FamixClass lClass = getClass(lBinding, getASTNode().getRightOperand(), false);
            lClass = (FamixClass) getModel().addElement(lClass);
            FamixAssociation instanceOf = getFactory().createCheckInstanceOf(getCurrMethod(), lClass);
            instanceOf.setSourceAnchor(getSourceAnchor());
            getModel().addRelation(instanceOf);
        } catch (NullPointerException e) {
View Full Code Here

                anonymClass, anonymAttribute.getParent());
    }

    @Test
    public void testAnonymousClassInitializer() {
        FamixClass anonymClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.ae.Test$1", null));
        FamixMethod oinitTest = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.<oinit>()", null));
        FamixMethod oinitAnonym = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test$1.<oinit>()", null));
        FamixMethod initAnonym = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test$1.<init>()", null));
        FamixAttribute anonymAttribute = (FamixAttribute) aModel.getElement(aFactory.createAttribute("testPackage.ae.Test$1.anonymAttribute", null));

        assertNotNull("FamixModel must contain anonymous class testPackage.ae.Test$1", anonymClass);
        assertNotNull("FamixModel must contain initializer testPackage.ae.Test.<oinit>()", oinitTest);
        assertNotNull("FamixModel must contain anonymous class initializer testPackage.ae.Test$1.<oinit>()", oinitAnonym);
        assertNotNull("FamixModel must contain anonymous class initializer testPackage.ae.Test$1.<init>()", initAnonym);
        assertNotNull("FamixModel must contain ananymous class attribute testPackage.ae.Test$1.anonymAttribute", anonymAttribute);
        assertNotNull(oinitAnonym);

        assertTrue("Anonymous class must contain initializer " + oinitAnonym.getUniqueName(), anonymClass.getMethods().contains(oinitAnonym));
        assertEquals("No or wrong parent class for initializer " + oinitAnonym.getUniqueName(),
                anonymClass, oinitAnonym.getParent());
        assertTrue("Anonymous class must contain initializer " + initAnonym.getUniqueName(), anonymClass.getMethods().contains(initAnonym));
        assertEquals("No or wrong parent class for initializer " + initAnonym.getUniqueName(),
                anonymClass, initAnonym.getParent());

        // FamixInvocation Test.<oinit> -> Test$1.<init>
        Set<FamixAssociation> lRelations = aModel.getAssociations(oinitTest);
View Full Code Here

        assertTrue("Missing invocation relationship from " + anonymComputeMethod.getUniqueName() + " to " + doubleItMethod.getUniqueName(), containsInvocationTo > 0);
    }

    @Test
    public void testAttributeType() {
        FamixClass classInt = (FamixClass) aModel.getElement(aFactory.createClass("int", null));
        FamixAttribute simpleAttribute = (FamixAttribute) aModel.getElement(aFactory.createAttribute("testPackage.Variables.a", null));
        assertEquals("Declared class of " + simpleAttribute.getUniqueName() + " must be int",
                simpleAttribute.getDeclaredClass(), classInt);
    }
View Full Code Here

TOP

Related Classes of org.evolizer.famix.model.entities.FamixClass

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.