public class CEEvaluator
extends java.lang.Object
Custom parsing The CEEvaluator parses constraint expressions into Clause objects using a ClauseFactory. Customized behavior during parsing can be achieved by passing a customized ClauseFactory into the CEEvaluator.
Support for server side functions Server side functions are supported via the FunctionLibrary class. Custom server side function support is achieved by using a customized ClauseFactory which in turn contains a customized FunctionLibrary.
More details are found in the documentation for the respective classes.
ServerDDS
,
ServerMethods
,
ClauseFactory
,
FunctionLibrary
,
Clause
Constructor and Description |
---|
CEEvaluator(ServerDDS dds)
Construct a new
CEEvaluator with dds as the
DDS object with which to resolve all variable and function names. |
CEEvaluator(ServerDDS dds,
ClauseFactory clauseFactory)
Construct a new
CEEvaluator with dds as the
DDS object with which to resolve all variable and function names, and
clauseFactory as a source of Clause objects . |
Modifier and Type | Method and Description |
---|---|
void |
appendClause(Clause c)
Add a clause to the constraint expression.
|
boolean |
evalClauses(java.lang.Object specialO)
Evaluate all of the Clauses in the Clause vector.
|
java.util.Enumeration |
getClauses()
Get access to the list of clauses built by parsing the selection part
of the constraint expression.
|
ServerDDS |
getDDS()
Return a reference to the CEEvaluator's DDS object.
|
void |
markAll(boolean state)
Mark all the variables in the DDS either as part of the current
projection (when
state is true) or not
(state is false). |
void |
parseConstraint(ReqState rs)
Convenience wrapper for parseConstraint.
|
void |
parseConstraint(java.lang.String constraint,
java.lang.String urlencoded)
Parse a constraint expression.
|
void |
printConstraint(java.io.PrintWriter pw)
Print all of the Clauses in the Clause vector.
|
boolean |
removeClause(Clause c)
Remove a clause from the constraint expression.
|
void |
send(java.lang.String dataset,
java.io.OutputStream sink,
java.lang.Object specialO)
This function sends the variables described in the constrained DDS to
the output described by
sink . |
public CEEvaluator(ServerDDS dds)
CEEvaluator
with dds
as the
DDS object with which to resolve all variable and function names.dds
- DDS object describing the dataset targeted by this
constraint.public CEEvaluator(ServerDDS dds, ClauseFactory clauseFactory)
CEEvaluator
with dds
as the
DDS object with which to resolve all variable and function names, and
clauseFactory
as a source of Clause objects .clauseFactory
- The factory which will be used by the parser to construct the clause
tree. This allows servers to pass in a factory which creates
custom clause objects.dds
- DDS object describing the dataset targeted by this
constraint.public ServerDDS getDDS()
public void parseConstraint(java.lang.String constraint, java.lang.String urlencoded) throws ParseException, DAP2Exception, NoSuchVariableException, NoSuchFunctionException, InvalidOperatorException, InvalidParameterException, SBHException, WrongTypeException
constraint
- The constraint expression to parse.ParseException
NoSuchVariableException
NoSuchFunctionException
InvalidOperatorException
InvalidParameterException
SBHException
DAP2Exception
WrongTypeException
public void parseConstraint(ReqState rs) throws ParseException, DAP2Exception, NoSuchVariableException, NoSuchFunctionException, InvalidOperatorException, InvalidParameterException, SBHException, WrongTypeException
public void appendClause(Clause c)
c
- The Clause to append.public boolean removeClause(Clause c)
c
- The Clause to append.public final java.util.Enumeration getClauses()
public void send(java.lang.String dataset, java.io.OutputStream sink, java.lang.Object specialO) throws NoSuchVariableException, DAP2ServerSideException, java.io.IOException
sink
. This function calls
parse_constraint()
, BaseType::read()
, and
ServerIO::serialize()
.dataset
- The name of the dataset to send.sink
- A pointer to the output buffer for the data.specialO
- An Object
passed by the server. This is typically used by server implementations
to deliver needed functionaliy or information to the read methods of each BaseType
.NoSuchVariableException
DAP2ServerSideException
java.io.IOException
parseConstraint(java.lang.String, java.lang.String)
,
ServerMethods.serialize()
public boolean evalClauses(java.lang.Object specialO) throws NoSuchVariableException, DAP2ServerSideException, java.io.IOException
specialO
- That special Object that can be passed down
through the DDS.send()
method.NoSuchVariableException
DAP2ServerSideException
java.io.IOException
public void markAll(boolean state) throws DAP2Exception, NoSuchVariableException, SBHException
state
is true) or not
(state
is false). This is a convenience function that
provides a way to clear or set an entire dataset described by a DDS
with respect to its projection.state
- true if the variables should all be projected, false is
no variable should be projected.DAP2Exception
NoSuchVariableException
SBHException
public void printConstraint(java.io.PrintWriter pw)