dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18075
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7469: Fixed test error by reverting equals/hashcode on DataElementOperand
------------------------------------------------------------
revno: 7469
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-06-30 21:25:09 +0200
message:
Fixed test error by reverting equals/hashcode on DataElementOperand
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java 2012-06-25 20:14:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java 2012-06-30 19:25:09 +0000
@@ -461,51 +461,77 @@
// -------------------------------------------------------------------------
@Override
- public boolean equals( Object o )
- {
- if ( this == o ) return true;
- if ( o == null || getClass() != o.getClass() ) return false;
-
- DataElementOperand that = (DataElementOperand) o;
-
- if ( dataElementId != that.dataElementId ) return false;
- if ( frequencyOrder != that.frequencyOrder ) return false;
- if ( id != that.id ) return false;
- if ( optionComboId != that.optionComboId ) return false;
- if ( aggregationLevels != null ? !aggregationLevels.equals( that.aggregationLevels ) : that.aggregationLevels != null )
- return false;
- if ( aggregationOperator != null ? !aggregationOperator.equals( that.aggregationOperator ) : that.aggregationOperator != null )
- return false;
- if ( categoryOptionCombo != null ? !categoryOptionCombo.equals( that.categoryOptionCombo ) : that.categoryOptionCombo != null )
- return false;
- if ( dataElement != null ? !dataElement.equals( that.dataElement ) : that.dataElement != null ) return false;
- if ( operandId != null ? !operandId.equals( that.operandId ) : that.operandId != null ) return false;
- if ( operandName != null ? !operandName.equals( that.operandName ) : that.operandName != null ) return false;
- if ( operandType != null ? !operandType.equals( that.operandType ) : that.operandType != null ) return false;
- if ( valueType != null ? !valueType.equals( that.valueType ) : that.valueType != null ) return false;
-
- return true;
- }
-
- @Override
public int hashCode()
{
- int result = id;
- result = 31 * result + (dataElement != null ? dataElement.hashCode() : 0);
- result = 31 * result + (categoryOptionCombo != null ? categoryOptionCombo.hashCode() : 0);
- result = 31 * result + dataElementId;
- result = 31 * result + optionComboId;
- result = 31 * result + (operandId != null ? operandId.hashCode() : 0);
- result = 31 * result + (operandName != null ? operandName.hashCode() : 0);
- result = 31 * result + (valueType != null ? valueType.hashCode() : 0);
- result = 31 * result + (aggregationOperator != null ? aggregationOperator.hashCode() : 0);
- result = 31 * result + (aggregationLevels != null ? aggregationLevels.hashCode() : 0);
- result = 31 * result + frequencyOrder;
- result = 31 * result + (operandType != null ? operandType.hashCode() : 0);
+ final int prime = 31;
+ int result = 1;
+
+ result = prime * result + ((categoryOptionCombo == null) ? 0 : categoryOptionCombo.hashCode());
+ result = prime * result + ((dataElement == null) ? 0 : dataElement.hashCode());
+ result = prime * result + dataElementId;
+ result = prime * result + optionComboId;
+
return result;
}
@Override
+ public boolean equals( Object object )
+ {
+ if ( this == object )
+ {
+ return true;
+ }
+
+ if ( object == null )
+ {
+ return false;
+ }
+
+ if ( getClass() != object.getClass() )
+ {
+ return false;
+ }
+
+ final DataElementOperand other = (DataElementOperand) object;
+
+ if ( dataElement == null )
+ {
+ if ( other.dataElement != null )
+ {
+ return false;
+ }
+ }
+ else if ( !dataElement.equals( other.dataElement ) )
+ {
+ return false;
+ }
+
+ if ( categoryOptionCombo == null )
+ {
+ if ( other.categoryOptionCombo != null )
+ {
+ return false;
+ }
+ }
+ else if ( !categoryOptionCombo.equals( other.categoryOptionCombo ) )
+ {
+ return false;
+ }
+
+ if ( dataElementId != other.dataElementId )
+ {
+ return false;
+ }
+
+ if ( optionComboId != other.optionComboId )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
public String toString()
{
return "DataElementOperand{" +