From 280930aa7fb661e26736cd983bba26068d96a12c Mon Sep 17 00:00:00 2001 From: top19 Date: Fri, 1 May 2020 13:01:21 +0100 Subject: [PATCH] Changed the dictionary entry's equals method so no two words of the same type and language can be added. --- .../java/uk/ac/aber/cs221/group20/json/DictionaryEntry.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/json/DictionaryEntry.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/json/DictionaryEntry.java index 705212b..98359fb 100644 --- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/json/DictionaryEntry.java +++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/json/DictionaryEntry.java @@ -99,8 +99,8 @@ public class DictionaryEntry { @Override public boolean equals(Object entry) { DictionaryEntry otherEntry = (DictionaryEntry) entry; - return otherEntry.getEnglish().equalsIgnoreCase(this.getEnglish()) && - otherEntry.getWelsh().equalsIgnoreCase(this.getWelsh()) && - otherEntry.getWordType().equals(this.getWordType()); + + return ((this.getWelsh().equalsIgnoreCase(otherEntry.getWelsh()) || this.getEnglish().equalsIgnoreCase(otherEntry.getWelsh())) && + this.getWordType().equals(otherEntry.getWordType())); } }