com.im.df.api 5.9

com.im.df.api.dml
Class Operators.SimpleLogicalOperator

java.lang.Object
  extended by com.im.df.api.dml.DFOperator
      extended by com.im.df.api.dml.Operators.SimpleLogicalOperator
Enclosing class:
Operators

public static class Operators.SimpleLogicalOperator
extends DFOperator

Class for AND/OR operators


Constructor Summary
Operators.SimpleLogicalOperator(String displayName)
           
 
Method Summary
 Class<? extends DFFieldDataTypeCapability> getReturnType(List<DFTerm> operands)
          Compute the return type of the term.
 String getToStringPart(List<DFTerm> operands, int index)
          If there is only a single operand, then return no operator, otherwise operands are connected with logical operator name
 boolean isFieldAcceptableAsOperand(DFField field)
          This is just an utility method which must be implemented by subclasses.
 Object[] parseOperands(DFField field, String operands)
           
 void validate(DFDataTree dataTree, List<DFTerm> operands, Map<String,Object> options, TermErrors errors)
          Validate the operands in context of this operator.
 
Methods inherited from class com.im.df.api.dml.DFOperator
correctNumberOfOperands, getDisplayName, getDisplayNameInExpression, getMaxOperands, getMinOperands, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Operators.SimpleLogicalOperator

public Operators.SimpleLogicalOperator(String displayName)
Method Detail

validate

public void validate(DFDataTree dataTree,
                     List<DFTerm> operands,
                     Map<String,Object> options,
                     TermErrors errors)
Description copied from class: DFOperator
Validate the operands in context of this operator. It's up to operator to decide if it accepts the given operands or not. This method is called from DFTerm.validate(com.im.df.api.ddl.DFDataTree).

Overrides:
validate in class DFOperator
Parameters:
dataTree - The datatree where this operator will be used
operands - The list of operands
options - Options of this query term (DFTermExpression.getOptions()
errors - The errors object which contains the result of the validation

getReturnType

public Class<? extends DFFieldDataTypeCapability> getReturnType(List<DFTerm> operands)
Description copied from class: DFOperator
Compute the return type of the term. Can return null if it cannot be determined.

Specified by:
getReturnType in class DFOperator
Parameters:
operands - The operands for the computation of return type. The result can be different for different set of operands.
Returns:
The class which is subclass of DFFieldDataTypeCapability or null

isFieldAcceptableAsOperand

public boolean isFieldAcceptableAsOperand(DFField field)
Description copied from class: DFOperator
This is just an utility method which must be implemented by subclasses. It test if the given field is acceptable as operand for this DFOperator. It can return true even for fields which are recognized as invalid later. This is just rough test in the beginning of validation to filter inappropriate fields.

For example some operator takes two operands of different types (text, integer,...), but both must be of the same type. In this case this method returns true for all text, integer etc. fields, but if you use combination of [text, integer] as operands, it will be invalid.

Specified by:
isFieldAcceptableAsOperand in class DFOperator
Parameters:
field - The field to be tested
Returns:
True if field seems to be acceptable, false otherwise.

getToStringPart

public String getToStringPart(List<DFTerm> operands,
                              int index)
If there is only a single operand, then return no operator, otherwise operands are connected with logical operator name

Overrides:
getToStringPart in class DFOperator
Parameters:
operands - The list of all operands
index - The index of String [0..operands.size()]
Returns:
The indexed part of whole DFOperator.toString(java.util.List) method.

parseOperands

public Object[] parseOperands(DFField field,
                              String operands)
                       throws IllegalArgumentException
Specified by:
parseOperands in class DFOperator
Throws:
IllegalArgumentException

com.im.df.api 5.9