com.bbn.openmap.layer.vpf
Class GeoSymAttExpression

java.lang.Object
  extended by com.bbn.openmap.layer.vpf.GeoSymAttExpression

public class GeoSymAttExpression
extends java.lang.Object

This parser class takes a string representing a logic statement and parses it into objects that can be used for evaluating attributes of features. It's based on expressions specified in the GeoSym Handbook MIL-HDBK-857A.

It can parse the expression given per the specification, such as 42|1|bfc|1|0|1, or the strings specified in the symbol tables in the MIL-DTL-89045A, like bfc=81 AND sta<>0and<>1and<>2and<>3and<>5and<>6and<>11.

Author:
dietrick

Nested Class Summary
static class GeoSymAttExpression.ColumnExpression
          A ColumnExpression is the comparison of an FCI column value against another column value.
static class GeoSymAttExpression.CompareExpression
           
static class GeoSymAttExpression.Connector
          Connector class is the part of the expression that contains the logic operation, AND, OR, and and or.
static class GeoSymAttExpression.ECDISExpression
          The ECDISExpression checks the warehouse for user set values when evaluating.
static interface GeoSymAttExpression.Expression
          The Expression interface allows for the recursive queries of Connectors and Value/CompareExpressions.
static class GeoSymAttExpression.StringExpression
          The ECDISExpression checks the warehouse for user set values when evaluating.
static class GeoSymAttExpression.ValueExpression
          The ValueExpression is a comparison of a FCI value to a numerical value.
 
Field Summary
static int and_CONN
           
static int AND_CONN
           
static int EQUALS_OP
           
protected  GeoSymAttExpression.Expression exp
           
static int GREATER_THAN_OP
           
static int GT_EQUALS_OP
           
static int LESS_THAN_OP
           
static int LT_EQUALS_OP
           
static int NO_OP
           
static int NONE_CONN
           
static int NOT_EQUALS_OP
           
protected static java.lang.String[] ops
          The NOOP goes first to preserve the index value of each operator, as specifed in the GeoSym spec.
static int or_CONN
           
static int OR_CONN
           
protected  VPFAutoFeatureGraphicWarehouse warehouse
           
 
Constructor Summary
GeoSymAttExpression(java.lang.String source, VPFAutoFeatureGraphicWarehouse warehouse)
          Create the expression object given a text representation of it.
 
Method Summary
 boolean evaluate(FeatureClassInfo fci, int row)
          Does the feature in row of fci pass the conditions of this expression.
 boolean evaluate(FeatureClassInfo fci, java.util.List<java.lang.Object> row)
          This one is used by the CoverageTable.
protected  GeoSymAttExpression.Expression findExpression(java.lang.String source)
          Recursive parsing statement.
protected  GeoSymAttExpression.Expression findMathOp(java.lang.String source)
           
protected  GeoSymAttExpression.Connector findMiniOp(java.lang.String source)
           
protected  GeoSymAttExpression.Connector findOp(java.lang.String source)
           
static void main(java.lang.String[] args)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_OP

public static final int NO_OP
See Also:
Constant Field Values

EQUALS_OP

public static final int EQUALS_OP
See Also:
Constant Field Values

NOT_EQUALS_OP

public static final int NOT_EQUALS_OP
See Also:
Constant Field Values

LESS_THAN_OP

public static final int LESS_THAN_OP
See Also:
Constant Field Values

GREATER_THAN_OP

public static final int GREATER_THAN_OP
See Also:
Constant Field Values

LT_EQUALS_OP

public static final int LT_EQUALS_OP
See Also:
Constant Field Values

GT_EQUALS_OP

public static final int GT_EQUALS_OP
See Also:
Constant Field Values

NONE_CONN

public static final int NONE_CONN
See Also:
Constant Field Values

or_CONN

public static final int or_CONN
See Also:
Constant Field Values

AND_CONN

public static final int AND_CONN
See Also:
Constant Field Values

and_CONN

public static final int and_CONN
See Also:
Constant Field Values

OR_CONN

public static final int OR_CONN
See Also:
Constant Field Values

warehouse

protected VPFAutoFeatureGraphicWarehouse warehouse

exp

protected GeoSymAttExpression.Expression exp

ops

protected static java.lang.String[] ops
The NOOP goes first to preserve the index value of each operator, as specifed in the GeoSym spec.

Constructor Detail

GeoSymAttExpression

public GeoSymAttExpression(java.lang.String source,
                           VPFAutoFeatureGraphicWarehouse warehouse)
Create the expression object given a text representation of it.

Parameters:
source -
warehouse - used to resolve the ECDIS variables.
Method Detail

findOp

protected GeoSymAttExpression.Connector findOp(java.lang.String source)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

findMiniOp

protected GeoSymAttExpression.Connector findMiniOp(java.lang.String source)

findMathOp

protected GeoSymAttExpression.Expression findMathOp(java.lang.String source)

findExpression

protected GeoSymAttExpression.Expression findExpression(java.lang.String source)
Recursive parsing statement. Keys on Connectors (AND, OR) and builds Expressions based on those. Then looks for mini connectors (and, or) and builds on those. Of course, there might just be one expression here, one that is separated by an operator.

Parameters:
source -
Returns:
Expression tree

evaluate

public boolean evaluate(FeatureClassInfo fci,
                        int row)
Does the feature in row of fci pass the conditions of this expression.

Parameters:
fci -
row -
Returns:
true if row contents passes evaluation

evaluate

public boolean evaluate(FeatureClassInfo fci,
                        java.util.List<java.lang.Object> row)
This one is used by the CoverageTable. Does the feature in row of fci pass the conditions of this expression.

Parameters:
fci -
row -
Returns:
true if row passes evaluation

main

public static void main(java.lang.String[] args)


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details