Open.java
678 Bytes
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
package is2.parser;
import is2.data.Parse;
final public class Open {
	public float p;
	short s, e, label;
	byte dir;
	Closed left;
	Closed right;
	public Open(short s, short t, short dir, short label, Closed left, Closed right, float p) {
		this.s = s;
		this.e = t;
		this.label = label;
		this.dir = (byte) dir;
		this.left = left;
		this.right = right;
		this.p = p;
	}
	void create(Parse parse) {
		if (dir == 0) {
			parse.heads[s] = e;
			if (label != -1)
				parse.labels[s] = label;
		} else {
			parse.heads[e] = s;
			if (label != -1)
				parse.labels[e] = label;
		}
		if (left != null)
			left.create(parse);
		if (right != null)
			right.create(parse);
	}
}