/** * @param ps the design material * @return the offenders */ protected ListSet computeOffenders(Object ps) { ListSet offs = new ListSet(ps); Object cs = Model.getFacade().getContainer(ps); if (cs == null) { LOG.debug("null parent in still valid"); return offs; } Collection peers = Model.getFacade().getSubvertices(cs); for (Iterator iter = peers.iterator(); iter.hasNext();) { Object sv = iter.next(); if (Model.getFacade().isAPseudostate(sv) && Model.getFacade().equalsPseudostateKind( Model.getFacade().getKind(sv), Model.getPseudostateKind().getDeepHistory())) { offs.add(sv); } } return offs; }
/** * @param ps the design material * @return the offenders */ protected ListSet computeOffenders(Object ps) { ListSet offs = new ListSet(ps); Object cs = Model.getFacade().getContainer(ps); if (cs == null) { LOG.debug("null parent in still valid"); return offs; } Collection peers = Model.getFacade().getSubvertices(cs); for (Object sv : peers) { if (Model.getFacade().isAPseudostate(sv) && Model.getFacade().equalsPseudostateKind( Model.getFacade().getKind(sv), Model.getPseudostateKind().getShallowHistory())) { offs.add(sv); } } return offs; }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/cognitive/critics/CrMultipleDeepHistoryStates.java File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/cognitive/critics/CrMultipleShallowHistoryStates.java
Method name: ListSet computeOffenders(Object) Method name: ListSet computeOffenders(Object)
Number of AST nodes: 4 Number of AST nodes: 3
1
/**
1
/**
2
     * @param ps the design material
2
     * @param ps the design material
3
     * @return the offenders
3
     * @return the offenders
4
     */
4
     */
5
    protected ListSet computeOffenders(Object ps) {
5
    protected ListSet computeOffenders(Object ps) {
6
        ListSet offs = new ListSet(ps);
6
        ListSet offs = new ListSet(ps);
7
        Object cs = Model.getFacade().getContainer(ps);
7
        Object cs = Model.getFacade().getContainer(ps);
8
        if (cs == null) {
8
        if (cs == null) {
9
            LOG.debug("null parent in still valid");
9
            LOG.debug("null parent in still valid");
10
            return offs;
10
            return offs;
11
        }
11
        }
12
        Collection peers = Model.getFacade().getSubvertices(cs);
12
        Collection peers = Model.getFacade().getSubvertices(cs);
13
        for (Iterator iter = peers.iterator(); iter.hasNext();) {
13
        for (Object sv : peers) {
14
            Object sv = iter.next();
14
            if (Model.getFacade().isAPseudostate(sv)
15
            if (Model.getFacade().isAPseudostate(sv)
15
                    && Model.getFacade().equalsPseudostateKind(
16
                    && Model.getFacade().equalsPseudostateKind(
16
                            Model.getFacade().getKind(sv),
17
                            Model.getFacade().getKind(sv),
17
                            Model.getPseudostateKind().getShallowHistory())) {
18
                            Model.getPseudostateKind().getDeepHistory())) {
18
                offs.add(sv);
19
                offs.add(sv);
19
            }
20
            }
20
        }
21
        }
21
        return offs;
22
        return offs;
22
    }
23
    }
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Similarity Score0.818
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    7
    for (Iterator iter = peers.iterator(); iter.hasNext(); )
    7
    for (Object sv : peers)
    8
    Object sv = iter.next();
                                                      
    9
    if (Model.getFacade().isAPseudostate(sv) && Model.getFacade().equalsPseudostateKind(Model.getFacade().getKind(sv), Model.getPseudostateKind().getDeepHistory()))
    9
    if (Model.getFacade().isAPseudostate(sv) && Model.getFacade().equalsPseudostateKind(Model.getFacade().getKind(sv), Model.getPseudostateKind().getDeepHistory()))
    8
    if (Model.getFacade().isAPseudostate(sv) && Model.getFacade().equalsPseudostateKind(Model.getFacade().getKind(sv), Model.getPseudostateKind().getShallowHistory()))
    Differences
    Expression1Expression2Difference
    getDeepHistorygetShallowHistoryMETHOD_INVOCATION_NAME_MISMATCH
    8
    if (Model.getFacade().isAPseudostate(sv) && Model.getFacade().equalsPseudostateKind(Model.getFacade().getKind(sv), Model.getPseudostateKind().getShallowHistory()))
    10
    offs.add(sv);
    9
    offs.add(sv);
    Precondition Violations (0)
    Row Violation