CPD Results

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

Duplications

FileLine
serp/bytecode/BCMember.java53
serp/bytecode/InnerClass.java53
    }

    /**
     * Manipulate the inner class access flags.
     */
    public boolean isPublic() {
        return (getAccessFlags() & Constants.ACCESS_PUBLIC) > 0;
    }

    /**
     * Manipulate the inner class access flags.
     */
    public void makePublic() {
        setAccessFlags(getAccessFlags() | Constants.ACCESS_PUBLIC);
        setAccessFlags(getAccessFlags() & ~Constants.ACCESS_PRIVATE);
        setAccessFlags(getAccessFlags() & ~Constants.ACCESS_PROTECTED);
    }

    /**
     * Manipulate the inner class access flags.
     */
    public boolean isProtected() {
        return (getAccessFlags() & Constants.ACCESS_PROTECTED) > 0;
    }

    /**
     * Manipulate the inner class access flags.
     */
    public void makeProtected() {
        setAccessFlags(getAccessFlags() & ~Constants.ACCESS_PUBLIC);
        setAccessFlags(getAccessFlags() & ~Constants.ACCESS_PRIVATE);
        setAccessFlags(getAccessFlags() | Constants.ACCESS_PROTECTED);
    }

    /**
     * Manipulate the inner class access flags.
     */
    public boolean isPrivate() {
        return (getAccessFlags() & Constants.ACCESS_PRIVATE) > 0;
    }

    /**
     * Manipulate the inner class access flags.
     */
    public void makePrivate() {
        setAccessFlags(getAccessFlags() & ~Constants.ACCESS_PUBLIC);
        setAccessFlags(getAccessFlags() | Constants.ACCESS_PRIVATE);
        setAccessFlags(getAccessFlags() & ~Constants.ACCESS_PROTECTED);
    }

    /**
     * Manipulate the inner class access flags.
     */
    public boolean isFinal() {

FileLine
serp/bytecode/BCClass.java413
serp/bytecode/InnerClass.java169
            setAccessFlags(getAccessFlags() & ~Constants.ACCESS_INTERFACE);
    }

    /**
     * Manipulate the inner class access flags.
     */
    public boolean isSynthetic() {
        return (getAccessFlags() & Constants.ACCESS_SYNTHETIC) > 0;
    }

    /**
     * Manipulate the inner class access flags.
     */
    public void setSynthetic(boolean on) {
        if (on)
            setAccessFlags(getAccessFlags() | Constants.ACCESS_SYNTHETIC);
        else
            setAccessFlags(getAccessFlags() & ~Constants.ACCESS_SYNTHETIC);
    }

    /**
     * Manipulate the inner class access flags.
     */
    public boolean isAnnotation() {
        return (getAccessFlags() & Constants.ACCESS_ANNOTATION) > 0;
    }

    /**
     * Manipulate the inner class access flags.  Setting to true also makes this
     * an interface.
     */
    public void setAnnotation(boolean on) {
        if (on) {
            setAccessFlags(getAccessFlags() | Constants.ACCESS_ANNOTATION);
            setAccessFlags(getAccessFlags() | Constants.ACCESS_INTERFACE);
        } else
            setAccessFlags(getAccessFlags() & ~Constants.ACCESS_ANNOTATION);
    }

    /**
     * Manipulate the inner class access flags.
     */
    public boolean isEnum() {
        return (getAccessFlags() & Constants.ACCESS_ENUM) > 0;
    }

    /**
     * Manipulate the inner class access flags.
     */
    public void setEnum(boolean on) {
        if (on)
            setAccessFlags(getAccessFlags() | Constants.ACCESS_ENUM);
        else
            setAccessFlags(getAccessFlags() & ~Constants.ACCESS_ENUM);
    }

    ////////////////////////////////
    // Name, type, owner operations
    ////////////////////////////////

    /**
     * Return the {@link ConstantPool} index of the {@link UTF8Entry} that
     * describes the simple name this class is referred to in source, or
     * 0 for anonymous classes.
     */
    public int getNameIndex() {

FileLine
serp/bytecode/LookupSwitchInstruction.java137
serp/bytecode/TableSwitchInstruction.java159
    private Instruction findTarget(int jumpByteIndex, List inss) {
        Instruction ins;
        for (Iterator itr = inss.iterator(); itr.hasNext();) {
            ins = (Instruction) itr.next();
            if (ins.getByteIndex() == jumpByteIndex)
                return ins;
        }
        return null;
    }

    public void updateTargets() {
        super.updateTargets();
        for (Iterator itr = _cases.iterator(); itr.hasNext();)
            ((InstructionPtrStrategy) itr.next()).updateTargets();
    }

    public void replaceTarget(Instruction oldTarget, Instruction newTarget) {
        super.replaceTarget(oldTarget, newTarget);
        for (Iterator itr = _cases.iterator(); itr.hasNext();)
            ((InstructionPtrStrategy) itr.next()).replaceTarget(oldTarget,
                newTarget);
    }

    public void acceptVisit(BCVisitor visit) {
        visit.enterTableSwitchInstruction(this);

FileLine
serp/bytecode/Annotation.java478
serp/bytecode/ConstantInstruction.java185
        return (String) getValue();
    }

    /**
     * Return the int value of this constant, or 0 if not set.
     */
    public int getIntValue() {
        Object value = getValue();
        return (value == null) ? 0 : ((Number) value).intValue();
    }

    /**
     * Return the long value of this constant, or 0 if not set.
     */
    public long getLongValue() {
        Object value = getValue();
        return (value == null) ? 0L : ((Number) value).longValue();
    }

    /**
     * Return the float value of this constant, or 0 if not set.
     */
    public float getFloatValue() {
        Object value = getValue();
        return (value == null) ? 0F : ((Number) value).floatValue();
    }

    /**
     * Return the double value of this constant, or 0 if not set.
     */
    public double getDoubleValue() {
        Object value = getValue();
        return (value == null) ? 0D : ((Number) value).doubleValue();
    }

    /**
     * Return the class value of this constant, or null if not set.
     */
    public String getClassNameValue() {

FileLine
serp/bytecode/ArrayState.java17
serp/bytecode/PrimitiveState.java19
    }

    public int getMagic() {
        return Constants.VALID_MAGIC;
    }

    public int getMajorVersion() {
        return Constants.MAJOR_VERSION;
    }

    public int getMinorVersion() {
        return Constants.MINOR_VERSION;
    }

    public int getAccessFlags() {
        return Constants.ACCESS_PUBLIC | Constants.ACCESS_FINAL;
    }

    public int getIndex() {
        return 0;
    }

    public int getSuperclassIndex() {
        return 0;
    }

    public List getInterfacesHolder() {
        return Collections.EMPTY_LIST;
    }

    public List getFieldsHolder() {
        return Collections.EMPTY_LIST;
    }

    public List getMethodsHolder() {
        return Collections.EMPTY_LIST;
    }

    public Collection getAttributesHolder() {
        return Collections.EMPTY_LIST;
    }

    public String getName() {
        return _names.getExternalForm(_type.getName(), false);

FileLine
serp/bytecode/MethodInstruction.java232
serp/bytecode/MethodInstruction.java276
        BCClass returnType, BCClass[] params) {
        String decName = (dec == null) ? null : dec.getName();
        String returnName = (returnType == null) ? null : returnType.getName();
        String[] paramNames = null;
        if (params != null) {
            paramNames = new String[params.length];
            for (int i = 0; i < params.length; i++)
                paramNames[i] = params[i].getName();
        }
        return setMethod(decName, name, returnName, paramNames, false);
    }

    /**
     * Set the method this instruction operates on, for methods that are
     * declared by the current class.
     *
     * @param name the method name
     * @param returnType the class of the method return type
     * @param param the class of the method param types
     * @return this instruction, for method chaining
     */
    public MethodInstruction setMethod(String name, BCClass returnType,

FileLine
serp/bytecode/MethodInstruction.java254
serp/bytecode/MethodInstruction.java298
        BCClass[] params) {
        BCClass owner = getCode().getMethod().getDeclarer();
        String returnName = (returnType == null) ? null : returnType.getName();
        String[] paramNames = null;
        if (params != null) {
            paramNames = new String[params.length];
            for (int i = 0; i < params.length; i++)
                paramNames[i] = params[i].getName();
        }
        return setMethod(owner.getName(), name, returnName, paramNames, false);
    }

    /////////////////////////////////////////
    // Name, Return, Param, Owner operations
    /////////////////////////////////////////

    /**
     * Return the name of the method this instruction operates on, or null
     * if not set.
     */
    public String getMethodName() {

FileLine
serp/bytecode/BCClass.java378
serp/bytecode/InnerClass.java134
            setAccessFlags(getAccessFlags() & ~Constants.ACCESS_STATIC);
    }

    /**
     * Manipulate the class access flags.
     */
    public boolean isInterface() {
        return (getAccessFlags() & Constants.ACCESS_INTERFACE) > 0;
    }

    /**
     * Manipulate the class access flags.
     */
    public void setInterface(boolean on) {
        if (on) {
            setAccessFlags(getAccessFlags() | Constants.ACCESS_INTERFACE);
            setAbstract(true);
        } else
            setAccessFlags(getAccessFlags() & ~Constants.ACCESS_INTERFACE);
    }

    /**
     * Manipulate the class access flags.
     */
    public boolean isAbstract() {
        return (getAccessFlags() & Constants.ACCESS_ABSTRACT) > 0;
    }

    /**
     * Manipulate the class access flags.
     */
    public void setAbstract(boolean on) {
        if (on)
            setAccessFlags(getAccessFlags() | Constants.ACCESS_INTERFACE);

FileLine
serp/bytecode/InnerClass.java222
serp/bytecode/Local.java161
            setEnd(newTarget);
    }

    /////////////////////////
    // Name, Type operations
    /////////////////////////

    /**
     * Return the {@link ConstantPool} index of the {@link UTF8Entry} that
     * describes the name of this local. Defaults to 0.
     */
    public int getNameIndex() {
        return _nameIndex;
    }

    /**
     * Set the {@link ConstantPool} index of the {@link UTF8Entry} that
     * describes the name of this local.
     */
    public void setNameIndex(int nameIndex) {
        _nameIndex = nameIndex;
    }

    /**
     * Return the name of this local, or null if unset.
     */
    public String getName() {
        if (getNameIndex() == 0)
            return null;
        return ((UTF8Entry) getPool().getEntry(getNameIndex())).getValue();
    }

    /**
     * Set the name of this inner local.
     */
    public void setName(String name) {
        if (name == null)
            setNameIndex(0);
        else
            setNameIndex(getPool().findUTF8Entry(name, true));
    }

    /**
     * Return the {@link ConstantPool} index of the {@link UTF8Entry} that
     * describes this local. Defaults to 0.
     */
    public int getTypeIndex() {
        return _descriptorIndex;