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

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.AbstractRegexConstraint
Direct Known Subclasses:
RegexConstraint, StringConstraint

public abstract class AbstractRegexConstraint
extends CaptureConstraint


Field Summary
protected  Pattern pattern
           
 edu.washington.cs.knowitall.commonlib.ArraySet<String> terms
           
 
Fields inherited from class edu.washington.cs.knowitall.rule.constraint.Constraint
part
 
Constructor Summary
AbstractRegexConstraint(org.jdom.Element e)
           
AbstractRegexConstraint(ExtractionPart part, List<String> terms)
           
AbstractRegexConstraint(ExtractionPart part, String term)
           
 
Method Summary
protected  Boolean check(TokenSequence extraction)
           
 boolean equals(Object other)
          Force subclasses to avoid pointer-based comparison.
protected  int flags()
           
 List<Constraint> generalize()
          Creates a list of constraints with constraint size reduced by exactly one.
protected  String getString(TokenSequence extraction)
           
 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 abstract  String transform(String term)
           
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
 

Field Detail

pattern

protected final Pattern pattern

terms

public edu.washington.cs.knowitall.commonlib.ArraySet<String> terms
Constructor Detail

AbstractRegexConstraint

public AbstractRegexConstraint(org.jdom.Element e)

AbstractRegexConstraint

public AbstractRegexConstraint(ExtractionPart part,
                               String term)

AbstractRegexConstraint

public AbstractRegexConstraint(ExtractionPart part,
                               List<String> terms)
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

flags

protected int flags()

transform

protected abstract String transform(String term)

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

getString

protected String getString(TokenSequence extraction)

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:

toXmlElement

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


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