Skip to content

Commit 298df01

Browse files
committed
Turn isLink final
1 parent 4f15b08 commit 298df01

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class NodePattern extends SemgrexPattern {
3333
*/
3434
private final Map<String, Pair<Object, Object>> attributes;
3535
private final boolean isRoot;
36-
private boolean isLink;
36+
private final boolean isLink;
3737
private final boolean isEmpty;
3838
private final String name;
3939
private String descString;
@@ -44,18 +44,19 @@ public class NodePattern extends SemgrexPattern {
4444

4545
public NodePattern(GraphRelation r, boolean negDesc,
4646
Map<String, String> attrs,
47-
boolean root, boolean empty, String name) {
48-
this(r, negDesc, attrs, root, empty, name,
47+
boolean root, boolean empty, boolean isLink, String name) {
48+
this(r, negDesc, attrs, root, empty, isLink, name,
4949
new ArrayList<>(0));
5050
}
5151

5252
// TODO: there is no capacity for named variable groups in the parser right now
5353
public NodePattern(GraphRelation r, boolean negDesc,
5454
Map<String, String> attrs,
55-
boolean root, boolean empty, String name,
55+
boolean root, boolean empty, boolean isLink, String name,
5656
List<Pair<Integer, String>> variableGroups) {
5757
this.reln = r;
5858
this.negDesc = negDesc;
59+
this.isLink = isLink;
5960
// order the attributes so that the pattern stays the same when
6061
// printing a compiled pattern
6162
attributes = new LinkedHashMap<>();
@@ -193,10 +194,6 @@ public boolean nodeAttrMatch(IndexedWord node, final SemanticGraph sg, boolean i
193194
return !negDesc;
194195
}
195196

196-
public void makeLink() {
197-
isLink = true;
198-
}
199-
200197
public boolean isRoot() {
201198
return isRoot;
202199
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,7 @@ final public SemgrexPattern Root() throws ParseException {// Root pattern for th
615615
jj_la1[27] = jj_gen;
616616
;
617617
}
618-
pat = new NodePattern(r, underNodeNegation, attributes.attributes(), attributes.root(), attributes.empty(), name != null ? name.image : null);
619-
if (link) pat.makeLink();
618+
pat = new NodePattern(r, underNodeNegation, attributes.attributes(), attributes.root(), attributes.empty(), link, name != null ? name.image : null);
620619
{if ("" != null) return pat;}
621620
throw new Error("Missing return statement in function");
622621
}

src/edu/stanford/nlp/semgraph/semgrex/SemgrexParser.jj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,7 @@ NodePattern Description(GraphRelation r) : {
304304
}
305305
)?
306306
)
307-
{ pat = new NodePattern(r, underNodeNegation, attributes.attributes(), attributes.root(), attributes.empty(), name != null ? name.image : null);
308-
if (link) pat.makeLink();
307+
{ pat = new NodePattern(r, underNodeNegation, attributes.attributes(), attributes.root(), attributes.empty(), link, name != null ? name.image : null);
309308
return pat;
310309
}
311310
}

0 commit comments

Comments
 (0)