@@ -43,25 +43,23 @@ public class NodePattern extends SemgrexPattern {
43
43
private List <Pair <Integer , String >> variableGroups ;
44
44
45
45
public NodePattern (GraphRelation r , boolean negDesc ,
46
- List <Triple <String , String , Boolean >> attrs ,
47
- boolean root , boolean empty , boolean isLink , String name ) {
48
- this (r , negDesc , attrs , root , empty , isLink , name ,
46
+ NodeAttributes attrs , boolean isLink , String name ) {
47
+ this (r , negDesc , attrs , isLink , name ,
49
48
new ArrayList <>(0 ));
50
49
}
51
50
52
51
// TODO: there is no capacity for named variable groups in the parser right now
53
52
public NodePattern (GraphRelation r , boolean negDesc ,
54
- List <Triple <String , String , Boolean >> attrs ,
55
- boolean root , boolean empty , boolean isLink , String name ,
53
+ NodeAttributes attrs , boolean isLink , String name ,
56
54
List <Pair <Integer , String >> variableGroups ) {
57
55
this .reln = r ;
58
56
this .negDesc = negDesc ;
59
57
this .isLink = isLink ;
60
58
// order the attributes so that the pattern stays the same when
61
59
// printing a compiled pattern
62
- attributes = new ArrayList <>();
60
+ this . attributes = new ArrayList <>();
63
61
descString = "{" ;
64
- for (Triple <String , String , Boolean > entry : attrs ) {
62
+ for (Triple <String , String , Boolean > entry : attrs . attributes () ) {
65
63
if (!descString .equals ("{" ))
66
64
descString += ";" ;
67
65
String key = entry .first ();
@@ -100,12 +98,12 @@ public NodePattern(GraphRelation r, boolean negDesc,
100
98
}
101
99
}
102
100
103
- if (root ) {
101
+ if (attrs . root () ) {
104
102
if (!descString .equals ("{" ))
105
103
descString += ";" ;
106
104
descString += "$" ;
107
105
}
108
- if (empty ) {
106
+ if (attrs . empty () ) {
109
107
if (!descString .equals ("{" ))
110
108
descString += ";" ;
111
109
descString += "#" ;
@@ -114,8 +112,8 @@ public NodePattern(GraphRelation r, boolean negDesc,
114
112
115
113
this .name = name ;
116
114
this .child = null ;
117
- this .isRoot = root ;
118
- this .isEmpty = empty ;
115
+ this .isRoot = attrs . root () ;
116
+ this .isEmpty = attrs . empty () ;
119
117
120
118
this .variableGroups = Collections .unmodifiableList (variableGroups );
121
119
}
0 commit comments