Skip to content

Commit 79fee94

Browse files
committed
Add a copy constructor for VariableStrings, switch out the usage of Generics. Will need to condense this into one class with the tregex version
1 parent ebdac38 commit 79fee94

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/edu/stanford/nlp/semgraph/semgrex/VariableStrings.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package edu.stanford.nlp.semgraph.semgrex;
22

33
import edu.stanford.nlp.stats.IntCounter;
4-
import edu.stanford.nlp.util.Generics;
54

5+
import java.util.HashMap;
66
import java.util.Map;
77

88
/** a class that takes care of the stuff necessary for variable strings.
@@ -12,14 +12,19 @@
1212
* @author Roger Levy (rog@nlp.stanford.edu)
1313
*/
1414
class VariableStrings {
15-
private Map<Object, String> varsToStrings;
16-
private IntCounter<Object> numVarsSet;
15+
private final Map<Object, String> varsToStrings;
16+
private final IntCounter<Object> numVarsSet;
1717

1818
public VariableStrings() {
19-
varsToStrings = Generics.newHashMap();
19+
varsToStrings = new HashMap<>();
2020
numVarsSet = new IntCounter<>();
2121
}
2222

23+
public VariableStrings(VariableStrings other) {
24+
varsToStrings = new HashMap<>(other.varsToStrings);
25+
numVarsSet = new IntCounter<>(other.numVarsSet);
26+
}
27+
2328
public boolean isSet(Object o) {
2429
return numVarsSet.getCount(o) == 1;
2530
}

0 commit comments

Comments
 (0)