Class CFExpressionSet


  • public final class CFExpressionSet
    extends CFNamedItem
    Set of expressions. Each expressions set is associated with one bin set. In turn each particular expression from this set is associated with one bin from the mentioned bin set.
    Author:
    Petr Hamernik
    • 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
      • 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 returns null.
        Parameters:
        convertor - convertor to be used
        values - 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 operator
        values - expression operands
        bin - bin associated with the new expression. Must belong to bin 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 the formatter 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 class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object