From 686169ec504d3a26225a6ebc6c415346dc925fec Mon Sep 17 00:00:00 2001 From: serso Date: Sun, 16 Oct 2011 15:28:46 +0400 Subject: [PATCH] fix for calculator history equals --- .../calculator/CalculatorHistoryState.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/org/solovyev/android/calculator/CalculatorHistoryState.java b/src/main/java/org/solovyev/android/calculator/CalculatorHistoryState.java index 7fe27eea..f91977b6 100644 --- a/src/main/java/org/solovyev/android/calculator/CalculatorHistoryState.java +++ b/src/main/java/org/solovyev/android/calculator/CalculatorHistoryState.java @@ -51,4 +51,24 @@ public class CalculatorHistoryState extends AbstractHistoryState{ ", displayState=" + displayState + '}'; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CalculatorHistoryState that = (CalculatorHistoryState) o; + + if (!displayState.equals(that.displayState)) return false; + if (!editorState.equals(that.editorState)) return false; + + return true; + } + + @Override + public int hashCode() { + int result = editorState.hashCode(); + result = 31 * result + displayState.hashCode(); + return result; + } }