Skip to content

Commit

Permalink
Drop numRegs field
Browse files Browse the repository at this point in the history
It's equivalent to begEnd.length / 2.
  • Loading branch information
headius committed May 23, 2023
1 parent 44204ac commit d1afcaf
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/org/joni/MultiRegion.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,22 @@
import java.util.Arrays;

public final class MultiRegion extends Region {
private final int numRegs;
private final int[] begEnd;

public MultiRegion(int num) {
this.numRegs = num;
this.begEnd = new int[num * 2];
}

public MultiRegion(int begin, int end) {
this.numRegs = 1;
this.begEnd = new int[]{begin, end};
}

public final int getNumRegs() {
return numRegs;
return begEnd.length / 2;
}

public MultiRegion clone() {
MultiRegion region = new MultiRegion(numRegs);
MultiRegion region = new MultiRegion(getNumRegs());
System.arraycopy(begEnd, 0, region.begEnd, 0, begEnd.length);
if (getCaptureTree() != null) region.setCaptureTree(getCaptureTree().cloneTree());
return region;
Expand Down

0 comments on commit d1afcaf

Please sign in to comment.