Quellcode durchsuchen

squid:UselessParenthesesCheck Useless parentheses around expressions should be removed to prevent any misunderstanding

pull/374/head
George Kankava vor 8 Jahren
Ursprung
Commit
7e2378dabf

+ 1
- 1
gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java Datei anzeigen

} else if ("input".equalsIgnoreCase(name)) { } else if ("input".equalsIgnoreCase(name)) {
InputElement ie = InputElement.as(e); InputElement ie = InputElement.as(e);
String type = ie.getType(); String type = ie.getType();
if ("radio".equalsIgnoreCase((type)) || "checkbox".equalsIgnoreCase(type)) {
if ("radio".equalsIgnoreCase(type) || "checkbox".equalsIgnoreCase(type)) {
ie.setChecked(false); ie.setChecked(false);
for (String v : values) { for (String v : values) {
if (ie.getValue().equals(v)) { if (ie.getValue().equals(v)) {

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java Datei anzeigen

} }
String val = curCSS(elem, prop, force); String val = curCSS(elem, prop, force);
if ("thick".equalsIgnoreCase(val)) { if ("thick".equalsIgnoreCase(val)) {
return (5);
return 5;
} else if ("medium".equalsIgnoreCase(val)) { } else if ("medium".equalsIgnoreCase(val)) {
return (3);
return 3;
} else if ("thin".equalsIgnoreCase(val)) { } else if ("thin".equalsIgnoreCase(val)) {
return (1);
return 1;
} }
if (!val.matches("^[\\d\\.]+.*$")) { if (!val.matches("^[\\d\\.]+.*$")) {
val = curCSS(elem, prop, false); val = curCSS(elem, prop, false);

+ 7
- 7
gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineJS.java Datei anzeigen

return null; return null;
} else { } else {
if (truth(pseudoValue.get(2))) { // odd or even if (truth(pseudoValue.get(2))) { // odd or even
start = (eq(pseudoValue.get(2), "odd")) ? 1 : 2;
start = eq(pseudoValue.get(2), "odd") ? 1 : 2;
modVal = (start == 1) ? 1 : 0; modVal = (start == 1) ? 1 : 0;
} else if (JsUtils } else if (JsUtils
.truth(pseudoValue.get(3))) { // single digit .truth(pseudoValue.get(3))) { // single digit


private static void getGeneralSiblingNodes(JsNodeArray matchingElms, private static void getGeneralSiblingNodes(JsNodeArray matchingElms,
JsObjectArray<String> nextTag, JsRegexp nextRegExp, Node prevRef) { JsObjectArray<String> nextTag, JsRegexp nextRegExp, Node prevRef) {
while (JsUtils.truth((prevRef = SelectorEngine.getNextSibling(prevRef)))
while (JsUtils.truth(prevRef = SelectorEngine.getNextSibling(prevRef))
&& !isAdded(prevRef)) { && !isAdded(prevRef)) {
if (!JsUtils.truth(nextTag) || nextRegExp if (!JsUtils.truth(nextTag) || nextRegExp
.test(prevRef.getNodeName())) { .test(prevRef.getNodeName())) {
? attributeMatch.get(3).replaceAll("\\.", "\\.") ? attributeMatch.get(3).replaceAll("\\.", "\\.")
: null; : null;
String attrVal = attrToRegExp(attributeValue, String attrVal = attrToRegExp(attributeValue,
(JsUtils.or(attributeMatch.get(2), null)));
regExpAttributes[q] = (JsUtils.truth(attrVal) ? new JsRegexp(
attrVal) : null);
JsUtils.or(attributeMatch.get(2), null));
regExpAttributes[q] = JsUtils.truth(attrVal) ? new JsRegexp(
attrVal) : null;
regExpAttributesStr[q] = attributeMatch.get(1); regExpAttributesStr[q] = attributeMatch.get(1);
} }
JsNodeArray matchingAttributeElms = JsNodeArray.create(); JsNodeArray matchingAttributeElms = JsNodeArray.create();
previous = next = previousMatch.getElement(j); previous = next = previousMatch.getElement(j);
if (previousDir) { if (previousDir) {
while (JsUtils while (JsUtils
.truth((next = SelectorEngine.getPreviousSibling(next)))
.truth(next = SelectorEngine.getPreviousSibling(next))
&& next.getNodeType() != Node.ELEMENT_NODE) { && next.getNodeType() != Node.ELEMENT_NODE) {
} }
} else { } else {
while (JsUtils.truth((next = SelectorEngine.getNextSibling(next)))
while (JsUtils.truth(next = SelectorEngine.getNextSibling(next))
&& next.getNodeType() != Node.ELEMENT_NODE) { && next.getNodeType() != Node.ELEMENT_NODE) {
} }
} }

+ 1
- 1
gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsObjectArray.java Datei anzeigen

public JsObjectArray<T> add(T... vals) { public JsObjectArray<T> add(T... vals) {
for (T t : vals) { for (T t : vals) {
if (t instanceof Number) { if (t instanceof Number) {
c().putNumber(length(), (((Number) t).doubleValue()));
c().putNumber(length(), ((Number) t).doubleValue());
} else if (t instanceof Boolean) { } else if (t instanceof Boolean) {
c().putBoolean(length(), (Boolean) t); c().putBoolean(length(), (Boolean) t);
} else { } else {

+ 1
- 1
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/MousePlugin.java Datei anzeigen

unbindOtherEvents(); unbindOtherEvents();
if (started) { if (started) {
started = false; started = false;
preventClickEvent = (event.getCurrentEventTarget() == startEvent.getCurrentEventTarget());
preventClickEvent = event.getCurrentEventTarget() == startEvent.getCurrentEventTarget();
mouseStop(element, event); mouseStop(element, event);
} }



+ 2
- 2
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/UiPlugin.java Datei anzeigen

@Override @Override
protected boolean scrollParentPositionTest(UiPlugin gQueryUi) { protected boolean scrollParentPositionTest(UiPlugin gQueryUi) {
String position = gQueryUi.css("position", false); String position = gQueryUi.css("position", false);
return ("absolute".equals(position) || "relative".equals(position) || "static"
.equals(position));
return "absolute".equals(position) || "relative".equals(position) || "static"
.equals(position);
} }
} }



+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/ClipAnimation.java Datei anzeigen

return; return;
} }
if (currentAction == Action.HIDE) { if (currentAction == Action.HIDE) {
progress = (1 - progress);
progress = 1 - progress;
} }
int w = g.outerWidth(); int w = g.outerWidth();
int h = g.outerHeight(); int h = g.outerHeight();
left = (w - right) / 2; left = (w - right) / 2;
} }
if (corner == Corner.TOP_RIGHT || corner == Corner.BOTTOM_RIGHT) { if (corner == Corner.TOP_RIGHT || corner == Corner.BOTTOM_RIGHT) {
left = (w - right);
left = w - right;
right = w; right = w;
} }
if (corner == Corner.BOTTOM_LEFT || corner == Corner.BOTTOM_RIGHT) { if (corner == Corner.BOTTOM_LEFT || corner == Corner.BOTTOM_RIGHT) {
top = (h - bottom);
top = h - bottom;
bottom = h; bottom = h;
} }



+ 1
- 1
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/Fx.java Datei anzeigen

} }


public void applyValue(GQuery g, double progress) { public void applyValue(GQuery g, double progress) {
double ret = (start + ((end - start) * progress));
double ret = start + ((end - start) * progress);
String val = ("px".equals(unit) ? ((int) ret) : ret) + unit; String val = ("px".equals(unit) ? ((int) ret) : ret) + unit;
if ("scrollTop".equals(cssprop)) { if ("scrollTop".equals(cssprop)) {
g.scrollTop((int) ret); g.scrollTop((int) ret);

+ 2
- 2
gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsniBundleGenerator.java Datei anzeigen

if (isJS) if (isJS)
out = "\n"; out = "\n";
} else if (isCComment) { } else if (isCComment) {
isSlash = isCComment = !(isJS = (last == '*' && c == '/'));
isSlash = isCComment = !(isJS = last == '*' && c == '/');
if (isJS) if (isJS)
out = ""; out = "";
} else if (isRegex) { } else if (isRegex) {
isJS = !(isSlash = isRegex = (last == '\\' || c != '/'));
isJS = !(isSlash = isRegex = last == '\\' || c != '/');
if (isJS) { if (isJS) {
String mod = ""; String mod = "";
while (++i < l) { while (++i < l) {

+ 1
- 1
gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsonBuilderGenerator.java Datei anzeigen



public boolean isTypeAssignableTo(JType t, JClassType o) { public boolean isTypeAssignableTo(JType t, JClassType o) {
JClassType c = t.isClassOrInterface(); JClassType c = t.isClassOrInterface();
return (c != null && c.isAssignableTo(o));
return c != null && c.isAssignableTo(o);
} }


private void generateCreateMethod(SourceWriter sw, TreeLogger logger) { private void generateCreateMethod(SourceWriter sw, TreeLogger logger) {

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/rebind/SelectorGeneratorXPath.java Datei anzeigen

return null; return null;
} else { } else {
if (notNull(pseudoValue.group(2))) { // odd or even if (notNull(pseudoValue.group(2))) { // odd or even
start = ("odd".equals(pseudoValue.group(2))) ? 1 : 2;
start = "odd".equals(pseudoValue.group(2)) ? 1 : 2;
modVal = (start == 1) ? 1 : 0; modVal = (start == 1) ? 1 : 0;
} else if (notNull(pseudoValue.group(3))) { // single digit } else if (notNull(pseudoValue.group(3))) { // single digit
start = Integer.parseInt(pseudoValue.group(3), 10); start = Integer.parseInt(pseudoValue.group(3), 10);
} else if ("nth".equals(pseudo[0])) { } else if ("nth".equals(pseudo[0])) {
if (!pseudoValue.matches("^n$")) { if (!pseudoValue.matches("^n$")) {
String position = String position =
(("last".equals(pseudo[1])) ? "(count(following-sibling::"
: "(count(preceding-sibling::") + tag + ") + 1)";
"last".equals(pseudo[1]) ? "(count(following-sibling::"
: "(count(preceding-sibling::" + tag + ") + 1)";
Sequence sequence = getSequence(pseudoValue); Sequence sequence = getSequence(pseudoValue);
if (sequence != null) { if (sequence != null) {
if (sequence.start == sequence.max) { if (sequence.start == sequence.max) {

+ 1
- 1
gwtquery-core/src/main/java/com/google/gwt/query/rebind/XmlBuilderGenerator.java Datei anzeigen



public boolean isTypeAssignableTo(JType t, JClassType o) { public boolean isTypeAssignableTo(JType t, JClassType o) {
JClassType c = t.isClassOrInterface(); JClassType c = t.isClassOrInterface();
return (c != null && c.isAssignableTo(o));
return c != null && c.isAssignableTo(o);
} }


public void generateMethod(SourceWriter sw, JMethod method, TreeLogger logger) public void generateMethod(SourceWriter sw, JMethod method, TreeLogger logger)

Laden…
Abbrechen
Speichern