Class CSSMediaQuery

    • Constructor Detail

      • CSSMediaQuery

        public CSSMediaQuery​(@Nullable
                             String sMedium)
        Constructor without a modifier. This implicitly uses the modifier CSSMediaQuery.EModifier.NONE.
        Parameters:
        sMedium - The medium to use. May be null.
    • Method Detail

      • getMedium

        @Nullable
        public final String getMedium()
        Returns:
        The medium passed in the constructor.
      • hasMediaExpressions

        public boolean hasMediaExpressions()
        Returns:
        true if at least a single media expression is present.
      • getMediaExpressionCount

        @Nonnegative
        public int getMediaExpressionCount()
        Returns:
        The number of contained media expressions. Always ≥ 0.
      • addMediaExpression

        @Nonnull
        public CSSMediaQuery addMediaExpression​(@Nonnull
                                                CSSMediaExpression aMediaExpression)
        Append a media expression to the list.
        Parameters:
        aMediaExpression - The media expression to be added. May not be null.
        Returns:
        this
      • addMediaExpression

        @Nonnull
        public CSSMediaQuery addMediaExpression​(@Nonnegative
                                                int nIndex,
                                                @Nonnull
                                                CSSMediaExpression aMediaExpression)
        Add a media expression to the list at the specified index.
        Parameters:
        nIndex - The index where the media expression should be added. Must be ≥ 0.
        aMediaExpression - The media expression to be added. May not be null.
        Returns:
        this
      • removeMediaExpression

        @Nonnull
        public com.helger.commons.state.EChange removeMediaExpression​(@Nullable
                                                                      CSSMediaExpression aMediaExpression)
        Remove the specified media expression.
        Parameters:
        aMediaExpression - The media expression to be removed. May be null.
        Returns:
        EChange.CHANGED if removal succeeded, EChange.UNCHANGED otherwise.
      • removeMediaExpression

        @Nonnull
        public com.helger.commons.state.EChange removeMediaExpression​(int nExpressionIndex)
        Remove the media expression at the specified index.
        Parameters:
        nExpressionIndex - The index of the media expression to be removed.
        Returns:
        EChange.CHANGED if removal succeeded, EChange.UNCHANGED otherwise.
      • removeAllMediaExpressions

        @Nonnull
        public com.helger.commons.state.EChange removeAllMediaExpressions()
        Remove all media expressions.
        Returns:
        EChange.CHANGED if any media expression was removed, EChange.UNCHANGED otherwise. Never null.
        Since:
        3.7.3
      • getMediaExpression

        @Nullable
        public CSSMediaExpression getMediaExpression​(@Nonnegative
                                                     int nExpressionIndex)
        Get the media expression at the specified index.
        Parameters:
        nExpressionIndex - The index to be retrieved.
        Returns:
        null if the index is < 0 or too large.
      • getAllMediaExpressions

        @Nonnull
        @ReturnsMutableCopy
        public com.helger.commons.collection.impl.ICommonsList<CSSMediaExpression> getAllMediaExpressions()
        Returns:
        A copy of all media expression. Never null but maybe empty.
      • getAsCSSString

        @Nonnull
        @Nonempty
        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