edu.washington.cs.knowitall.rule.constraint
Class PartConstraint

java.lang.Object
  extended by edu.washington.cs.knowitall.rule.constraint.Constraint
      extended by edu.washington.cs.knowitall.rule.constraint.CaptureConstraint
          extended by edu.washington.cs.knowitall.rule.constraint.PartConstraint

public class PartConstraint
extends CaptureConstraint

While not strictly a constraint because the condition is always true, this constraint captures the specified extraction part. Thus it is useful as an argument constraint.

Author:
schmmd

Field Summary
 
Fields inherited from class edu.washington.cs.knowitall.rule.constraint.Constraint
part
 
Constructor Summary
PartConstraint(org.jdom.Element e)
           
PartConstraint(ExtractionPart part)
           
 
Method Summary
protected  Boolean check(TokenSequence extraction)
           
 boolean equals(Object other)
          Force subclasses to avoid pointer-based comparison.
 List<Constraint> generalize()
          Creates a list of constraints with constraint size reduced by exactly one.
 int hashCode()
          Force subclasses to avoid pointer-based comparison.
 int size()
          The size of a constraint is the count of subconstraints.
 String toString()
          Provides a base constraint representation.
 org.jdom.Element toXmlElement()
           
protected  String value(TokenSequence extraction)
           
 
Methods inherited from class edu.washington.cs.knowitall.rule.constraint.CaptureConstraint
value
 
Methods inherited from class edu.washington.cs.knowitall.rule.constraint.Constraint
check, create, create, create, fromXmlElement, getConstraintClass, simplify, subsumes, toString, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PartConstraint

public PartConstraint(org.jdom.Element e)

PartConstraint

public PartConstraint(ExtractionPart part)
Method Detail

toString

public String toString()
Description copied from class: Constraint
Provides a base constraint representation. Constraint(part=LEFT)

Overrides:
toString in class Constraint

equals

public boolean equals(Object other)
Description copied from class: Constraint
Force subclasses to avoid pointer-based comparison.

Overrides:
equals in class Constraint

hashCode

public int hashCode()
Description copied from class: Constraint
Force subclasses to avoid pointer-based comparison.

Overrides:
hashCode in class Constraint

check

protected Boolean check(TokenSequence extraction)
Specified by:
check in class Constraint
Returns:
true if the constraint passes

value

protected String value(TokenSequence extraction)
Specified by:
value in class CaptureConstraint
Returns:
the matching string, or null

toXmlElement

public org.jdom.Element toXmlElement()
Overrides:
toXmlElement in class Constraint

generalize

public List<Constraint> generalize()
Description copied from class: Constraint
Creates a list of constraints with constraint size reduced by exactly one.

Specified by:
generalize in class Constraint
Returns:

size

public int size()
Description copied from class: Constraint
The size of a constraint is the count of subconstraints. Most constraints will have a size of one. However TermConstraint for example has a size equal to the number of restrictions it has.

Specified by:
size in class Constraint
Returns:


Copyright © 2011 University of Washington CSE. All Rights Reserved.