private String from; private String to; private RegularExpression regularExpression; private Substitution substitution; private boolean initialized = false; private String flags = ""; private int options; private Regexp regexp; /** * the from attribute * @param from the regex string */ public void setPattern(String from) { this.from = from; } /** * the to attribute * @param to the replacement string */ public void setReplace(String to) { this.to = to; } /** * @param flags the regex flags */ public void setFlags(String flags) { this.flags = flags; } private void initialize() { if (initialized) { return; } options = convertRegexOptions(flags); if (from == null) { throw new BuildException("Missing pattern in replaceregex"); } regularExpression = new RegularExpression(); regularExpression.setPattern(from); regexp = regularExpression.getRegexp(getProject()); if (to == null) { to = ""; } substitution = new Substitution(); substitution.setExpression(to)
private String from; private String to; private RegularExpression regularExpression; private Substitution substitution; private boolean initialized = false; private String flags = ""; private int options; private Regexp regexp; /** * @param from the regex pattern */ public void setPattern(String from) { this.from = from; } /** * @param to the replacement string */ public void setReplace(String to) { this.to = to; } /** * @param flags the regex flags */ public void setFlags(String flags) { this.flags = flags; } private void initialize() { if (initialized) { return; } options = convertRegexOptions(flags); if (from == null) { throw new BuildException("Missing from in containsregex"); } regularExpression = new RegularExpression(); regularExpression.setPattern(from); regexp = regularExpression.getRegexp(getProject()); if (to == null) { return; } substitution = new Substitution(); substitution.setExpression(to)
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/filters/TokenFilter.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/filters/TokenFilter.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
private String             from;
1
private String             from;
2
        private String             to;
2
        private String             to;
3
        private RegularExpression  regularExpression;
3
        private RegularExpression  regularExpression;
4
        private Substitution       substitution;
4
        private Substitution       substitution;
5
        private boolean            initialized = false;
5
        private boolean            initialized = false;
6
        private String             flags = "";
6
        private String             flags = "";
7
        private int                options;
7
        private int                options;
8
        private Regexp             regexp;
8
        private Regexp             regexp;
9
        /**
9
        /**
10
         * the from attribute
11
         * @param from the regex string
10
         * @param from the regex pattern
12
         */
11
         */
13
        public void setPattern(String from) {
12
        public void setPattern(String from) {
14
            this.from = from;
13
            this.from = from;
15
        }
14
        }
16
        /**
15
        /**
17
         * the to attribute
18
         * @param to the replacement string
16
         * @param to the replacement string
19
         */
17
         */
20
        public void setReplace(String to) {
18
        public void setReplace(String to) {
21
            this.to = to;
19
            this.to = to;
22
        }
20
        }
23
        /**
21
        /**
24
         * @param flags the regex flags
22
         * @param flags the regex flags
25
         */
23
         */
26
        public void setFlags(String flags) {
24
        public void setFlags(String flags) {
27
            this.flags = flags;
25
            this.flags = flags;
28
        }
26
        }
29
        private void initialize() {
27
        private void initialize() {
30
            if (initialized) {
28
            if (initialized) {
31
                return;
29
                return;
32
            }
30
            }
33
            options = convertRegexOptions(flags);
31
            options = convertRegexOptions(flags);
34
            if (from == null) {
32
            if (from == null) {
35
                throw new BuildException("Missing pattern in replaceregex");
33
                throw new BuildException("Missing from in containsregex");
36
            }
34
            }
37
            regularExpression = new RegularExpression();
35
            regularExpression = new RegularExpression();
38
            regularExpression.setPattern(from);
36
            regularExpression.setPattern(from);
39
            regexp = regularExpression.getRegexp(getProject());
37
            regexp = regularExpression.getRegexp(getProject());
40
            if (to == null) {
38
            if (to == null) {
41
                to = "";
39
                return;
42
            }
40
            }
43
            substitution = new Substitution();
41
            substitution = new Substitution();
44
            substitution.setExpression(to)
42
            substitution.setExpression(to)
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0