forked from bnosac/RDRPOSTagger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNode.java
67 lines (60 loc) · 1.14 KB
/
Node.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* @author DatQuocNguyen
*
*/
public class Node
{
FWObject condition;
String conclusion;
Node exceptNode;
Node ifnotNode;
Node fatherNode;
int depth;
public Node(FWObject inCondition, String inConclusion, Node inFatherNode,
Node inExceptNode, Node inIfnotNode, int inDepth)
{
this.condition = inCondition;
this.conclusion = inConclusion;
this.fatherNode = inFatherNode;
this.exceptNode = inExceptNode;
this.ifnotNode = inIfnotNode;
this.depth = inDepth;
}
public void setIfnotNode(Node node)
{
this.ifnotNode = node;
}
public void setExceptNode(Node node)
{
this.exceptNode = node;
}
public void setFatherNode(Node node)
{
this.fatherNode = node;
}
public int countNodes()
{
int count = 1;
if (exceptNode != null) {
count += exceptNode.countNodes();
}
if (ifnotNode != null) {
count += ifnotNode.countNodes();
}
return count;
}
public boolean satisfy(FWObject object)
{
boolean check = true;
for (int i = 0; i < 13; i++) {
String key = condition.context[i];
if (key != null) {
if (!key.equals(object.context[i])) {
check = false;
break;
}
}
}
return check;
}
}