Skip to content

Commit af7f6bf

Browse files
committed
javadoc fixes, source cleanup
1 parent b693250 commit af7f6bf

19 files changed

+232
-50
lines changed

checkstyle_suppressions.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
"http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
66

77
<suppressions>
8-
<suppress checks="JavadocPackage" files=".*[\\/]src[\\/](test)[\\/]"/>
8+
<suppress checks="JavadocPackage" files=".*[\\/]src[\\/]test"/>
9+
<suppress checks="JavadocMethod" files=".*[\\/]src[\\/]test"/>
10+
<suppress checks="LineLength" files=".*[\\/]src[\\/]test"/>
911
<suppress checks="Header" files=".+.properties"/>
1012

13+
<suppress checks="." files=".*[\\/]target[\\/]generated-sources[\\/]javacc"/>
1114
<suppress checks="." files="CssCharStream.java"/>
1215
</suppressions>

src/main/java/com/gargoylesoftware/css/dom/AbstractCSSRuleImpl.java

+34-15
Original file line numberDiff line numberDiff line change
@@ -26,35 +26,54 @@ public abstract class AbstractCSSRuleImpl extends AbstractLocatable implements S
2626
private CSSStyleSheetImpl parentStyleSheet_;
2727
private AbstractCSSRuleImpl parentRule_;
2828

