Skip to content

Commit 7289a45

Browse files
committed
Revert copy factory method to copy constructor.
1 parent 6928169 commit 7289a45

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

jflex/src/main/java/jflex/IntCharSet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void add(Interval interval) {
117117
if (elem.contains(interval)) return;
118118

119119
if (elem.start > interval.end + 1) {
120-
intervals.add(i, Interval.copyOf(interval));
120+
intervals.add(i, new Interval(interval));
121121
return;
122122
}
123123

@@ -142,7 +142,7 @@ public void add(Interval interval) {
142142
return;
143143
}
144144

145-
intervals.add(Interval.copyOf(interval));
145+
intervals.add(new Interval(interval));
146146
}
147147

148148
/**

jflex/src/main/java/jflex/Interval.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ public Interval(int start, int end) {
3434
this.end = end;
3535
}
3636

37-
public static Interval copyOf(Interval other) {
38-
return new Interval(other.start, other.end);
37+
public Interval(Interval other) {
38+
this.start = other.start;
39+
this.end = other.end;
3940
}
4041

4142
/**

0 commit comments

Comments
 (0)