Class CSSExpression

    • Constructor Detail

      • CSSExpression

        public CSSExpression()
    • Method Detail

      • addTermSimple

        @Nonnull
        public CSSExpression addTermSimple​(@Nonnull @Nonempty
                                           String sValue)
        Shortcut method to add a simple text value.
        Parameters:
        sValue - The value to be added. May neither be null nor empty.
        Returns:
        this
      • addTermSimple

        @Nonnull
        public CSSExpression addTermSimple​(@Nonnegative
                                           int nIndex,
                                           @Nonnull @Nonempty
                                           String sValue)
        Shortcut method to add a simple text value.
        Parameters:
        nIndex - The index where the member should be added. Must be ≥ 0.
        sValue - The value to be added. May neither be null nor empty.
        Returns:
        this
      • addNumber

        @Nonnull
        public CSSExpression addNumber​(int nValue)
        Shortcut method to add a numeric value
        Parameters:
        nValue - The value to be added.
        Returns:
        this
      • addNumber

        @Nonnull
        public CSSExpression addNumber​(@Nonnegative
                                       int nIndex,
                                       int nValue)
        Shortcut method to add a numeric value
        Parameters:
        nIndex - The index where the member should be added. Must be ≥ 0.
        nValue - The value to be added.
        Returns:
        this
      • addNumber

        @Nonnull
        public CSSExpression addNumber​(long nValue)
        Shortcut method to add a numeric value
        Parameters:
        nValue - The value to be added.
        Returns:
        this
      • addNumber

        @Nonnull
        public CSSExpression addNumber​(@Nonnegative
                                       int nIndex,
                                       long nValue)
        Shortcut method to add a numeric value
        Parameters:
        nIndex - The index where the member should be added. Must be ≥ 0.
        nValue - The value to be added.
        Returns:
        this
      • addNumber

        @Nonnull
        public CSSExpression addNumber​(float fValue)
        Shortcut method to add a numeric value
        Parameters:
        fValue - The value to be added.
        Returns:
        this
      • addNumber

        @Nonnull
        public CSSExpression addNumber​(@Nonnegative
                                       int nIndex,
                                       float fValue)
        Shortcut method to add a numeric value
        Parameters:
        nIndex - The index where the member should be added. Must be ≥ 0.
        fValue - The value to be added.
        Returns:
        this
      • addNumber

        @Nonnull
        public CSSExpression addNumber​(double dValue)
        Shortcut method to add a numeric value
        Parameters:
        dValue - The value to be added.
        Returns:
        this
      • addNumber

        @Nonnull
        public CSSExpression addNumber​(@Nonnegative
                                       int nIndex,
                                       double dValue)
        Shortcut method to add a numeric value
        Parameters:
        nIndex - The index where the member should be added. Must be ≥ 0.
        dValue - The value to be added.
        Returns:
        this
      • getQuotedStringValue

        @Nonnull
        @Nonempty
        public static String getQuotedStringValue​(@Nonnull
                                                  String sValue)
        Get a quoted string value. Every double quote (") is replaced to a backslash and a double quote (\").
        Parameters:
        sValue - The source value. May not be null.
        Returns:
        An opening double quote + the quoted string + a closing double quote
        Since:
        6.1.2
      • addString

        @Nonnull
        public CSSExpression addString​(@Nonnull
                                       String sValue)
        Shortcut method to add a string value that is automatically quoted inside
        Parameters:
        sValue - The value to be quoted and than added. May not be null.
        Returns:
        this
      • addString

        @Nonnull
        public CSSExpression addString​(@Nonnegative
                                       int nIndex,
                                       @Nonnull
                                       String sValue)
        Shortcut method to add a string value that is automatically quoted inside
        Parameters:
        nIndex - The index where the member should be added. Must be ≥ 0.
        sValue - The value to be quoted and than added. May not be null.
        Returns:
        this
      • addURI

        @Nonnull
        public CSSExpression addURI​(@Nonnull @Nonempty
                                    String sURI)
        Shortcut method to add a URI value
        Parameters:
        sURI - The value to be added. May neither be null nor empty
        Returns:
        this
      • addURI

        @Nonnull
        public CSSExpression addURI​(@Nonnegative
                                    int nIndex,
                                    @Nonnull @Nonempty
                                    String sURI)
        Shortcut method to add a URI value
        Parameters:
        nIndex - The index where the member should be added. Must be ≥ 0.
        sURI - The value to be added. May neither be null nor empty
        Returns:
        this
      • removeMember

        @Nonnull
        public com.helger.commons.state.EChange removeMember​(@Nullable
                                                             ICSSExpressionMember aMember)
        Remove the passed expression member
        Parameters:
        aMember - The member to be removed. May be null.
        Returns:
        EChange
      • removeMember

        @Nonnull
        public com.helger.commons.state.EChange removeMember​(@Nonnegative
                                                             int nMemberIndex)
        Remove the expression member at the specified in
        Parameters:
        nMemberIndex - the index of the member to be removed. May not be < 0.
        Returns:
        EChange
      • removeAllMembers

        @Nonnull
        public com.helger.commons.state.EChange removeAllMembers()
        Remove all members.
        Returns:
        EChange.CHANGED if any member was removed, EChange.UNCHANGED otherwise. Never null.
        Since:
        3.7.3
      • getAllMembers

        @Nonnull
        @ReturnsMutableCopy
        public com.helger.commons.collection.impl.ICommonsList<ICSSExpressionMember> getAllMembers()
        Returns:
        A copy of all contained expression members. Never null .
      • getMemberAtIndex

        @Nullable
        public ICSSExpressionMember getMemberAtIndex​(@Nonnegative
                                                     int nIndex)
        Get the expression member at the specified index.
        Parameters:
        nIndex - The index to be retrieved
        Returns:
        null if an invalid member index was passed.
      • getMemberCount

        @Nonnegative
        public int getMemberCount()
        Returns:
        The number of expression members present. Always ≥ 0.
      • getAsCSSString

        @Nonnull
        public String getAsCSSString​(@Nonnull
                                     ICSSWriterSettings aSettings,
                                     @Nonnegative
                                     int nIndentLevel)
        Description copied from interface: ICSSWriteable
        Get the contents of this object as a serialized CSS string for writing to an output.
        Specified by:
        getAsCSSString in interface ICSSWriteable
        Parameters:
        aSettings - The settings to be used to format the output. May not be null.
        nIndentLevel - The current indentation level
        Returns:
        The content of this object as CSS string. Never null.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • createSimple

        @Nonnull
        public static CSSExpression createSimple​(@Nonnull @Nonempty
                                                 String sValue)
        Create a CSS expression only containing a text value
        Parameters:
        sValue - The value to be wrapped in an expression
        Returns:
        The CSS expression to be used.
      • createString

        @Nonnull
        public static CSSExpression createString​(@Nonnull @Nonempty
                                                 String sValue)
        Create a CSS expression only containing a string
        Parameters:
        sValue - The value to be wrapped in a string
        Returns:
        The CSS expression to be used.
      • createNumber

        @Nonnull
        public static CSSExpression createNumber​(int nValue)
        Create a CSS expression only containing a numeric value
        Parameters:
        nValue - The value to be wrapped in an expression
        Returns:
        The CSS expression to be used.
      • createNumber

        @Nonnull
        public static CSSExpression createNumber​(long nValue)
        Create a CSS expression only containing a numeric value
        Parameters:
        nValue - The value to be wrapped in an expression
        Returns:
        The CSS expression to be used.
      • createNumber

        @Nonnull
        public static CSSExpression createNumber​(float fValue)
        Create a CSS expression only containing a numeric value
        Parameters:
        fValue - The value to be wrapped in an expression
        Returns:
        The CSS expression to be used.
      • createNumber

        @Nonnull
        public static CSSExpression createNumber​(double dValue)
        Create a CSS expression only containing a numeric value
        Parameters:
        dValue - The value to be wrapped in an expression
        Returns:
        The CSS expression to be used.
      • createURI

        @Nonnull
        public static CSSExpression createURI​(@Nonnull @Nonempty
                                              String sURI)
        Create a CSS expression only containing a URI
        Parameters:
        sURI - The URI to be wrapped in an expression
        Returns:
        The CSS expression to be used.