nbi.xmlsec.biocase.protocol.filter
Class LOPFilter

java.lang.Object
  extended byorg.xml.sax.helpers.XMLFilterImpl
      extended bynbi.xmlsec.biocase.protocol.filter.ProtocolFilter
          extended bynbi.xmlsec.biocase.protocol.filter.LOPFilter
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, XMLFilter, XMLReader

public class LOPFilter
extends ProtocolFilter

The class LOPFilter parses the content of a LOP operator of BioCASE search request from a SAX stream.

All SAX events are forwarded to the defined ContentHandler. The parsed LOPmay be retrieved with getOperator().

Since:
Version:
$Revision: 1.7 $
Author:
Lutz Suhrbier

Field Summary
static String LN_AND
          Local name of the Binary LOP and
protected static String LN_LOP_SYNTAX
          Local name of the attribute syntax of any COP element
static String LN_NOT
          Local name of the Unary LOP not
static String LN_OR
          Local name of the Binary LOP or
protected  LOP lop
          Stores the parsed LOP
private  List opFilters
          List of parsed suboperators (max 2)
(package private) static int trackMode
          Track mode for the filter stack
 
Fields inherited from class nbi.xmlsec.biocase.protocol.filter.ProtocolFilter
elementStack, filterMode, FILTERMODE_FILTER, FILTERMODE_NONE, FILTERMODE_PARSER, filterRoot, logger, PROT_URI_13, PROT_URI_20
 
Fields inherited from class org.xml.sax.helpers.XMLFilterImpl
 
Constructor Summary
LOPFilter(String protocolURI, String filterRoot, int trackMode, int filterMode)
          Inits the LOP filter.
LOPFilter(XMLReader parent, String protocolURI, String filterRoot, int trackMode, int filterMode)
          Inits the LOP filter with the specified parent.
 
Method Summary
protected  nbi.xml.sax.SAXElement filterElement(nbi.xml.sax.SAXElement element)
          Sets up the corresponding subfilter depending on the current operator type.
 LOP getOperator()
          Gets the LOP operator
private  void initSubFilter()
           
static boolean isBinary(String operator)
          Checks if the given operator is a BinaryLOP operator.
static boolean isOperator(String operator)
          Checks if the given operator is a LOP operator.
static boolean isUnary(String operator)
          Checks if the given operator is a UnaryLOP operator.
protected  nbi.xml.sax.SAXElement parseElement(nbi.xml.sax.SAXElement element)
          Adds the last parsed operator to the lop.
protected  nbi.xml.sax.SAXElement parseInit(nbi.xml.sax.SAXElement element)
          Initialises the LOP setting its syntax.
 
Methods inherited from class nbi.xmlsec.biocase.protocol.filter.ProtocolFilter
characters, checkFilterParameter, endElement, filterCharacters, getFilterMode, getFilterParameter, getProtocolURI, isParsingComplete, parseComplete, registerSubFilter, setFilterParameter, setProtocolURI, startElement, unregisterSubFilter
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
endDocument, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, parse, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LN_LOP_SYNTAX

protected static String LN_LOP_SYNTAX
Local name of the attribute syntax of any COP element


LN_NOT

public static String LN_NOT
Local name of the Unary LOP not


LN_AND

public static String LN_AND
Local name of the Binary LOP and


LN_OR

public static String LN_OR
Local name of the Binary LOP or


lop

protected LOP lop
Stores the parsed LOP


trackMode

static final int trackMode
Track mode for the filter stack

See Also:
Constant Field Values

opFilters

private List opFilters
List of parsed suboperators (max 2)

Constructor Detail

LOPFilter

public LOPFilter(String protocolURI,
                 String filterRoot,
                 int trackMode,
                 int filterMode)
Inits the LOP filter.

Parameters:
protocolURI - URI of the protocol version.
filterRoot - Local name of the root element.
trackMode - Define track mode for the internal FilterStack.
filterMode - filterMode of this filter ProtocolFilter.filterMode.

LOPFilter

public LOPFilter(XMLReader parent,
                 String protocolURI,
                 String filterRoot,
                 int trackMode,
                 int filterMode)
Inits the LOP filter with the specified parent.

Parameters:
parent - Parent reader.
protocolURI - URI of the protocol version.
filterRoot - Local name of the root element.
trackMode - Define track mode for the internal FilterStack.
filterMode - filterMode of this filter ProtocolFilter.filterMode.
Method Detail

initSubFilter

private void initSubFilter()

parseInit

protected nbi.xml.sax.SAXElement parseInit(nbi.xml.sax.SAXElement element)
                                    throws SAXException
Initialises the LOP setting its syntax.

Overrides:
parseInit in class ProtocolFilter
Parameters:
element - The element of the startElement event (contains no value).
Returns:
The (modified) element or null when the event shall be removed.
Throws:
SAXException - If any parsing error occurs.
See Also:
ProtocolFilter.parseInit(SAXElement)

filterElement

protected nbi.xml.sax.SAXElement filterElement(nbi.xml.sax.SAXElement element)
                                        throws SAXException
Sets up the corresponding subfilter depending on the current operator type. The subfilter is added to the internal operator filter list and registered as subfilter.

Overrides:
filterElement in class ProtocolFilter
Parameters:
element - The element corresponding to the startElement event.
Returns:
The (modified) element or null when element shall be removed.
Throws:
SAXException - If any parsing error occurs.
See Also:
ProtocolFilter.filterElement(SAXElement)

parseElement

protected nbi.xml.sax.SAXElement parseElement(nbi.xml.sax.SAXElement element)
                                       throws SAXException
Adds the last parsed operator to the lop. Unregisters the current operator subfilter.

Overrides:
parseElement in class ProtocolFilter
Parameters:
element - The element corresponding to the endElement event.
Returns:
The (modified) element or null when element shall be removed.
Throws:
SAXException - If any parsing error occurs.
See Also:
ProtocolFilter.parseComplete(SAXElement)

isOperator

public static boolean isOperator(String operator)
Checks if the given operator is a LOP operator.

Parameters:
operator - operator to check
Returns:
true if operator is a LOP, false otherwise.

isBinary

public static boolean isBinary(String operator)
Checks if the given operator is a BinaryLOP operator.

Parameters:
operator - operator to check
Returns:
true if operator is binary, false otherwise.

isUnary

public static boolean isUnary(String operator)
Checks if the given operator is a UnaryLOP operator.

Parameters:
operator - operator to check
Returns:
true if operator is unary, false otherwise.

getOperator

public LOP getOperator()
Gets the LOP operator

Returns:
Returns the LOP operator.


Copyright © 2006 Lutz Suhrbier, Freie Universitšt Berlin. All Rights Reserved.