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

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.AbstractPatternConstraint
              extended by edu.washington.cs.knowitall.rule.constraint.PatternConstraint
                  extended by edu.washington.cs.knowitall.rule.constraint.SequenceConstraint

public class SequenceConstraint
extends PatternConstraint

Constrains based on a sequence of adjacent TermConstraints.

Author:
schmmd

Field Summary
 
Fields inherited from class edu.washington.cs.knowitall.rule.constraint.AbstractPatternConstraint
expression
 
Fields inherited from class edu.washington.cs.knowitall.rule.constraint.Constraint
part
 
Constructor Summary
SequenceConstraint(org.jdom.Element e)
           
SequenceConstraint(ExtractionPart part, Collection<TermConstraint> constraints)
           
 
Method Summary
protected  edu.washington.cs.knowitall.commonlib.ArraySet<TermConstraint> buildConstraints(org.jdom.Element e)
           
 String deserializePattern(org.jdom.Element e)
          Constructs a pattern expression from an element.
 boolean equals(Object other)
          Force subclasses to avoid pointer-based comparison.
 List<Constraint> generalize()
          Simplify this constraint one step.
 int hashCode()
          Force subclasses to avoid pointer-based comparison.
 Constraint simplify()
          Returns null if there are no constraints.
 int size()
          The size of a constraint is the count of subconstraints.
 List<TermConstraint> subconstraints()
          Return an ordered list of the subconstraints that make up this sequence constraint.
 String toString()
          Provides a base constraint representation.
 org.jdom.Element toXmlElement()
           
 
Methods inherited from class edu.washington.cs.knowitall.rule.constraint.AbstractPatternConstraint
check, getString, value
 
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, subsumes, toString, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SequenceConstraint

public SequenceConstraint(org.jdom.Element e)

SequenceConstraint

public SequenceConstraint(ExtractionPart part,
                          Collection<TermConstraint> constraints)
Method Detail

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.

Overrides:
size in class PatternConstraint
Returns:

equals

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

Overrides:
equals in class PatternConstraint

toString

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

Overrides:
toString in class Constraint

hashCode

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

Overrides:
hashCode in class Constraint

simplify

public Constraint simplify()
Returns null if there are no constraints. Otherwise, simplify each term constraint.

Overrides:
simplify in class Constraint
Returns:
the simplified constraint

subconstraints

public List<TermConstraint> subconstraints()
Return an ordered list of the subconstraints that make up this sequence constraint.

Returns:

generalize

public List<Constraint> generalize()
Simplify this constraint one step. A SequenceConstraint is generalized by removing a term constraint from the beginning or end, or by simplifying a single term constraint.

Overrides:
generalize in class PatternConstraint
Returns:

buildConstraints

protected edu.washington.cs.knowitall.commonlib.ArraySet<TermConstraint> buildConstraints(org.jdom.Element e)

deserializePattern

public String deserializePattern(org.jdom.Element e)
Description copied from class: AbstractPatternConstraint
Constructs a pattern expression from an element.

Overrides:
deserializePattern in class AbstractPatternConstraint
Returns:

toXmlElement

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


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