Replaced ternary expression with ObjectUtils.equals(), and reformatted using IDE.

Former-commit-id: e72ba88f6e4d29cb00288c34a9d413e455f26b16
This commit is contained in:
Dale Visser
2015-06-24 15:38:03 -04:00
parent e6707c65a5
commit 888f2aed97

View File

@@ -48,9 +48,9 @@ public class Evidence implements Serializable, Comparable<Evidence> {
/** /**
* Creates a new Evidence objects. * Creates a new Evidence objects.
* *
* @param source the source of the evidence. * @param source the source of the evidence.
* @param name the name of the evidence. * @param name the name of the evidence.
* @param value the value of the evidence. * @param value the value of the evidence.
* @param confidence the confidence of the evidence. * @param confidence the confidence of the evidence.
*/ */
public Evidence(String source, String name, String value, Confidence confidence) { public Evidence(String source, String name, String value, Confidence confidence) {
@@ -59,6 +59,7 @@ public class Evidence implements Serializable, Comparable<Evidence> {
this.value = value; this.value = value;
this.confidence = confidence; this.confidence = confidence;
} }
/** /**
* The name of the evidence. * The name of the evidence.
*/ */
@@ -81,6 +82,7 @@ public class Evidence implements Serializable, Comparable<Evidence> {
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
/** /**
* The source of the evidence. * The source of the evidence.
*/ */
@@ -103,6 +105,7 @@ public class Evidence implements Serializable, Comparable<Evidence> {
public void setSource(String source) { public void setSource(String source) {
this.source = source; this.source = source;
} }
/** /**
* The value of the evidence. * The value of the evidence.
*/ */
@@ -137,6 +140,7 @@ public class Evidence implements Serializable, Comparable<Evidence> {
public void setValue(String value) { public void setValue(String value) {
this.value = value; this.value = value;
} }
/** /**
* A value indicating if the Evidence has been "used" (aka read). * A value indicating if the Evidence has been "used" (aka read).
*/ */
@@ -159,6 +163,7 @@ public class Evidence implements Serializable, Comparable<Evidence> {
public void setUsed(boolean used) { public void setUsed(boolean used) {
this.used = used; this.used = used;
} }
/** /**
* The confidence level for the evidence. * The confidence level for the evidence.
*/ */
@@ -213,8 +218,10 @@ public class Evidence implements Serializable, Comparable<Evidence> {
} }
final Evidence e = (Evidence) that; final Evidence e = (Evidence) that;
return StringUtils.equalsIgnoreCase(name, e.name) && StringUtils.equalsIgnoreCase(source, e.source) && StringUtils.equalsIgnoreCase(value, e.value) return StringUtils.equalsIgnoreCase(name, e.name)
&& (confidence == null ? e.confidence == null : confidence == e.confidence); && StringUtils.equalsIgnoreCase(source, e.source)
&& StringUtils.equalsIgnoreCase(value, e.value)
&& ObjectUtils.equals(confidence, e.confidence);
} }
/** /**
@@ -250,7 +257,7 @@ public class Evidence implements Serializable, Comparable<Evidence> {
* Wrapper around {@link java.lang.String#compareToIgnoreCase(java.lang.String) String.compareToIgnoreCase} with an * Wrapper around {@link java.lang.String#compareToIgnoreCase(java.lang.String) String.compareToIgnoreCase} with an
* exhaustive, possibly duplicative, check against nulls. * exhaustive, possibly duplicative, check against nulls.
* *
* @param me the value to be compared * @param me the value to be compared
* @param other the other value to be compared * @param other the other value to be compared
* @return true if the values are equal; otherwise false * @return true if the values are equal; otherwise false
*/ */