Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Mar 11, 2023
1 parent df5a9c1 commit c383f59
Show file tree
Hide file tree
Showing 20 changed files with 115 additions and 163 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import org.htmlunit.cssparser.parser.CSSException;
import org.htmlunit.cssparser.parser.CSSOMParser;
import org.htmlunit.cssparser.util.LangUtils;
import org.htmlunit.cssparser.util.ParserUtils;
import org.w3c.dom.DOMException;

/**
Expand Down Expand Up @@ -95,13 +95,13 @@ public boolean equals(final Object obj) {
}
final CSSCharsetRuleImpl ccr = (CSSCharsetRuleImpl) obj;
return super.equals(obj)
&& LangUtils.equals(getEncoding(), ccr.getEncoding());
&& ParserUtils.equals(getEncoding(), ccr.getEncoding());
}

@Override
public int hashCode() {
int hash = super.hashCode();
hash = LangUtils.hashCode(hash, encoding_);
hash = ParserUtils.hashCode(hash, encoding_);
return hash;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import org.htmlunit.cssparser.parser.CSSException;
import org.htmlunit.cssparser.parser.CSSOMParser;
import org.htmlunit.cssparser.util.LangUtils;
import org.htmlunit.cssparser.util.ParserUtils;
import org.w3c.dom.DOMException;

/**
Expand Down Expand Up @@ -116,13 +116,13 @@ public boolean equals(final Object obj) {
}
final CSSFontFaceRuleImpl cffr = (CSSFontFaceRuleImpl) obj;
return super.equals(obj)
&& LangUtils.equals(getStyle(), cffr.getStyle());
&& ParserUtils.equals(getStyle(), cffr.getStyle());
}

@Override
public int hashCode() {
int hash = super.hashCode();
hash = LangUtils.hashCode(hash, style_);
hash = ParserUtils.hashCode(hash, style_);
return hash;
}

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/htmlunit/cssparser/dom/CSSImportRuleImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import org.htmlunit.cssparser.parser.CSSException;
import org.htmlunit.cssparser.parser.CSSOMParser;
import org.htmlunit.cssparser.util.LangUtils;
import org.htmlunit.cssparser.util.ParserUtils;
import org.w3c.dom.DOMException;

/**
Expand Down Expand Up @@ -140,15 +140,15 @@ public boolean equals(final Object obj) {
}
final CSSImportRuleImpl cir = (CSSImportRuleImpl) obj;
return super.equals(obj)
&& LangUtils.equals(getHref(), cir.getHref())
&& LangUtils.equals(getMedia(), cir.getMedia());
&& ParserUtils.equals(getHref(), cir.getHref())
&& ParserUtils.equals(getMedia(), cir.getMedia());
}

@Override
public int hashCode() {
int hash = super.hashCode();
hash = LangUtils.hashCode(hash, href_);
hash = LangUtils.hashCode(hash, media_);
hash = ParserUtils.hashCode(hash, href_);
hash = ParserUtils.hashCode(hash, media_);
return hash;
}
}
10 changes: 5 additions & 5 deletions src/main/java/org/htmlunit/cssparser/dom/CSSMediaRuleImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import org.htmlunit.cssparser.parser.CSSException;
import org.htmlunit.cssparser.parser.CSSOMParser;
import org.htmlunit.cssparser.util.LangUtils;
import org.htmlunit.cssparser.util.ParserUtils;
import org.htmlunit.cssparser.util.ThrowCssExceptionErrorHandler;
import org.w3c.dom.DOMException;

Expand Down Expand Up @@ -196,15 +196,15 @@ public boolean equals(final Object obj) {
}
final CSSMediaRuleImpl cmr = (CSSMediaRuleImpl) obj;
return super.equals(obj)
&& LangUtils.equals(getMediaList(), cmr.getMediaList())
&& LangUtils.equals(getCssRules(), cmr.getCssRules());
&& ParserUtils.equals(getMediaList(), cmr.getMediaList())
&& ParserUtils.equals(getCssRules(), cmr.getCssRules());
}

@Override
public int hashCode() {
int hash = super.hashCode();
hash = LangUtils.hashCode(hash, mediaList_);
hash = LangUtils.hashCode(hash, cssRules_);
hash = ParserUtils.hashCode(hash, mediaList_);
hash = ParserUtils.hashCode(hash, cssRules_);
return hash;
}

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/htmlunit/cssparser/dom/CSSPageRuleImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import org.htmlunit.cssparser.parser.CSSException;
import org.htmlunit.cssparser.parser.CSSOMParser;
import org.htmlunit.cssparser.util.LangUtils;
import org.htmlunit.cssparser.util.ParserUtils;
import org.htmlunit.cssparser.util.ThrowCssExceptionErrorHandler;
import org.w3c.dom.DOMException;

Expand Down Expand Up @@ -177,15 +177,15 @@ public boolean equals(final Object obj) {
}
final CSSPageRuleImpl cpr = (CSSPageRuleImpl) obj;
return super.equals(obj)
&& LangUtils.equals(getSelectorText(), cpr.getSelectorText())
&& LangUtils.equals(getStyle(), cpr.getStyle());
&& ParserUtils.equals(getSelectorText(), cpr.getSelectorText())
&& ParserUtils.equals(getStyle(), cpr.getStyle());
}

@Override
public int hashCode() {
int hash = super.hashCode();
hash = LangUtils.hashCode(hash, pseudoPage_);
hash = LangUtils.hashCode(hash, style_);
hash = ParserUtils.hashCode(hash, pseudoPage_);
hash = ParserUtils.hashCode(hash, style_);
return hash;
}

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/htmlunit/cssparser/dom/CSSRuleListImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.ArrayList;
import java.util.List;

import org.htmlunit.cssparser.util.LangUtils;
import org.htmlunit.cssparser.util.ParserUtils;

/**
* Implementation of CSSRuleList.
Expand Down Expand Up @@ -106,7 +106,7 @@ private boolean equalsRules(final CSSRuleListImpl crl) {
int i = 0;
for (final AbstractCSSRuleImpl rule : rules_) {
final AbstractCSSRuleImpl cssRule2 = crl.rules_.get(i);
if (!LangUtils.equals(rule, cssRule2)) {
if (!ParserUtils.equals(rule, cssRule2)) {
return false;
}
i++;
Expand All @@ -116,8 +116,8 @@ private boolean equalsRules(final CSSRuleListImpl crl) {

@Override
public int hashCode() {
int hash = LangUtils.HASH_SEED;
hash = LangUtils.hashCode(hash, rules_);
int hash = ParserUtils.HASH_SEED;
hash = ParserUtils.hashCode(hash, rules_);
return hash;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import org.htmlunit.cssparser.parser.CSSErrorHandler;
import org.htmlunit.cssparser.parser.CSSOMParser;
import org.htmlunit.cssparser.util.LangUtils;
import org.htmlunit.cssparser.util.ParserUtils;
import org.htmlunit.cssparser.util.ThrowCssExceptionErrorHandler;
import org.w3c.dom.DOMException;

Expand Down Expand Up @@ -265,12 +265,12 @@ private boolean equalsProperties(final CSSStyleDeclarationImpl csd) {
// CSSValue propertyCSSValue2 = csd.getPropertyCSSValue(propertyName);
final String propertyValue1 = getPropertyValue(propertyName);
final String propertyValue2 = csd.getPropertyValue(propertyName);
if (!LangUtils.equals(propertyValue1, propertyValue2)) {
if (!ParserUtils.equals(propertyValue1, propertyValue2)) {
return false;
}
final String propertyPriority1 = getPropertyPriority(propertyName);
final String propertyPriority2 = csd.getPropertyPriority(propertyName);
if (!LangUtils.equals(propertyPriority1, propertyPriority2)) {
if (!ParserUtils.equals(propertyPriority1, propertyPriority2)) {
return false;
}
}
Expand All @@ -279,10 +279,10 @@ private boolean equalsProperties(final CSSStyleDeclarationImpl csd) {

@Override
public int hashCode() {
int hash = LangUtils.HASH_SEED;
int hash = ParserUtils.HASH_SEED;
// don't use parentRule in hashCode()
// recursive loop -> stack overflow!
hash = LangUtils.hashCode(hash, properties_);
hash = ParserUtils.hashCode(hash, properties_);
return hash;
}
}
10 changes: 5 additions & 5 deletions src/main/java/org/htmlunit/cssparser/dom/CSSStyleRuleImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.htmlunit.cssparser.parser.CSSException;
import org.htmlunit.cssparser.parser.CSSOMParser;
import org.htmlunit.cssparser.parser.selector.SelectorList;
import org.htmlunit.cssparser.util.LangUtils;
import org.htmlunit.cssparser.util.ParserUtils;
import org.w3c.dom.DOMException;

/**
Expand Down Expand Up @@ -174,15 +174,15 @@ public boolean equals(final Object obj) {
}
final CSSStyleRuleImpl csr = (CSSStyleRuleImpl) obj;
return super.equals(obj)
&& LangUtils.equals(getSelectorText(), csr.getSelectorText())
&& LangUtils.equals(getStyle(), csr.getStyle());
&& ParserUtils.equals(getSelectorText(), csr.getSelectorText())
&& ParserUtils.equals(getStyle(), csr.getStyle());
}

@Override
public int hashCode() {
int hash = super.hashCode();
hash = LangUtils.hashCode(hash, selectors_);
hash = LangUtils.hashCode(hash, style_);
hash = ParserUtils.hashCode(hash, selectors_);
hash = ParserUtils.hashCode(hash, style_);
return hash;
}
}
24 changes: 12 additions & 12 deletions src/main/java/org/htmlunit/cssparser/dom/CSSStyleSheetImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.htmlunit.cssparser.parser.media.MediaQueryList;
import org.htmlunit.cssparser.parser.selector.ElementSelector;
import org.htmlunit.cssparser.parser.selector.Selector;
import org.htmlunit.cssparser.util.LangUtils;
import org.htmlunit.cssparser.util.ParserUtils;
import org.htmlunit.cssparser.util.ThrowCssExceptionErrorHandler;
import org.w3c.dom.DOMException;
import org.w3c.dom.Node;
Expand Down Expand Up @@ -302,23 +302,23 @@ public boolean equals(final Object obj) {
return false;
}
final CSSStyleSheetImpl css = (CSSStyleSheetImpl) obj;
boolean eq = LangUtils.equals(getCssRules(), css.getCssRules());
boolean eq = ParserUtils.equals(getCssRules(), css.getCssRules());
eq = eq && (getDisabled() == css.getDisabled());
eq = eq && LangUtils.equals(getHref(), css.getHref());
eq = eq && LangUtils.equals(getMedia(), css.getMedia());
eq = eq && LangUtils.equals(getTitle(), css.getTitle());
eq = eq && ParserUtils.equals(getHref(), css.getHref());
eq = eq && ParserUtils.equals(getMedia(), css.getMedia());
eq = eq && ParserUtils.equals(getTitle(), css.getTitle());
return eq;
}

@Override
public int hashCode() {
int hash = LangUtils.HASH_SEED;
hash = LangUtils.hashCode(hash, cssRules_);
hash = LangUtils.hashCode(hash, disabled_);
hash = LangUtils.hashCode(hash, href_);
hash = LangUtils.hashCode(hash, media_);
hash = LangUtils.hashCode(hash, ownerNode_);
hash = LangUtils.hashCode(hash, title_);
int hash = ParserUtils.HASH_SEED;
hash = ParserUtils.hashCode(hash, cssRules_);
hash = ParserUtils.hashCode(hash, disabled_);
hash = ParserUtils.hashCode(hash, href_);
hash = ParserUtils.hashCode(hash, media_);
hash = ParserUtils.hashCode(hash, ownerNode_);
hash = ParserUtils.hashCode(hash, title_);
return hash;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.Iterator;
import java.util.List;

import org.htmlunit.cssparser.util.LangUtils;
import org.htmlunit.cssparser.util.ParserUtils;

/**
* Implementation of StyleSheetList.
Expand Down Expand Up @@ -94,7 +94,7 @@ private boolean equalsStyleSheets(final CSSStyleSheetListImpl ssl) {
int i = 0;
for (final CSSStyleSheetImpl styleSheet : cssStyleSheets_) {
final CSSStyleSheetImpl styleSheet2 = ssl.cssStyleSheets_.get(i);
if (!LangUtils.equals(styleSheet, styleSheet2)) {
if (!ParserUtils.equals(styleSheet, styleSheet2)) {
return false;
}
i++;
Expand All @@ -104,8 +104,8 @@ private boolean equalsStyleSheets(final CSSStyleSheetListImpl ssl) {

@Override
public int hashCode() {
int hash = LangUtils.HASH_SEED;
hash = LangUtils.hashCode(hash, cssStyleSheets_);
int hash = ParserUtils.HASH_SEED;
hash = ParserUtils.hashCode(hash, cssStyleSheets_);
return hash;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import org.htmlunit.cssparser.parser.CSSException;
import org.htmlunit.cssparser.parser.CSSOMParser;
import org.htmlunit.cssparser.util.LangUtils;
import org.htmlunit.cssparser.util.ParserUtils;
import org.w3c.dom.DOMException;

/**
Expand Down Expand Up @@ -103,13 +103,13 @@ public boolean equals(final Object obj) {
}
final CSSUnknownRuleImpl cur = (CSSUnknownRuleImpl) obj;
return super.equals(obj)
&& LangUtils.equals(getCssText(), cur.getCssText());
&& ParserUtils.equals(getCssText(), cur.getCssText());
}

@Override
public int hashCode() {
int hash = super.hashCode();
hash = LangUtils.hashCode(hash, text_);
hash = ParserUtils.hashCode(hash, text_);
return hash;
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/htmlunit/cssparser/dom/CSSValueImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import org.htmlunit.cssparser.parser.CSSOMParser;
import org.htmlunit.cssparser.parser.LexicalUnit;
import org.htmlunit.cssparser.parser.LexicalUnit.LexicalUnitType;
import org.htmlunit.cssparser.util.ParserUtils;
import org.htmlunit.cssparser.parser.LexicalUnitImpl;
import org.htmlunit.cssparser.util.LangUtils;
import org.w3c.dom.DOMException;

/**
Expand Down Expand Up @@ -515,13 +515,13 @@ public boolean equals(final Object obj) {
// TODO to be improved!
return super.equals(obj)
&& (getCssValueType() == cv.getCssValueType())
&& LangUtils.equals(getCssText(), cv.getCssText());
&& ParserUtils.equals(getCssText(), cv.getCssText());
}

@Override
public int hashCode() {
int hash = super.hashCode();
hash = LangUtils.hashCode(hash, value_);
hash = ParserUtils.hashCode(hash, value_);
return hash;
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/htmlunit/cssparser/dom/MediaListImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.htmlunit.cssparser.parser.CSSParseException;
import org.htmlunit.cssparser.parser.media.MediaQuery;
import org.htmlunit.cssparser.parser.media.MediaQueryList;
import org.htmlunit.cssparser.util.LangUtils;
import org.htmlunit.cssparser.util.ParserUtils;
import org.htmlunit.cssparser.util.ThrowCssExceptionErrorHandler;
import org.w3c.dom.DOMException;

Expand Down Expand Up @@ -137,7 +137,7 @@ private boolean equalsMedia(final MediaListImpl ml) {
for (final MediaQuery mediaQuery : mediaQueries_) {
final String m1 = mediaQuery.getMedia();
final String m2 = ml.mediaQuery(i).getMedia();
if (!LangUtils.equals(m1, m2)) {
if (!ParserUtils.equals(m1, m2)) {
return false;
}
i++;
Expand All @@ -160,7 +160,7 @@ public boolean equals(final Object obj) {
@Override
public int hashCode() {
int hash = super.hashCode();
hash = LangUtils.hashCode(hash, mediaQueries_);
hash = ParserUtils.hashCode(hash, mediaQueries_);
return hash;
}
}
Loading

0 comments on commit c383f59

Please sign in to comment.