Examples of FamixClass


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

    private void compareByCallReceiverTypeSubtyping(Set<FamixMethod> potentialMethodDeclarations) {
        fMatchesByCallReceiverTypeSubtyping = new HashSet<FamixMethod>();

        // init inheritance hierarchy of resolved receiver object/class
        FamixClass receiverClass = (FamixClass) getModel().getElement(getFactory().createClass(getResolvedID(), null));
        List<FamixClass> superTypes = new LinkedList<FamixClass>();
        if (receiverClass != null) {
            List<FamixClass> subTypes = new LinkedList<FamixClass>();
            subTypes.add(receiverClass);
            superTypes = computeSuperTypes(subTypes);
View Full Code Here

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

        if (getMethodBinding() == null) {
            lMethodID.append(AbstractASTNodeHandler.UNDEFINED_BINDING);
            sLogger.warn("FamixMethod binding is null");
        } else {
            ITypeBinding lTypeBinding = getMethodBinding().getDeclaringClass();
            FamixClass lDeclaringClass = getClass(lTypeBinding, null, lTypeBinding.isAnonymous());

            lMethodID.append(lDeclaringClass.getUniqueName());
            lMethodID.append(AbstractFamixEntity.NAME_DELIMITER);
            if (getMethodBinding().isConstructor()) {
                lMethodID.append(AbstractFamixEntity.CONSTRUCTOR_PREFIX);
            } else {
                lMethodID.append(getMethodBinding().getName());
View Full Code Here

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

            }
        }

        // add the corresponding constructor to the anonymous class (only for anonymous classes)
        if ((getASTNode().getAnonymousClassDeclaration() != null) && (lConstructor != null)) {
            FamixClass lDeclaringClass = getClass(getASTNode().getAnonymousClassDeclaration().resolveBinding(), null, true);
            lDeclaringClass = (FamixClass) getModel().addElement(lDeclaringClass);
            if (lDeclaringClass.getParent() != null) {
                sLogger.warn("Warn - anoym class " + lDeclaringClass.getUniqueName() + " already has a parent: "
                        + lDeclaringClass.getParent().getUniqueName());
            }

            lDeclaringClass.getMethods().add(lConstructor);
            lConstructor.setParent(lDeclaringClass);
        }

        return lConstructor;
    }
View Full Code Here

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

     * {@inheritDoc}
     */
    @Override
    protected double calculate() {
        double value = 0d;
        FamixClass famixClass = (FamixClass) getCurrentEntity();
        SnapshotAnalyzer snapshotAnalyzer = new SnapshotAnalyzer(getCurrentSession());
        List<FamixClass> entities = new ArrayList<FamixClass>();
        entities.add(famixClass);
        Set<FamixClass> dependentEntities = new HashSet<FamixClass>();
        value = snapshotAnalyzer.queryDependentEntities(
View Full Code Here

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

     * TODO: Check this metric
     */
    @Override
    protected double calculate() {
        double value = 0d;
        FamixClass famixClass = (FamixClass) getCurrentEntity();
        SnapshotAnalyzer snapshotAnalyzer = new SnapshotAnalyzer(getCurrentSession());
        List<FamixClass> superClasses = querySuperClasses();

        List<FamixInvocation> invocations = snapshotAnalyzer.queryAssociationsOfEntities(
                famixClass.getMethods(),
                FamixInvocation.class,
                "from"
        );

        Set<String> superClassMethodNames = getMethodNames(superClasses);
        if (!superClassMethodNames.isEmpty()) {
            for (FamixMethod famixMethod : famixClass.getMethods()) {
                String famixMethodName = getMethodName(famixMethod.getUniqueName());
                if (superClassMethodNames.contains(famixMethodName)) {
                    for (FamixInvocation invocation : invocations) {
                        if (!famixMethod.equals(invocation.getTo())
                                && famixMethodName.equals(getMethodName(invocation.getTo().getUniqueName()))) {
View Full Code Here

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

            IVariableBinding lVariableBinding = getASTNode().resolveBinding();
            ITypeBinding lTypeBinding = null;
            if (lVariableBinding != null) {
                lTypeBinding = lVariableBinding.getType();
            }
            FamixClass lDataType = getClass(lTypeBinding, getASTNode().getType(), false);
            lDataType = (FamixClass) getModel().addElement(lDataType);
            setDataType(lDataType);
        }
    }
View Full Code Here

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

    public Class<?>[] getCompatibleTypes() {
        return new Class<?>[] { org.evolizer.famix.model.entities.FamixClass.class };
    }
   
    protected List<FamixClass> querySuperClasses() {
        FamixClass famixClass = (FamixClass) getCurrentEntity();
        SnapshotAnalyzer snapshotAnalyzer = new SnapshotAnalyzer(getCurrentSession());
        List<FamixClass> entities = new ArrayList<FamixClass>();
        entities.add(famixClass);
        Set<FamixClass> dependentEntities = new HashSet<FamixClass>();
        snapshotAnalyzer.queryDependentEntities(
View Full Code Here

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

       
        setASTNode(castExpression);
        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) {
View Full Code Here

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

     * {@inheritDoc}
     */
    @Override
    protected double calculate() {
        double value = 0d;
        FamixClass famixClass = (FamixClass) getCurrentEntity();
        List<FamixClass> superClasses = querySuperClasses();
       
        Set<String> superClassMethodNames = getMethodNames(superClasses);
        if (!superClassMethodNames.isEmpty()) {
            for (FamixMethod famixMethod : famixClass.getMethods()) {
                if (superClassMethodNames.contains(getMethodName(famixMethod.getUniqueName()))) {
                    value++;
                }
            }
        }
View Full Code Here

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

    aModel = aDAOModel.loadModel(createdModel.getName());
  }
 
  @Test
  public void testUnresolvedInheritance(){
    FamixClass clazz = (FamixClass)aModel.getElement(aFactory.createClass("testPackage.Test",null));
    assertNotNull(clazz);
    FamixClass superClass = (FamixClass) aModel.getElement(aFactory.createClass("<undef>.SomeClass",null));
    assertNotNull(superClass);
   
    Set<FamixAssociation> lRelations = aModel.getAssociations(superClass);
    assertTrue("FamixClass " + superClass.getUniqueName() + " must contain relationships", lRelations.size() > 0);
    int containsInheritsTo = TestHelper.containsRelationTo(superClass, lRelations);
    assertTrue("Missing inheritance relationship in base class" + clazz.getUniqueName() + " to " + superClass.getUniqueName(), containsInheritsTo > 0);
   
    lRelations = aModel.getAssociations(clazz);
    assertTrue("FamixClass " + clazz.getUniqueName() + " must contain relationships", lRelations.size() > 0);
    containsInheritsTo = TestHelper.containsRelationTo(superClass, lRelations);
    assertTrue("Missing inheritance relationship in sub class " + clazz.getUniqueName() + " to " + superClass.getUniqueName(), containsInheritsTo > 0);
  }
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.