de.fu_berlin.ties.filter
Interface ElementFilter

All Known Implementing Classes:
RepresentationFilter, TrainableFilter

public interface ElementFilter

Interface for classes that decide whether or not to accept elements in XML documents. This interface cannot extend the NodeFilter interface because the matches(Element)method is allowed to throw an ProcessingException.

Version:
$Revision: 1.8 $, $Date: 2006/10/21 16:04:19 $, $Author: siefkes $
Author:
Christian Siefkes

Method Summary
 boolean avoids(Element element)
          Whether the filter would avoid to filter an element, if possible.
 void init(Document document, File filename)
          Resets the filter to start processing a new document.
 boolean matches(Element element)
          Decides whether an element is accepted by this filter.
 boolean prefers(Element element)
          Whether the filter would prefer to filter an element.
 

Method Detail

init

void init(Document document,
          File filename)
          throws ProcessingException,
                 IOException
Resets the filter to start processing a new document. This method must be called for each document to be procesed by this filter prior to calling matches(Element)or prefers(Element)on elements of this document.

Parameters:
document - the document to process
filename - the file name of the document
Throws:
ProcessingException - if an error occurs while starting to process the document
IOException - if an I/O error occurs

avoids

boolean avoids(Element element)
Whether the filter would avoid to filter an element, if possible. Any filter must be able to filter all elements, but some filters like to avoid elements of a certain type, for example.

Parameters:
element - the element to consider
Returns:
true if this would prefer to avoid filtering the element; false otherwise

matches

boolean matches(Element element)
                throws ProcessingException
Decides whether an element is accepted by this filter.

Parameters:
element - the element to test
Returns:
true if this filter accepts the element; false otherwise
Throws:
ProcessingException - if an error occurs during filtering

prefers

boolean prefers(Element element)
Whether the filter would prefer to filter an element. Any filter must be able to filter all elements, but some filters prefer elements of a certain type, for example.

Parameters:
element - the element to consider
Returns:
true if this would prefer to filter the element; false otherwise


Copyright © 2003-2007 Christian Siefkes. All Rights Reserved.