CPD Results

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

Duplications

FileLine
org/andromda/metafacades/uml14/AssociationEndFacadeLogicImpl.java297
org/andromda/metafacades/uml14/AttributeFacadeLogicImpl.java187
        final Multiplicity multiplicity = metaObject.getMultiplicity();
        if (multiplicity != null)
        {
            final Collection ranges = multiplicity.getRange();
            if (ranges != null && !ranges.isEmpty())
            {
                final Iterator rangeIt = ranges.iterator();
                while (rangeIt.hasNext())
                {
                    final MultiplicityRange multiplicityRange = (MultiplicityRange)rangeIt.next();
                    lower = new Integer(multiplicityRange.getLower());
                }
            }
        }
        if (lower == null)
        {
            final String defaultMultiplicity = this.getDefaultMultiplicity();
            if (defaultMultiplicity.startsWith("0"))
            {
                lower = new Integer(0);
            }
            else
            {
                lower = new Integer(1);
            }
        }
        return lower.intValue();
    }

    /**
     * Gets the default multiplicity for this attribute (the
     * multiplicity if none is defined).
     *
     * @return the defautl multiplicity as a String.
     */
    private String getDefaultMultiplicity()
    {
        return ObjectUtils.toString(this.getConfiguredProperty(UMLMetafacadeProperties.DEFAULT_MULTIPLICITY));
    }

    /**
     * @see org.andromda.metafacades.uml.AttributeFacade#getEnumeration()
     */
    protected Object handleGetEnumeration()

FileLine
org/andromda/metafacades/uml14/ClassifierFacadeLogicImpl.java444
org/andromda/metafacades/uml14/ClassifierFacadeLogicImpl.java868
        for (ClassifierFacade superClass = (ClassifierFacade)getGeneralization(); superClass != null && follow;
             superClass = (ClassifierFacade)superClass.getGeneralization())
        {
            for (final Iterator iterator = superClass.getNavigableConnectingEnds().iterator(); iterator.hasNext();)
            {
                final AssociationEndFacade superAssociationEnd = (AssociationEndFacade)iterator.next();
                boolean present = false;
                for (final Iterator endIterator = this.getAssociationEnds().iterator(); endIterator.hasNext();)
                {
                    final AssociationEndFacade associationEnd = (AssociationEndFacade)endIterator.next();
                    if (associationEnd.getName().equals(superAssociationEnd.getName()))
                    {
                        present = true;
                        break;
                    }
                }
                if (!present)
                {

FileLine
org/andromda/metafacades/uml14/AssociationEndFacadeLogicImpl.java145
org/andromda/metafacades/uml14/AttributeFacadeLogicImpl.java156
    public boolean handleIsMany()
    {
        boolean isMany = false;
        final Multiplicity multiplicity = this.metaObject.getMultiplicity();

        // assume no multiplicity is 1
        if (multiplicity != null)
        {
            final Collection ranges = multiplicity.getRange();
            if (ranges != null && !ranges.isEmpty())
            {
                final Iterator rangeIt = ranges.iterator();
                while (rangeIt.hasNext())
                {
                    final MultiplicityRange multiplicityRange = (MultiplicityRange)rangeIt.next();
                    final int upper = multiplicityRange.getUpper();
                    isMany = upper > 1 || upper < 0;
                }
            }
        }
        return isMany;
    }