public class BinaryRule extends java.lang.Object implements Rule, java.lang.Comparable<BinaryRule>, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
int |
leftChild |
int |
parent |
int |
rightChild |
float |
score
Score should be a log probability
|
| Constructor and Description |
|---|
BinaryRule(int parent,
int leftChild,
int rightChild)
Create a new BinaryRule with the parent and children coded as ints.
|
BinaryRule(int parent,
int leftChild,
int rightChild,
double score) |
BinaryRule(java.lang.String s,
Index<java.lang.String> index)
Creates a BinaryRule from String s, assuming it was created using toString().
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(BinaryRule br) |
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
int |
parent() |
float |
score() |
java.lang.String |
toString() |
java.lang.String |
toString(Index<java.lang.String> index) |
java.lang.String |
toStringNoScore(Index<java.lang.String> index) |
public int parent
public float score
public int leftChild
public int rightChild
public BinaryRule(int parent,
int leftChild,
int rightChild)
parent - The parent intleftChild - The left child intrightChild - The right child intpublic BinaryRule(int parent,
int leftChild,
int rightChild,
double score)
public BinaryRule(java.lang.String s,
Index<java.lang.String> index)
s - A String in which the binary rule is represented as parent,
left-child, right-child, score, with the items quoted as neededindex - Index used to convert String names to intspublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(Index<java.lang.String> index)
public java.lang.String toStringNoScore(Index<java.lang.String> index)
public int compareTo(BinaryRule br)
compareTo in interface java.lang.Comparable<BinaryRule>