CPD Results

The following document contains the results of PMD's CPD 5.0.2.

Duplications

File Line
org\andromda\metafacades\uml14\AssociationEndFacadeLogicImpl.java 174
org\andromda\metafacades\uml14\AttributeFacadeLogicImpl.java 189
    protected boolean handleIsMany()
    {
        boolean isMany = false;
        final Multiplicity multiplicity = this.metaObject.getMultiplicity();

        // we'll say a null multiplicity is 1
        if (multiplicity != null)
        {
            final Collection<MultiplicityRange> ranges = multiplicity.getRange();
            if (ranges != null && !ranges.isEmpty())
            {
                for (MultiplicityRange multiplicityRange : ranges)
                {
                    final int upper = multiplicityRange.getUpper();
                    isMany = upper > 1 || upper < 0;
                }
            }
        }
        if (null!=this.getType() && !isMany)
        {
            // isCollectionType causes too many problems with the metafacades
            isMany = this.getType().isArrayType();
        }
        return isMany;
    }
File Line
org\andromda\metafacades\uml14\ClassifierFacadeLogicImpl.java 591
org\andromda\metafacades\uml14\ClassifierFacadeLogicImpl.java 1013
            for (ClassifierFacade superClass = (ClassifierFacade)getGeneralization(); superClass != null && follow;
                 superClass = (ClassifierFacade)superClass.getGeneralization())
            {
                for (final AssociationEndFacade superAssociationEnd : superClass.getNavigableConnectingEnds())
                {
                    boolean present = false;
                    for (final Iterator<AssociationEndFacade> endIterator = this.getAssociationEnds().iterator(); endIterator.hasNext();)
                    {
                        final AssociationEndFacade associationEnd = endIterator.next();
                        if (associationEnd.getName().equals(superAssociationEnd.getName()))
                        {
                            present = true;
                            break;
                        }
                    }
                    if (!present)
                    {
File Line
org\andromda\metafacades\uml14\AssociationEndFacadeLogicImpl.java 344
org\andromda\metafacades\uml14\AttributeFacadeLogicImpl.java 493
                    this.isOrdered() ? mappings.getTo(UMLProfile.LIST_TYPE_NAME)
                                     : mappings.getTo(UMLProfile.COLLECTION_TYPE_NAME);
            }

            // set this association end's type as a template parameter if required
            if (BooleanUtils.toBoolean(
                    ObjectUtils.toString(this.getConfiguredProperty(UMLMetafacadeProperties.ENABLE_TEMPLATING)))
                    && this.getType() != null)
            {
                String type = this.getType().getFullyQualifiedName();
                /*Collection<GeneralizableElementFacade> specializations = this.getType().getAllSpecializations();
                if ((specializations != null && !specializations.isEmpty()))
                {
                    name += "<? extends " + type + '>';
                }
                else
                {*/
                    name += '<' + type + '>';
                //}
            }
        }
        if (name == null && this.getType() != null)
        {
            name = this.getType().getFullyQualifiedName();
        }
        return name;
    }

    /**
     * @see org.andromda.metafacades.uml.AssociationEndFacade#isRequired()
     */
    @Override
    protected boolean handleIsRequired()
File Line
org\andromda\metafacades\uml14\AttributeFacadeLogicImpl.java 82
org\andromda\metafacades\uml14\ParameterFacadeLogicImpl.java 121
        if (StringUtils.isNotBlank(defaultValue) && !this.isMany() && this.metaObject.getType() != null && defaultValue != null)
        {
            String typeName = this.metaObject.getType().getName();
            if ("String".equals(typeName) && defaultValue.indexOf('"')<0)
            {
                defaultValue = '"' + defaultValue + '"';
            }
            else if (("char".equals(typeName) || "Character".equals(typeName))
                && defaultValue.indexOf('\'')<0)
            {
                defaultValue = "'" + defaultValue.charAt(0) + '\'';
            }
        }
        if (defaultValue==null) defaultValue="";
        return defaultValue;
    }

    /**
     * @see org.andromda.metafacades.uml.AttributeFacade#isChangeable()
     */
    @Override
    public boolean handleIsChangeable()