int read() { // If we have buffered replace data, use it. if ((buffer != null) && (bufpos < buffer.length())) { return (int) buffer.charAt(bufpos++); } // check if input is at a valid position if (!stream.isValid()) return -1; REMatch mymatch = new REMatch(expr.getNumSubs(),offset,0); if (expr.match(stream,mymatch)) { mymatch.end[0] = mymatch.index; mymatch.finish(stream); stream.move(mymatch.toString().length()); offset += mymatch.toString().length(); buffer = mymatch.substituteInto(replace); bufpos = 1; if (buffer.length() > 0) { return buffer.charAt(0); } } char ch = stream.charAt(0); if (ch == CharIndexed.OUT_OF_BOUNDS) return -1; stream.move(1); offset++; return ch; } /** * Returns false. REFilterReader does not support mark() and * reset() methods. */ public boolean markSupported() { return false; }
int read() { // If we have buffered replace data, use it. if ((buffer != null) && (bufpos < buffer.length())) { return (int) buffer.charAt(bufpos++); } // check if input is at a valid position if (!stream.isValid()) return -1; REMatch mymatch = new REMatch(expr.getNumSubs(),offset,0); if (expr.match(stream, mymatch)) { mymatch.end[0] = mymatch.index; mymatch.finish(stream); stream.move(mymatch.toString().length()); offset += mymatch.toString().length(); buffer = mymatch.substituteInto(replace); bufpos = 1; // This is prone to infinite loops if replace string turns out empty. if (buffer.length() > 0) { return buffer.charAt(0); } } char ch = stream.charAt(0); if (ch == CharIndexed.OUT_OF_BOUNDS) return -1; stream.move(1); offset++; return ch; } /** * Returns false. REFilterInputStream does not support mark() and * reset() methods. */ public boolean markSupported() { return false; }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/gnu/regexp/REFilterReader.java File path: /jEdit-4.2/src/gnu/regexp/REFilterInputStream.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
int read() {
1
int read() {
2
    // If we have buffered replace data, use it.
2
    // If we have buffered replace data, use it.
3
    if ((buffer != null) && (bufpos < buffer.length())) {
3
    if ((buffer != null) && (bufpos < buffer.length())) {
4
      return (int) buffer.charAt(bufpos++);
4
      return (int) buffer.charAt(bufpos++);
5
    }
5
    }
6
    // check if input is at a valid position
6
    // check if input is at a valid position
7
    if (!stream.isValid()) return -1;
7
    if (!stream.isValid()) return -1;
8
    REMatch mymatch = new REMatch(expr.getNumSubs(),offset,0);
8
    REMatch mymatch = new REMatch(expr.getNumSubs(),offset,0);
9
    if (expr.match(stream,mymatch)) {
9
    if (expr.match(stream, mymatch)) {
10
      mymatch.end[0] = mymatch.index;
10
      mymatch.end[0] = mymatch.index;
11
      mymatch.finish(stream);
11
      mymatch.finish(stream);
12
      stream.move(mymatch.toString().length());
12
      stream.move(mymatch.toString().length());
13
      offset += mymatch.toString().length();
13
      offset += mymatch.toString().length();
14
      buffer = mymatch.substituteInto(replace);
14
      buffer = mymatch.substituteInto(replace);
15
      bufpos = 1;
15
      bufpos = 1;
16
      // This is prone to infinite loops if replace string turns out empty.
16
      if (buffer.length() > 0) {
17
      if (buffer.length() > 0) {
17
	  return buffer.charAt(0);
18
	  return buffer.charAt(0);
18
      }
19
      }
19
    }
20
    }
20
    char ch = stream.charAt(0);
21
    char ch = stream.charAt(0);
21
    if (ch == CharIndexed.OUT_OF_BOUNDS) return -1;
22
    if (ch == CharIndexed.OUT_OF_BOUNDS) return -1;
22
    stream.move(1);
23
    stream.move(1);
23
    offset++;
24
    offset++;
24
    return ch;
25
    return ch;
25
  }
26
  }
26
  /** 
27
  /** 
27
   * Returns false.  REFilterReader does not support mark() and
28
   * Returns false.  REFilterInputStream does not support mark() and
28
   * reset() methods. 
29
   * reset() methods. 
29
   */
30
   */
30
  public boolean markSupported() {
31
  public boolean markSupported() {
31
    return false;
32
    return false;
32
  }
33
  }
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