29-
protected CSSStyleSheetImpl getParentStyleSheetImpl() {
30-
return parentStyleSheet_;
29+
/**
30+
* Ctor.
31+
* @param parentStyleSheet the parent style sheet
32+
* @param parentRule the parent rule
33+
*/
34+
public AbstractCSSRuleImpl(final CSSStyleSheetImpl parentStyleSheet, final AbstractCSSRuleImpl parentRule) {
35+
super();
36+
setParentStyleSheet(parentStyleSheet);
37+
setParentRule(parentRule);
3138
}
3239

40+
/**
41+
* @return the current css text
42+
*/
43+
public abstract String getCssText();
44+
45+
/**
46+
* Sets the css text.
47+
* @param text the new css text
48+
*/
49+
public abstract void setCssText(String text);
50+
51+
/**
52+
* Sets the parent style sheet.
53+
* @param parentStyleSheet the new parent style sheet
54+
*/
3355
public void setParentStyleSheet(final CSSStyleSheetImpl parentStyleSheet) {
3456
parentStyleSheet_ = parentStyleSheet;
3557
}
3658

59+
/**
60+
* Sets the parent rule.
61+
* @param parentRule the new parent rule
62+
*/
3763
public void setParentRule(final AbstractCSSRuleImpl parentRule) {
3864
parentRule_ = parentRule;
3965
}
4066

41-
public AbstractCSSRuleImpl(final CSSStyleSheetImpl parentStyleSheet, final AbstractCSSRuleImpl parentRule) {
42-
super();
43-
parentStyleSheet_ = parentStyleSheet;
44-
parentRule_ = parentRule;
45-
}
46-
47-
public AbstractCSSRuleImpl() {
48-
super();
49-
}
50-
51-
public abstract String getCssText();
52-
public abstract void setCssText(String text);
53-
67+
/**
68+
* @return the parent style sheet
69+
*/
5470
public CSSStyleSheetImpl getParentStyleSheet() {
5571
return parentStyleSheet_;
5672
}
5773

74+
/**
75+
* @return the parent rule
76+
*/
5877
public AbstractCSSRuleImpl getParentRule() {
5978
return parentRule_;
6079
}

src/main/java/com/gargoylesoftware/css/dom/CSSCharsetRuleImpl.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,13 @@ public CSSCharsetRuleImpl(
4141
encoding_ = encoding;
4242
}
4343

44+
/**
45+
* Sets the css text.
46+
* @param cssText the new css text
47+
* @throws DOMException in case of error
48+
*/
4449
public void setCssText(final String cssText) throws DOMException {
45-
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheetImpl();
50+
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
4651
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
4752
throw new DOMExceptionImpl(
4853
DOMException.NO_MODIFICATION_ALLOWED_ERR,

src/main/java/com/gargoylesoftware/css/dom/CSSFontFaceRuleImpl.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,13 @@ public String getCssText() {
5252
return sb.toString();
5353
}
5454

55+
/**
56+
* Sets the css text.
57+
* @param cssText the new css text
58+
* @throws DOMException in case of error
59+
*/
5560
public void setCssText(final String cssText) throws DOMException {
56-
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheetImpl();
61+
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
5762
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
5863
throw new DOMExceptionImpl(
5964
DOMException.NO_MODIFICATION_ALLOWED_ERR,

src/main/java/com/gargoylesoftware/css/dom/CSSImportRuleImpl.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,13 @@ public String getCssText() {
7272
return sb.toString();
7373
}
7474

75+
/**
76+
* Sets the css text.
77+
* @param cssText the new css text
78+
* @throws DOMException in case of error
79+
*/
7580
public void setCssText(final String cssText) throws DOMException {
76-
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheetImpl();
81+
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
7782
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
7883
throw new DOMExceptionImpl(
7984
DOMException.NO_MODIFICATION_ALLOWED_ERR,

src/main/java/com/gargoylesoftware/css/dom/CSSMediaRuleImpl.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,13 @@ public String getCssText() {
6969
return sb.toString();
7070
}
7171

72+
/**
73+
* Sets the css text.
74+
* @param cssText the new css text
75+
* @throws DOMException in case of error
76+
*/
7277
public void setCssText(final String cssText) throws DOMException {
73-
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheetImpl();
78+
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
7479
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
7580
throw new DOMExceptionImpl(
7681
DOMException.NO_MODIFICATION_ALLOWED_ERR,
@@ -119,7 +124,7 @@ public CSSRuleListImpl getCssRules() {
119124
}
120125

121126
public int insertRule(final String rule, final int index) throws DOMException {
122-
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheetImpl();
127+
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
123128
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
124129
throw new DOMExceptionImpl(
125130
DOMException.NO_MODIFICATION_ALLOWED_ERR,
@@ -159,7 +164,7 @@ public int insertRule(final String rule, final int index) throws DOMException {
159164
}
160165

161166
public void deleteRule(final int index) throws DOMException {
162-
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheetImpl();
167+
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
163168
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
164169
throw new DOMExceptionImpl(
165170
DOMException.NO_MODIFICATION_ALLOWED_ERR,
@@ -220,7 +225,7 @@ private void readObject(final ObjectInputStream in)
220225
for (int i = 0; i < cssRules_.getLength(); i++) {
221226
final AbstractCSSRuleImpl cssRule = cssRules_.getRules().get(i);
222227
cssRule.setParentRule(this);
223-
cssRule.setParentStyleSheet(getParentStyleSheetImpl());
228+
cssRule.setParentStyleSheet(getParentStyleSheet());
224229
}
225230
}
226231
media_ = (MediaListImpl) in.readObject();

src/main/java/com/gargoylesoftware/css/dom/CSSPageRuleImpl.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,13 @@ public String getCssText() {
6464
return sb.toString();
6565
}
6666

67+
/**
68+
* Sets the css text.
69+
* @param cssText the new css text
70+
* @throws DOMException in case of error
71+
*/
6772
public void setCssText(final String cssText) throws DOMException {
68-
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheetImpl();
73+
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
6974
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
7075
throw new DOMExceptionImpl(
7176
DOMException.NO_MODIFICATION_ALLOWED_ERR,

src/main/java/com/gargoylesoftware/css/dom/CSSRuleListImpl.java

+23-1
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,48 @@ public class CSSRuleListImpl implements Serializable {
2929

3030
private List<AbstractCSSRuleImpl> rules_ = new ArrayList<AbstractCSSRuleImpl>();
3131

32+
/**
33+
* @return the rules
34+
*/
3235
public List<AbstractCSSRuleImpl> getRules() {
3336
return rules_;
3437
}
3538

39+
/**
40+
* Ctor.
41+
*/
3642
public CSSRuleListImpl() {
3743
super();
3844
}
3945

46+
/**
47+
* @return the number of rules
48+
*/
4049
public int getLength() {
4150
return getRules().size();
4251
}
4352

53+
/**
54+
* Add a rule.
55+
* @param rule the rule to be added
56+
*/
4457
public void add(final AbstractCSSRuleImpl rule) {
4558
getRules().add(rule);
4659
}
4760

61+
/**
62+
* Insert a rule at the given pos.
63+
* @param rule the rule to be inserted
64+
* @param index the insert pos
65+
*/
4866
public void insert(final AbstractCSSRuleImpl rule, final int index) {
4967
getRules().add(index, rule);
5068
}
5169

70+
/**
71+
* Delete the rule at the given pos.
72+
* @param index the delete pos
73+
*/
5274
public void delete(final int index) {
5375
getRules().remove(index);
5476
}
@@ -81,7 +103,7 @@ private boolean equalsRules(final CSSRuleListImpl crl) {
81103
if ((crl == null) || (getLength() != crl.getLength())) {
82104
return false;
83105
}
84-
int i = 0;;
106+
int i = 0;
85107
for (AbstractCSSRuleImpl rule : rules_) {
86108
final AbstractCSSRuleImpl cssRule2 = crl.rules_.get(i);
87109
if (!LangUtils.equals(rule, cssRule2)) {

src/main/java/com/gargoylesoftware/css/dom/CSSStyleDeclarationImpl.java

+5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ public String getCssText() {
7171
return sb.toString();
7272
}
7373

74+
/**
75+
* Sets the css text.
76+
* @param cssText the new css text
77+
* @throws DOMException in case of error
78+
*/
7479
public void setCssText(final String cssText) throws DOMException {
7580
try {
7681
final InputSource is = new InputSource(new StringReader(cssText));

src/main/java/com/gargoylesoftware/css/dom/CSSStyleRuleImpl.java

+41-8
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,33 @@ public class CSSStyleRuleImpl extends AbstractCSSRuleImpl {
3535
private SelectorList selectors_;
3636
private CSSStyleDeclarationImpl style_;
3737

38+
/**
39+
* Ctor.
40+
* @param parentStyleSheet the parent style sheet
41+
* @param parentRule the parent rule
42+
* @param selectors the selectors
43+
*/
44+
public CSSStyleRuleImpl(final CSSStyleSheetImpl parentStyleSheet,
45+
final AbstractCSSRuleImpl parentRule, final SelectorList selectors) {
46+
super(parentStyleSheet, parentRule);
47+
setSelectors(selectors);
48+
}
49+
50+
/**
51+
* @return all selectors
52+
*/
3853
public SelectorList getSelectors() {
3954
return selectors_;
4055
}
4156

57+
/**
58+
* Updates the selectors.
59+
* @param selectors the new selectors
60+
*/
4261
public void setSelectors(final SelectorList selectors) {
4362
selectors_ = selectors;
4463
}
4564

46-
public CSSStyleRuleImpl(final CSSStyleSheetImpl parentStyleSheet,
47-
final AbstractCSSRuleImpl parentRule, final SelectorList selectors) {
48-
super(parentStyleSheet, parentRule);
49-
selectors_ = selectors;
50-
}
51-
5265
/**
5366
* {@inheritDoc}
5467
*/
@@ -68,8 +81,13 @@ public String getCssText() {
6881
return selectorText + " { " + styleText + " }";
6982
}
7083

84+
/**
85+
* Sets the css text.
86+
* @param cssText the new css text
87+
* @throws DOMException in case of error
88+
*/
7189
public void setCssText(final String cssText) throws DOMException {
72-
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheetImpl();
90+
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
7391
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
7492
throw new DOMExceptionImpl(
7593
DOMException.NO_MODIFICATION_ALLOWED_ERR,
@@ -106,12 +124,20 @@ public void setCssText(final String cssText) throws DOMException {
106124
}
107125
}
108126

127+
/**
128+
* @return the selector text
129+
*/
109130
public String getSelectorText() {
110131
return selectors_.toString();
111132
}
112133

134+
/**
135+
* Sets the selector text.
136+
* @param selectorText the new selector text
137+
* @throws DOMException in clase of error
138+
*/
113139
public void setSelectorText(final String selectorText) throws DOMException {
114-
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheetImpl();
140+
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
115141
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
116142
throw new DOMExceptionImpl(
117143
DOMException.NO_MODIFICATION_ALLOWED_ERR,
@@ -137,10 +163,17 @@ public void setSelectorText(final String selectorText) throws DOMException {
137163
}
138164
}
139165

166+
/**
167+
* @return the style
168+
*/
140169
public CSSStyleDeclarationImpl getStyle() {
141170
return style_;
142171
}
143172

173+
/**
174+
* Replaces the style.
175+
* @param style the new style
176+
*/
144177
public void setStyle(final CSSStyleDeclarationImpl style) {
145178
style_ = style;
146179
}

src/main/java/com/gargoylesoftware/css/dom/CSSStyleSheetImpl.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -354,27 +354,26 @@ public static class CSSStyleSheetRuleIndex {
354354

355355
private static final class SelectorIndex {
356356

357-
private final Map<String, List<SelectorEntry>> keyToSelectors = new HashMap<>();
357+
private final Map<String, List<SelectorEntry>> keyToSelectors_ = new HashMap<>();
358358

359359
void add(final String key, final SelectorEntry selector) {
360-
List<SelectorEntry> entry = keyToSelectors.get(key);
360+
List<SelectorEntry> entry = keyToSelectors_.get(key);
361361
if (entry == null) {
362362
entry = new ArrayList<SelectorEntry>();
363-
keyToSelectors.put(key, entry);
363+
keyToSelectors_.put(key, entry);
364364
}
365365
entry.add(selector);
366366
}
367367

368368
List<SelectorEntry> get(final String key) {
369-
List<SelectorEntry> entry = keyToSelectors.get(key);
369+
final List<SelectorEntry> entry = keyToSelectors_.get(key);
370370
if (entry == null) {
371371
return Collections.emptyList();
372372
}
373373
return entry;
374374
}
375375
}
376376

377-
378377
private static final MediaListImpl DEFAULT_MEDIA_LIST = new MediaListImpl(null);
379378

380379
private final List<CSSStyleSheetRuleIndex> children_ = new ArrayList<>();

src/main/java/com/gargoylesoftware/css/dom/CSSStyleSheetListImpl.java

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public List<CSSStyleSheetImpl> getCSSStyleSheets() {
3838
return cssStyleSheets_;
3939
}
4040

41+
/**
42+
* @return the number of style sheets
43+
*/
4144
public int getLength() {
4245
return getCSSStyleSheets().size();
4346
}
@@ -94,6 +97,7 @@ private boolean equalsStyleSheets(final CSSStyleSheetListImpl ssl) {
9497
if (!LangUtils.equals(styleSheet, styleSheet2)) {
9598
return false;
9699
}
100+
i++;
97101
}
98102
return true;
99103
}

0 commit comments

Comments
 (0)