de.saar.chorus.domgraph.equivalence
Class EquationSystem

Object
  extended by DefaultHandler
      extended by EquationSystem
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class EquationSystem
extends DefaultHandler

A representation for a term equation system. Such an equation system can be used as input for the redundancy elimination algorithm.

Author:
Alexander Koller

Constructor Summary
EquationSystem()
           
 
Method Summary
 void add(FragmentWithHole fh1, FragmentWithHole fh2)
          Add an equation between two label-hole pairs.
 void addEquivalenceClass(Collection<FragmentWithHole> fhs)
          Add equations between any two members of a collection of label-hole pairs.
 void clear()
          Remove all equations from this equation system.
 boolean contains(Equation eq)
          Checks whether a given equation is contained in the equation system.
 void endElement(String uri, String localName, String qName)
           
 void read(Reader reader)
          Reads an equation system from an XML specification.
 int size()
          Returns the number of equations.
 void startElement(String uri, String localName, String qName, Attributes attributes)
           
 String toString()
          Returns a string representation of this equation system.
 
Methods inherited from class DefaultHandler
characters, endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EquationSystem

public EquationSystem()
Method Detail

add

public void add(FragmentWithHole fh1,
                FragmentWithHole fh2)
Add an equation between two label-hole pairs.

Parameters:
fh1 - a label-hole pair
fh2 - another label-hole pair

addEquivalenceClass

public void addEquivalenceClass(Collection<FragmentWithHole> fhs)
Add equations between any two members of a collection of label-hole pairs.

Parameters:
fhs - a collection of label-hole pairs

clear

public void clear()
Remove all equations from this equation system.


contains

public boolean contains(Equation eq)
Checks whether a given equation is contained in the equation system.

Parameters:
eq - an equation
Returns:
true iff this equation is contained in this equation system.

size

public int size()
Returns the number of equations.

Returns:
the number of equations

read

public void read(Reader reader)
          throws ParserConfigurationException,
                 SAXException,
                 IOException
Reads an equation system from an XML specification. The specification can use the following constructions:

Parameters:
reader - a reader from which the specification is read
Throws:
ParserConfigurationException - if an error occurred while configuring the XML parser
SAXException - if an error occurred while parsing
IOException - if an I/O error occurred while reading from the reader.

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes attributes)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Throws:
SAXException

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler
Throws:
SAXException

toString

public String toString()
Returns a string representation of this equation system.

Overrides:
toString in class Object
Returns:
a string representation