Package com.im.ijc.cf.api
Class CFExpressionSet
- java.lang.Object
-
- com.im.ijc.cf.api.CFAbstractItem
-
- com.im.ijc.cf.api.CFNamedItem
-
- com.im.ijc.cf.api.CFExpressionSet
-
public final class CFExpressionSet extends CFNamedItem
Set ofexpressions
. Each expressions set is associated with onebin set
. In turn each particularexpression
from this set is associated with onebin
from the mentioned bin set.- Author:
- Petr Hamernik
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROP_DEFAULT_BIN
Name of property change event fired when default bin of this expression set has changed.static java.lang.String
PROP_EXPRESSIONS
Name of property change event fired when set of owned expressions have changed.static java.lang.String
PROP_FIELD_TYPE
Name of property change event fired when field type of this expression set has changed.-
Fields inherited from class com.im.ijc.cf.api.CFNamedItem
PROP_DISPLAY_NAME
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CFExpression
addExpression(CFOperator operator, java.lang.Object[] values, CFBin bin)
Creates new expression according to given parameters and adds it to this set.static java.lang.Object[]
convertValues(CFDataConvertor convertor, java.lang.Object[] values)
Tries to convert all values in the given array using the given convertor.boolean
equals(java.lang.Object obj)
CFBinSet
getBinSet()
CFBin
getDefaultBin()
java.util.List<CFExpression>
getExpressions()
CFFieldType
getFieldType()
CFFormatter
getFormattingForValue(java.lang.Object value)
Find formatting for the value.java.lang.String
getId()
int
hashCode()
void
removeAllExpressions()
Removes all expressions from this set.void
removeExpression(CFExpression expr)
Remove one expression from this set.void
setDefaultBin(CFBin defaultBin)
void
setFieldType(CFFieldType fieldType)
Sets new field type and revalidates all expression in this set whether they are compatible with the given field type.-
Methods inherited from class com.im.ijc.cf.api.CFNamedItem
getDisplayName, setDisplayName
-
Methods inherited from class com.im.ijc.cf.api.CFAbstractItem
addPropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
PROP_FIELD_TYPE
public static final java.lang.String PROP_FIELD_TYPE
Name of property change event fired when field type of this expression set has changed.- See Also:
- Constant Field Values
-
PROP_DEFAULT_BIN
public static final java.lang.String PROP_DEFAULT_BIN
Name of property change event fired when default bin of this expression set has changed.- See Also:
- Constant Field Values
-
PROP_EXPRESSIONS
public static final java.lang.String PROP_EXPRESSIONS
Name of property change event fired when set of owned expressions have changed. E.g. when expression was added or removed.- See Also:
- Constant Field Values
-
-
Method Detail
-
getDefaultBin
public CFBin getDefaultBin()
-
setDefaultBin
public void setDefaultBin(CFBin defaultBin)
-
getBinSet
public CFBinSet getBinSet()
- Returns:
- bin set used by this expression set
-
getFieldType
public CFFieldType getFieldType()
-
setFieldType
public void setFieldType(CFFieldType fieldType)
Sets new field type and revalidates all expression in this set whether they are compatible with the given field type. If not they are removed from the set.- Parameters:
fieldType
- new field type
-
convertValues
public static java.lang.Object[] convertValues(CFDataConvertor convertor, java.lang.Object[] values)
Tries to convert all values in the given array using the given convertor. If any of the values cannot be converted method returnsnull
.- Parameters:
convertor
- convertor to be usedvalues
- values to be converted- Returns:
- converted array or
null
-
addExpression
public CFExpression addExpression(CFOperator operator, java.lang.Object[] values, CFBin bin)
Creates new expression according to given parameters and adds it to this set.- Parameters:
operator
- expression operatorvalues
- expression operandsbin
- bin associated with the new expression. Must belong tobin set
associated with this expression set- Returns:
- newly create expression. Never returns
null
.
-
getExpressions
public java.util.List<CFExpression> getExpressions()
- Returns:
- all expressions in this set
-
removeExpression
public void removeExpression(CFExpression expr)
Remove one expression from this set.- Parameters:
expr
- expression to be removed
-
removeAllExpressions
public void removeAllExpressions()
Removes all expressions from this set.
-
getFormattingForValue
public CFFormatter getFormattingForValue(java.lang.Object value)
Find formatting for the value. I.e. the method consecutively tries to match the value against all expressions and if there is a match theformatter of a bin
associated with the expression is returned. If no expression matches for the value formatter of the default bin is returned- Parameters:
value
- data value to be formatted- Returns:
- the formatter for the value. Never return
null
.
-
getId
public java.lang.String getId()
- Returns:
- unique ID of this expression set
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-