@NotThreadSafe public abstract class AbstractHasTopLevelRules extends Object
| Modifier and Type | Field and Description |
|---|---|
protected com.helger.commons.collection.impl.ICommonsList<ICSSTopLevelRule> |
m_aRules |
| Constructor and Description |
|---|
AbstractHasTopLevelRules() |
| Modifier and Type | Method and Description |
|---|---|
AbstractHasTopLevelRules |
addRule(ICSSTopLevelRule aRule)
Add a new top-level rule at the end.
|
AbstractHasTopLevelRules |
addRule(int nIndex,
ICSSTopLevelRule aRule)
Add a new top-level rule at the specified index.
|
com.helger.commons.collection.impl.ICommonsList<CSSFontFaceRule> |
getAllFontFaceRules()
Get a list of all top-level rules that are font-face rules (implementing
CSSFontFaceRule). |
com.helger.commons.collection.impl.ICommonsList<CSSKeyframesRule> |
getAllKeyframesRules()
Get a list of all top-level rules that are keyframes rules (implementing
CSSKeyframesRule). |
com.helger.commons.collection.impl.ICommonsList<CSSMediaRule> |
getAllMediaRules()
Get a list of all top-level rules that are media rules (implementing
CSSMediaRule). |
com.helger.commons.collection.impl.ICommonsList<CSSPageRule> |
getAllPageRules()
Get a list of all top-level rules that are page rules (implementing
CSSPageRule). |
com.helger.commons.collection.impl.ICommonsList<ICSSTopLevelRule> |
getAllRules()
Get a copy of all contained top-level rules.
|
com.helger.commons.collection.impl.ICommonsList<ICSSTopLevelRule> |
getAllRules(Predicate<? super ICSSTopLevelRule> aFilter)
Get a copy of all contained top-level rules.
|
com.helger.commons.collection.impl.ICommonsList<CSSStyleRule> |
getAllStyleRules()
Get a list of all top-level rules that are style rules (implementing
CSSStyleRule). |
com.helger.commons.collection.impl.ICommonsList<CSSSupportsRule> |
getAllSupportsRules()
Get a list of all top-level rules that are support rules (implementing
CSSSupportsRule). |
com.helger.commons.collection.impl.ICommonsList<CSSUnknownRule> |
getAllUnknownRules()
Get a list of all top-level rules that are unknown rules (implementing
CSSUnknownRule). |
com.helger.commons.collection.impl.ICommonsList<CSSViewportRule> |
getAllViewportRules()
Get a list of all top-level rules that are viewport rules (implementing
CSSViewportRule). |
CSSFontFaceRule |
getFontFaceRuleAtIndex(int nIndex)
Get the
@font-face rule at the specified index. |
int |
getFontFaceRuleCount()
Get the number of top-level rules that are font-face rules (implementing
CSSFontFaceRule). |
CSSKeyframesRule |
getKeyframesRuleAtIndex(int nIndex)
Get the
@keyframes rule at the specified index. |
int |
getKeyframesRuleCount()
Get the number of top-level rules that are keyframes rules (implementing
CSSKeyframesRule). |
CSSMediaRule |
getMediaRuleAtIndex(int nIndex)
Get the
@media rule at the specified index. |
int |
getMediaRuleCount()
Get the number of top-level rules that are media rules (implementing
CSSMediaRule). |
CSSPageRule |
getPageRuleAtIndex(int nIndex)
Get the
@page rule at the specified index. |
int |
getPageRuleCount()
Get the number of top-level rules that are page rules (implementing
CSSPageRule). |
ICSSTopLevelRule |
getRule(int nIndex)
Deprecated.
Use
getRuleAtIndex(int) instead |
ICSSTopLevelRule |
getRuleAtIndex(int nIndex)
Get the top-level rule at the specified index.
|
int |
getRuleCount()
Get the number of total contained top-level rules.
|
CSSStyleRule |
getStyleRuleAtIndex(int nIndex)
Get the style rule at the specified index.
|
int |
getStyleRuleCount()
Get the number of top-level rules that are style rules (implementing
CSSStyleRule). |
CSSSupportsRule |
getSupportsRuleAtIndex(int nIndex)
Get the
@supports rule at the specified index. |
int |
getSupportsRuleCount()
Get the number of top-level rules that are support rules (implementing
CSSSupportsRule). |
CSSUnknownRule |
getUnknownRuleAtIndex(int nIndex)
Get the unknown rule at the specified index.
|
int |
getUnknownRuleCount()
Get the number of top-level rules that are unknown rules (implementing
CSSUnknownRule). |
CSSViewportRule |
getViewportRuleAtIndex(int nIndex)
Get the
@viewport rule at the specified index. |
int |
getViewportRuleCount()
Get the number of top-level rules that are viewport rules (implementing
CSSViewportRule). |
boolean |
hasFontFaceRules()
Check if at least one of the top-level rules is a font-face rule
(implementing
CSSFontFaceRule). |
boolean |
hasKeyframesRules()
Check if at least one of the top-level rules is a keyframes rule
(implementing
CSSKeyframesRule). |
boolean |
hasMediaRules()
Check if at least one of the top-level rules is a media rule (implementing
CSSMediaRule). |
boolean |
hasPageRules()
Check if at least one of the top-level rules is a page rule (implementing
CSSPageRule). |
boolean |
hasRules()
Check if any top-level rule.
|
boolean |
hasStyleRules()
Check if at least one of the top-level rules is a style rule (implementing
CSSStyleRule). |
boolean |
hasSupportsRules()
Check if at least one of the top-level rules is a supports rule
(implementing
CSSSupportsRule). |
boolean |
hasUnknownRules()
Check if at least one of the top-level rules is an unknown rule
(implementing
CSSUnknownRule). |
boolean |
hasViewportRules()
Check if at least one of the top-level rules is a viewport rule
(implementing
CSSViewportRule). |
com.helger.commons.state.EChange |
removeAllRules()
Remove all top-level rules.
|
com.helger.commons.state.EChange |
removeRule(ICSSTopLevelRule aRule)
Remove the specified top-level rule.
|
com.helger.commons.state.EChange |
removeRule(int nRuleIndex)
Remove the rule at the specified index.
|
com.helger.commons.state.EChange |
removeRules(Predicate<? super ICSSTopLevelRule> aFilter)
Remove all rules matching the passed predicate.
|
protected final com.helger.commons.collection.impl.ICommonsList<ICSSTopLevelRule> m_aRules
public boolean hasRules()
@import and @namespace rules!true if at least one top-level rule is present,
false if otherwise.@Nonnegative public int getRuleCount()
@import and
@namespace rules!@Nullable @Deprecated public ICSSTopLevelRule getRule(@Nonnegative int nIndex)
getRuleAtIndex(int) insteadnIndex - The index to be resolved. Should be ≥ 0 and <
getRuleCount().null if an invalid index was specified.@Nullable public ICSSTopLevelRule getRuleAtIndex(@Nonnegative int nIndex)
nIndex - The index to be resolved. Should be ≥ 0 and <
getRuleCount().null if an invalid index was specified.@Nonnull public AbstractHasTopLevelRules addRule(@Nonnull ICSSTopLevelRule aRule)
@import and @namespace rules!aRule - The rule to be added. May not be null.@Nonnull public AbstractHasTopLevelRules addRule(@Nonnegative int nIndex, @Nonnull ICSSTopLevelRule aRule)
@import and @namespace
rules!nIndex - The index where the top-level rule should be added. Must be ≥ 0.aRule - The rule to be added. May not be null.@Nonnull public com.helger.commons.state.EChange removeRule(@Nullable ICSSTopLevelRule aRule)
@import and @namespace rules!aRule - The rule to be removed. May be null.EChange.CHANGED if the rule was successfully removed,
EChange.UNCHANGED otherwise. Never null.@Nonnull public com.helger.commons.state.EChange removeRule(@Nonnegative int nRuleIndex)
@import and @namespace
rules!nRuleIndex - The index of the rule to be removed. Should be ≥ 0.EChange.CHANGED if the rule at the specified index was
successfully removed, EChange.UNCHANGED otherwise. Never
null.@Nonnull public com.helger.commons.state.EChange removeRules(@Nonnull Predicate<? super ICSSTopLevelRule> aFilter)
aFilter - The predicate to apply for deletion. May not be null.EChange.CHANGED it at least one rule was removed,
EChange.UNCHANGED otherwise.@Nonnull public com.helger.commons.state.EChange removeAllRules()
EChange.CHANGED if any rule was removed,
EChange.UNCHANGED otherwise. Never null.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<ICSSTopLevelRule> getAllRules()
@import and @namespace
rules!null.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<ICSSTopLevelRule> getAllRules(@Nonnull Predicate<? super ICSSTopLevelRule> aFilter)
@import and @namespace
rules!aFilter - The predicate to be appliednull.public boolean hasStyleRules()
CSSStyleRule).true if at least one style rule is contained,
false otherwise.@Nonnegative public int getStyleRuleCount()
CSSStyleRule).@Nullable public CSSStyleRule getStyleRuleAtIndex(@Nonnegative int nIndex)
nIndex - The index to be resolved. Should be ≥ 0 and <
getStyleRuleCount().null if an invalid index was specified.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<CSSStyleRule> getAllStyleRules()
CSSStyleRule).null.public boolean hasPageRules()
CSSPageRule).true if at least one @page rule is
contained, false otherwise.@Nonnegative public int getPageRuleCount()
CSSPageRule).@page rules. Always ≥ 0.@Nullable public CSSPageRule getPageRuleAtIndex(@Nonnegative int nIndex)
@page rule at the specified index.nIndex - The index to be resolved. Should be ≥ 0 and <
getPageRuleCount().null if an invalid index was specified.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<CSSPageRule> getAllPageRules()
CSSPageRule).@page rules. Never
null.public boolean hasMediaRules()
CSSMediaRule).true if at least one @media rule is
contained, false otherwise.@Nonnegative public int getMediaRuleCount()
CSSMediaRule).@media rules. Always ≥ 0.@Nullable public CSSMediaRule getMediaRuleAtIndex(@Nonnegative int nIndex)
@media rule at the specified index.nIndex - The index to be resolved. Should be ≥ 0 and <
getMediaRuleCount().null if an invalid index was specified.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<CSSMediaRule> getAllMediaRules()
CSSMediaRule).@media rules. Never
null.public boolean hasFontFaceRules()
CSSFontFaceRule).true if at least one @font-face rule is
contained, false otherwise.@Nonnegative public int getFontFaceRuleCount()
CSSFontFaceRule).@font-face rules. Always ≥
0.@Nullable public CSSFontFaceRule getFontFaceRuleAtIndex(@Nonnegative int nIndex)
@font-face rule at the specified index.nIndex - The index to be resolved. Should be ≥ 0 and <
getFontFaceRuleCount().null if an invalid index was specified.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<CSSFontFaceRule> getAllFontFaceRules()
CSSFontFaceRule).@font-face rules. Never
null.public boolean hasKeyframesRules()
CSSKeyframesRule).true if at least one @keyframes rule is
contained, false otherwise.@Nonnegative public int getKeyframesRuleCount()
CSSKeyframesRule).@keyframes rules. Always ≥
0.@Nullable public CSSKeyframesRule getKeyframesRuleAtIndex(@Nonnegative int nIndex)
@keyframes rule at the specified index.nIndex - The index to be resolved. Should be ≥ 0 and <
getKeyframesRuleCount().null if an invalid index was specified.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<CSSKeyframesRule> getAllKeyframesRules()
CSSKeyframesRule).@keyframes rules. Never
null.public boolean hasViewportRules()
CSSViewportRule).true if at least one @viewport rule is
contained, false otherwise.@Nonnegative public int getViewportRuleCount()
CSSViewportRule).@viewport rules. Always ≥
0.@Nullable public CSSViewportRule getViewportRuleAtIndex(@Nonnegative int nIndex)
@viewport rule at the specified index.nIndex - The index to be resolved. Should be ≥ 0 and <
getViewportRuleCount().null if an invalid index was specified.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<CSSViewportRule> getAllViewportRules()
CSSViewportRule).@viewport rules. Never
null.public boolean hasSupportsRules()
CSSSupportsRule).true if at least one @supports rule is
contained, false otherwise.@Nonnegative public int getSupportsRuleCount()
CSSSupportsRule).@supports rules. Always ≥
0.@Nullable public CSSSupportsRule getSupportsRuleAtIndex(@Nonnegative int nIndex)
@supports rule at the specified index.nIndex - The index to be resolved. Should be ≥ 0 and <
getSupportsRuleCount().null if an invalid index was specified.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<CSSSupportsRule> getAllSupportsRules()
CSSSupportsRule).@supports rules. Never
null.public boolean hasUnknownRules()
CSSUnknownRule).true if at least one unknown @ rule is
contained, false otherwise.@Nonnegative public int getUnknownRuleCount()
CSSUnknownRule).@ rules. Always ≥
0.@Nullable public CSSUnknownRule getUnknownRuleAtIndex(@Nonnegative int nIndex)
nIndex - The index to be resolved. Should be ≥ 0 and <
getUnknownRuleCount().null if an invalid index was specified.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<CSSUnknownRule> getAllUnknownRules()
CSSUnknownRule).@ rules. Never
null.Copyright © 2014–2022 Philip Helger. All rights reserved.