📄 logicsaxparser.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.4.2_13) on Tue Jun 05 11:36:27 GMT-05:00 2007 --><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><TITLE>LogicSAXParser (Geotools 2.3.x 2.3.2 API)</TITLE><META NAME="keywords" CONTENT="org.geotools.filter.LogicSAXParser class"><META NAME="keywords" CONTENT="setFilterFactory()"><META NAME="keywords" CONTENT="start()"><META NAME="keywords" CONTENT="end()"><META NAME="keywords" CONTENT="add()"><META NAME="keywords" CONTENT="create()"><META NAME="keywords" CONTENT="isComplete()"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="LogicSAXParser (Geotools 2.3.x 2.3.2 API)";}</SCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/LogicSAXParser.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../org/geotools/filter/LogicFilterImpl.html" title="class in org.geotools.filter"><B>PREV CLASS</B></A> <A HREF="../../../org/geotools/filter/MapScaleDenominatorImpl.html" title="class in org.geotools.filter"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" target="_top"><B>FRAMES</B></A> <A HREF="LogicSAXParser.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">org.geotools.filter</FONT><BR>Class LogicSAXParser</H2><PRE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <IMG SRC="../../../resources/inherit.gif" ALT="extended by"><B>LogicSAXParser</B></PRE><HR><DL><DT>public class <B>LogicSAXParser</B><DT>extends <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></DL><P>Processes messages from clients to create Logic Filters. Handles nested logic filters. Filters should call start and end when they reach logic filters, and create when the filter is complete. This documenation provided by Dave Blasby April 1/2005 after fixing GEOS-328: DJB: okay, there's no where near enough comments in here to understand whats going on. Hopefully I'm correct. I've looked at this for a bit, and this is what I can figure out. This is called by the FilterFilter class (nice name...NOT) which is also a sax parser-like class. Basically, the FilterFilter does most of the Filter parsing - but it hands most of the work off to the appropriate classes. For NOT, AND, OR clauses, this class is used. As a simple example, <filter> <OR> [STATE_NAME = 'NY'] [STATE_NAME = 'WA'] </OR></FILTER> Or, in long form: <Filter> <Or> <PropertyIsEqualTo> <PropertyName>STATE_NAME</PropertyName> <Literal>NY</Literal> </PropertyIsEqualTo> <PropertyIsEqualTo> <PropertyName>STATE_NAME</PropertyName> <Literal>WA</Literal> </PropertyIsEqualTo> </Or> </Filter> The "PropertyIsEqualTo" is handled by another parser, so we dont have to worry about it here for the moment. So, the order of events are like this: start( "OR" ) add([STATE_NAME = 'NY']) // these are handled by another class add([STATE_NAME = 'WA']) // these are handled by another class end ("OR") create() // this creates an actual Filter [[ STATE_NAME = NY ] OR [ STATE_NAME = WA ]] This is pretty simple, but it gets more complex when you have nested structures. <Filter> <And> <Or> <PropertyIsEqualTo> <PropertyName>STATE_NAME</PropertyName> <Literal>NY</Literal> </PropertyIsEqualTo> <PropertyIsEqualTo> <PropertyName>STATE_NAME</PropertyName> <Literal>WA</Literal> </PropertyIsEqualTo> </Or> <PropertyIsEqualTo> <PropertyName>STATE_NAME</PropertyName> <Literal>BC</Literal> </PropertyIsEqualTo> </And> </Filter> Again, we're going to ignore the "PropertyIsEqualTo" stuff since its handled elsewhere. The main idea is that there will be a LogicSAXParser for the top-level "AND" and another one for the nested "OR". It gets a bit harder to describe because the classes start passing events to each other. start("AND") -- the parent LogicSAXParser starts to construct an "AND" filter start("OR") -- the "AND" parser sees that its sub-element is another logic operator. It makes another LogicSAXParser that will handle the "OR" SAX events. add([STATE_NAME = 'NY']) -- this is sent to the "AND" parser. It then sends it to the "OR" parser. + "OR" parser remembers this component add([STATE_NAME = 'WA']) -- this is sent to the "AND" parser. It then sends it to the "OR" parser. + "OR" parser remembers this component end("OR") -- this is sent to the "AND" parser. It then sends it to the "OR" parser. + The "OR" parser marks itself as complete + The "AND" parser notices that its child is completed parsing + The "AND" parser calls create() on the "OR" parser to make a filter (see next step) + Since "OR" is finished, "AND" stop passing events to it. "OR".create() -- makes a "[[ STATE_NAME = NY ] OR [ STATE_NAME = WA ]]" and "AND" remembers it as a component add ([ STATE_NAME = BC ]) --This is added as a component to the "AND" filter. end ("AND") -- the "AND" parser marks itself as complete create() -- the "AND" parser creates a FILTER [[[ STATE_NAME = NY ] OR [ STATE_NAME = WA ]] AND [ STATE_NAME = BC ]] Higher levels of nesting work the same way - each level will send the event down to the next level. If logicFilter == null then this object is the one doing the processing. If its non-null, then the sub-object is doing the processing - event are sent to it.<P><P><DL><DT><B>Author:</B></DT> <DD>Rob Hranac, Vision for New York, Chris Holmes, TOPP</DD><DT><B>Module:</B></DT><DD><CODE><B>module/main</B></CODE> (<A HREF="http://maven.geotools.fr/repository/org/geotools/gt2-main/"><CODE>gt2-main.jar</CODE></A>) (<A HREF="http://maven.geotools.fr/reports/main/index.html">Maven report</A>) (<A HREF="http://svn.geotools.org/geotools/tags/2.3.2/module/main/src/org/geotools/filter/LogicSAXParser.java">SVN head</A>)</DD></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../org/geotools/filter/LogicSAXParser.html#LogicSAXParser()">LogicSAXParser</A></B>()</CODE><BR> Constructor which flags the operator as between.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../org/geotools/filter/LogicSAXParser.html#LogicSAXParser(org.geotools.filter.FilterFactory)">LogicSAXParser</A></B>(<A HREF="../../../org/geotools/filter/FilterFactory.html" title="interface in org.geotools.filter">FilterFactory</A> factory)</CODE><BR> Constructor injection</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/filter/LogicSAXParser.html#add(org.geotools.filter.Filter)">add</A></B>(<A HREF="../../../org/geotools/filter/Filter.html" title="interface in org.geotools.filter">Filter</A> filter)</CODE><BR> Adds a filter to the current logic list.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -