CPD Results

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

Duplications

File Line
jp\sourceforge\stigmata\ui\swing\BirthmarkSelectionCheckSetPane.java 37
jp\sourceforge\stigmata\ui\swing\BirthmarkSelectionListPane.java 58
        list.setVisibleRowCount(5);
        JButton checkAll = GUIUtility.createButton(getMessages(), "checkall");
        JButton uncheckAll = GUIUtility.createButton(getMessages(), "uncheckall");

        Box box = Box.createHorizontalBox();
        box.add(Box.createHorizontalGlue());
        box.add(checkAll);
        box.add(Box.createHorizontalGlue());        
        box.add(uncheckAll);
        box.add(Box.createHorizontalGlue());
        add(box, BorderLayout.SOUTH);

        ActionListener listener = new ActionListener(){
            public void actionPerformed(ActionEvent e){
                boolean flag = e.getActionCommand().equals("checkall");
                for(Iterator<BirthmarkSelection> i = birthmarkSelections(); i.hasNext(); ){
                    BirthmarkSelection le = i.next();
                    le.setSelected(flag);
                    fireEvent();
                }

File Line
jp\sourceforge\stigmata\ui\swing\filter\BirthmarkElementCountComparisonPairFilterComponentService.java 75
jp\sourceforge\stigmata\ui\swing\filter\TotalElementCountComparisonPairFilterComponentService.java 50
            initLayouts();
        }

        @Override
        public String[] getErrors(){
            List<String> errors = new ArrayList<String>();
            if(threshold.getText().trim().equals("")){
                errors.add(getMessages().get("error.empty.threshold"));
            }
            try{
                int v = Integer.parseInt(threshold.getText());
                if(v < 0){
                    errors.add(getMessages().format("error.negative.value", v));
                }
            } catch(NumberFormatException e){
                errors.add(getMessages().format("error.invalid.format.integer", threshold.getText()));
            }
            return errors.toArray(new String[errors.size()]);
        }

        @Override
        public ComparisonPairFilter getFilter(){
            try{

File Line
jp\sourceforge\stigmata\filter\BirthmarkElementCountComparisonPairFilter.java 133
jp\sourceforge\stigmata\filter\TotalElementCountComparisonPairFilter.java 122
        }
        return flag;
    }

    public int getThreshold(){
        return threshold;
    }

    public void setThreshold(int threshold){
        if(threshold < 0){
            throw new IllegalArgumentException("threshold must be positive value: " + threshold);
        }
        this.threshold = threshold;
    }

    public FilterTarget getTarget(){
        return target;
    }

    public void setTarget(FilterTarget target){
        this.target = target;
    }

    public String toString(){
        StringBuilder sb = new StringBuilder();
        switch(getTarget()){
        case TARGET_1:       sb.append("target1"); break;
        case TARGET_2:       sb.append("target2"); break;
        case BOTH_TARGETS:   sb.append("(target1&target2)"); break;
        case ONE_OF_TARGETS: sb.append("(target1|target2)"); break;