@Override public boolean predicate2(Object dm, Designer dsgr) { if (!(Model.getFacade().isAPseudostate(dm))) { return NO_PROBLEM; } Object k = Model.getFacade().getKind(dm); if (!Model.getFacade().equalsPseudostateKind( k, Model.getPseudostateKind().getInitial())) { return NO_PROBLEM; } // container state / composite state Object cs = Model.getFacade().getContainer(dm); if (cs == null) { LOG.debug("null parent state"); return NO_PROBLEM; } int initialStateCount = 0; Collection peers = Model.getFacade().getSubvertices(cs); for (Object sv : peers) { if (Model.getFacade().isAPseudostate(sv) && Model.getFacade(). equalsPseudostateKind( Model.getFacade().getKind(sv), Model.getPseudostateKind().getInitial())) { initialStateCount++; } } if (initialStateCount > 1) { return PROBLEM_FOUND; } return NO_PROBLEM; }
@Override public boolean predicate2(Object dm, Designer dsgr) { if (!(Model.getFacade().isAPseudostate(dm))) { return NO_PROBLEM; } Object k = Model.getFacade().getKind(dm); if (!Model.getFacade().equalsPseudostateKind(k, Model.getPseudostateKind().getDeepHistory())) { return NO_PROBLEM; } // container state / composite state Object cs = Model.getFacade().getContainer(dm); if (cs == null) { LOG.debug("null parent state"); return NO_PROBLEM; } Collection peers = Model.getFacade().getSubvertices(cs); int initialStateCount = 0; 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())) { initialStateCount++; } } if (initialStateCount > 1) { return PROBLEM_FOUND; } return NO_PROBLEM; }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/cognitive/critics/CrMultipleInitialStates.java File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/cognitive/critics/CrMultipleDeepHistoryStates.java
Method name: boolean predicate2(Object, Designer) Method name: boolean predicate2(Object, Designer)
Number of AST nodes: 3 Number of AST nodes: 4
1
@Override
1
@Override
2
    public boolean predicate2(Object dm, Designer dsgr) {
2
    public boolean predicate2(Object dm, Designer dsgr) {
3
        if (!(Model.getFacade().isAPseudostate(dm))) {
3
        if (!(Model.getFacade().isAPseudostate(dm))) {
4
            return NO_PROBLEM;
4
            return NO_PROBLEM;
5
        }
5
        }
6
        Object k = Model.getFacade().getKind(dm);
6
        Object k = Model.getFacade().getKind(dm);
7
        if (!Model.getFacade().equalsPseudostateKind(
7
        if (!Model.getFacade().equalsPseudostateKind(k,
8
                k,
8
                Model.getPseudostateKind().getDeepHistory())) {
9
                Model.getPseudostateKind().getInitial())) {
9
            return NO_PROBLEM;
10
	    return NO_PROBLEM;
10
        }
11
        }
11
12
12
        // container state / composite state
13
        // container state / composite state
13
        Object cs = Model.getFacade().getContainer(dm);
14
        Object cs = Model.getFacade().getContainer(dm);
14
        if (cs == null) {
15
        if (cs == null) {
15
            LOG.debug("null parent state");
16
            LOG.debug("null parent state");
16
            return NO_PROBLEM;
17
            return NO_PROBLEM;
17
        }
18
        }
18
        Collection peers = Model.getFacade().getSubvertices(cs);
19
        
19
        int initialStateCount = 0;
20
        int initialStateCount = 0;
20
        for (Iterator iter = peers.iterator(); iter.hasNext();) {
21
        Collection peers = Model.getFacade().getSubvertices(cs);
21
            Object sv = iter.next();
22
        for (Object sv : peers) {
22
            if (Model.getFacade().isAPseudostate(sv)
23
            if (Model.getFacade().isAPseudostate(sv)
23
                    && Model.getFacade().equalsPseudostateKind(
24
                && Model.getFacade().
24
                            Model.getFacade().getKind(sv),
25
                	equalsPseudostateKind(
25
                            Model.getPseudostateKind().getDeepHistory())) {
26
                	        Model.getFacade().getKind(sv),
26
                initialStateCount++;
27
                	        Model.getPseudostateKind().getInitial())) {
27
            }
28
                initialStateCount++;
28
        }
29
            }
29
        if (initialStateCount > 1) {
30
        }
30
            return PROBLEM_FOUND;
31
        if (initialStateCount > 1) {
31
        }
32
            return PROBLEM_FOUND;
32
        return NO_PROBLEM;
33
        }
33
    }
34
        return NO_PROBLEM;
35
    }
  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.800
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    12
    for (Object sv : peers)
    12
    for (Iterator iter = peers.iterator(); iter.hasNext(); )
                                                        
    13
    Object sv = iter.next();
    13
    if (Model.getFacade().isAPseudostate(sv) && Model.getFacade().equalsPseudostateKind(Model.getFacade().getKind(sv), Model.getPseudostateKind().getInitial()))
    13
    if (Model.getFacade().isAPseudostate(sv) && Model.getFacade().equalsPseudostateKind(Model.getFacade().getKind(sv), Model.getPseudostateKind().getInitial()))
    14
    if (Model.getFacade().isAPseudostate(sv) && Model.getFacade().equalsPseudostateKind(Model.getFacade().getKind(sv), Model.getPseudostateKind().getDeepHistory()))
    Differences
    Expression1Expression2Difference
    getInitialgetDeepHistoryMETHOD_INVOCATION_NAME_MISMATCH
    14
    if (Model.getFacade().isAPseudostate(sv) && Model.getFacade().equalsPseudostateKind(Model.getFacade().getKind(sv), Model.getPseudostateKind().getDeepHistory()))
    14
    initialStateCount++;
    15
    initialStateCount++;
    Precondition Violations (0)
    Row Violation