|
com.im.df.api 5.9 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.im.df.api.dml.DFOperator
public abstract class DFOperator
This class represents one operator used by DFTermExpression in DIF API.
DFOperator is only extensible class which constitutes the complex terms used in query.
It's supposed that new operators will be added to the system.
| Constructor Summary | |
|---|---|
DFOperator(String displayName,
int minOperands,
int maxOperands)
Creates new instance of the operator. |
|
DFOperator(String displayName,
String displayNameInExpression,
int minOperands,
int maxOperands)
Creates new instance of the operator. |
|
| Method Summary | |
|---|---|
protected boolean |
correctNumberOfOperands(List<DFTerm> operands)
Test if the given operands number is acceptable. |
String |
getDisplayName()
Return standalone operator's display name (usually the first character is upper case) |
String |
getDisplayNameInExpression()
Return operator's display name which is used in expression (usually the first character is lower case). |
int |
getMaxOperands()
|
int |
getMinOperands()
|
abstract Class<? extends DFFieldDataTypeCapability> |
getReturnType(List<DFTerm> operands)
Compute the return type of the term. |
String |
getToStringPart(List<DFTerm> operands,
int index)
Get the part of the complete toString(java.util.List) method result. |
abstract boolean |
isFieldAcceptableAsOperand(DFField field)
This is just an utility method which must be implemented by subclasses. |
abstract Object[] |
parseOperands(DFField field,
String operands)
|
String |
toString()
|
String |
toString(List<DFTerm> 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 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DFOperator(String displayName,
int minOperands,
int maxOperands)
displayName - Operator's display nameminOperands - Minimum number of operands which is acceptable for this operatormaxOperands - Maximum number of operands which is acceptable for this operator
public DFOperator(String displayName,
String displayNameInExpression,
int minOperands,
int maxOperands)
displayName - Operator's display name (standalone) - e.g. "Is null"displayNameInExpression - Operator's display name - when used in expression - e.g. "is null".minOperands - Minimum number of operands which is acceptable for this operatormaxOperands - Maximum number of operands which is acceptable for this operator| Method Detail |
|---|
public String getDisplayName()
public String getDisplayNameInExpression()
public int getMinOperands()
public int getMaxOperands()
public void validate(DFDataTree dataTree,
List<DFTerm> operands,
Map<String,Object> options,
TermErrors errors)
DFTerm.validate(com.im.df.api.ddl.DFDataTree).
dataTree - The datatree where this operator will be usedoperands - The list of operandsoptions - Options of this query term (DFTermExpression.getOptions()errors - The errors object which contains the result of the validationprotected boolean correctNumberOfOperands(List<DFTerm> operands)
operands - The operands to test
public abstract Class<? extends DFFieldDataTypeCapability> getReturnType(List<DFTerm> operands)
operands - The operands for the computation of return type. The result can be different for
different set of operands.
DFFieldDataTypeCapability or null
public abstract Object[] parseOperands(DFField field,
String operands)
throws IllegalArgumentException
IllegalArgumentExceptionpublic String toString(List<DFTerm> operands)
public String getToStringPart(List<DFTerm> operands,
int index)
toString(java.util.List) method result.
This method can be overriden by subclasses so each operator can provide
specific form of String representation.
For example for binary operator is this method called 3 times: for indexes 0, 1 and 2. The index=0 means it's string before the first operand, index=1 is string between operands and index=2 is after the second operand. For operator LESS_THAN it should return: index=0 => "", index=1 => " less than ", and for index=2 => "".
This method allow subclass to reuse the generic code from toString(java.util.List)
and change the own notation (e.g. "[molW %lt; 15]" => "[%lt; moW, 15]" etc.).
operands - The list of all operandsindex - The index of String [0..operands.size()]
toString(java.util.List) method.public abstract boolean isFieldAcceptableAsOperand(DFField field)
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.
field - The field to be tested
public String toString()
toString in class Object
|
com.im.df.api 5.9 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||