up
Class BinaryRule

java.lang.Object
  extended by up.Rule
      extended by up.BinaryRule

public class BinaryRule
extends Rule

A binary rule of a PCFG. This is a rule of the form A → B C.


Constructor Summary
BinaryRule(int lhs, int rhs1, int rhs2)
          Constructs a new binary rule.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Tests whether this rule is equal to the specified object.
 int getLHS()
          Returns the left-hand side of this rule.
 int getRHS1()
          Returns the first category on the right-hand side of this rule.
 int getRHS2()
          Returns the second category on the right-hand side of this rule.
 int hashCode()
          Returns the hash code of this rule.
 
Methods inherited from class up.Rule
getScore, setScore
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryRule

public BinaryRule(int lhs,
                  int rhs1,
                  int rhs2)
Constructs a new binary rule.

Parameters:
lhs - the left-hand side of the new rule
rhs1 - the first category on the right-hand side of the new rule
rhs2 - the second category on the right-hand side of the new rule
Method Detail

getLHS

public int getLHS()
Description copied from class: Rule
Returns the left-hand side of this rule.

Specified by:
getLHS in class Rule
Returns:
the left-hand side of this rule

getRHS1

public int getRHS1()
Returns the first category on the right-hand side of this rule.

Returns:
the first category on the right-hand side of this rule

getRHS2

public int getRHS2()
Returns the second category on the right-hand side of this rule.

Returns:
the second category on the right-hand side of this rule

equals

public boolean equals(java.lang.Object obj)
Tests whether this rule is equal to the specified object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare with
Returns:
true iff this rule is equal to the specified object

hashCode

public int hashCode()
Returns the hash code of this rule.

Overrides:
hashCode in class java.lang.Object
Returns:
the hash code of this rule