diff --git a/.idea/misc.xml b/.idea/misc.xml index 2928d94..81a8e88 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/sonarlint/issuestore/1/9/193b3ae25de434658a4cf27a0f8ff1b51b55c917 b/.idea/sonarlint/issuestore/1/9/193b3ae25de434658a4cf27a0f8ff1b51b55c917 new file mode 100644 index 0000000..450f972 --- /dev/null +++ b/.idea/sonarlint/issuestore/1/9/193b3ae25de434658a4cf27a0f8ff1b51b55c917 @@ -0,0 +1,12 @@ + + +java:S2293'"YReplace the type specification in this constructor call with the diamond operator ("<>").(׭J$2fc8fdb7-38bf-416f-a7e9-19dbc6f60d92 + +java:S2293("YReplace the type specification in this constructor call with the diamond operator ("<>").(˕J$0cf6149e-a925-498e-bbc8-300c765f724f + java:S116&"QRename this field "m_text" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(J$6bea55b7-8f40-43ac-a655-df806422fe91 + java:S116'"URename this field "m_imageIDs" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(׭J$f48b20d0-7b36-4cc8-bf6c-a022facb0647 + java:S116("VRename this field "m_observers" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(˕J$de27668a-341b-4cee-bcc1-ab8c6ceab429 + +java:S2975v"SRemove this "clone" implementation; use a copy constructor or copy factory instead.(ɯJ$39e6ce9a-d2bc-49de-9ca1-9b5c3576b1b1 + +java:S1182v"HUse super.clone() to create and seed the cloned instance to be returned.(ɯJ$e2a0af5f-4c1f-48c1-ab1c-e3dc3cf60199 \ No newline at end of file diff --git a/.idea/sonarlint/issuestore/b/7/b79817ce84d43cb3143d5887c490c98da970041f b/.idea/sonarlint/issuestore/b/7/b79817ce84d43cb3143d5887c490c98da970041f new file mode 100644 index 0000000..110de79 --- /dev/null +++ b/.idea/sonarlint/issuestore/b/7/b79817ce84d43cb3143d5887c490c98da970041f @@ -0,0 +1,45 @@ + +k +java:S3740"/Provide the parametrized type for this generic.(陑mJ$a72ed1ca-0da6-4a9c-bd0e-cec15c4a90d3 + +java:S22934"YReplace the type specification in this constructor call with the diamond operator ("<>").(dzJ$f403846e-9626-49fb-8d25-1c57015994b6 + +java:S22939"YReplace the type specification in this constructor call with the diamond operator ("<>").(㺺J$605c48bf-f700-480e-9442-7a8ef78a6e4a + +java:S2293<"YReplace the type specification in this constructor call with the diamond operator ("<>").(J$002cfb44-08ac-4d44-bccd-acc26904ad19 + +java:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").(ÝJ$843b1ba6-6b1c-4e36-bc84-0df07545e175 + +java:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").(施J$15648219-c006-4aed-92f0-cecbe7b1d8c2 + +java:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").(ҩJ$00e5f4b3-4a6f-40e5-8b71-b2dc763dac3c + +java:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").(ĂJ$6adbc6cf-88f9-4eb2-b42d-8150ed23c714 + +java:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").(J$8a1efa43-909a-4f5b-ab00-6210bae919df + +java:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").(琳J$84fb6d0d-fcae-4013-8873-d551956e3a36 + +java:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").(敊J$2521cd78-3b46-4d13-be9d-995548d236c0 + +java:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").(ӹJ$c656b2f1-2c22-421a-86d0-71bbff66f61f + +java:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").( J$c6fbd952-b679-4490-81d1-52aa1c92d090 + +java:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").( J$8953cb1a-e913-4ca1-9539-08889bff5707 + java:S1164"VRename this field "m_observers" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(dzJ$20a3c03c-a8fc-4c10-9502-a5664a0960ce + java:S1166"QRename this field "m_name" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(˜J$5d0b01e9-7c7a-4ef6-83e6-33bbebcc3912 + java:S1167"RRename this field "m_depth" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ӲJ$922f87d4-c008-468a-8d49-09353b78c532 + java:S1169"RRename this field "m_decks" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(㺺J$433fb6d2-e2c6-403d-8425-337c470f955b + java:S116;"SRename this field "m_parent" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(J$5094618c-bb9a-46fd-a626-c919fe2ce592 + java:S116<"\Rename this field "m_childCategories" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(J$583d5b56-e148-4584-aab2-9c17023f05ff +s +java:S11353"2Complete the task associated to this TODO comment.(ӨJ$06881fcc-66a6-492c-b8db-fe8ce1693c3a +7 +java:S3626i"Remove this redundant jump.(T81 +j +java:S4274"(Replace this assert with a proper check.(J$ff8319ee-24ee-4b3a-9266-22d964a57b1f +n +java:S1135"2Complete the task associated to this TODO comment.(;J$387d7d65-364b-4b93-8363-f676dc64e849 +m +java:S1905"+Remove this unnecessary cast to "Category".(ƒJ$79d6e09b-69ad-4c26-b71c-515cd63ab471 \ No newline at end of file diff --git a/.idea/sonarlint/issuestore/e/0/e0125022dc09c660aafc07a7948c7339e74c7849 b/.idea/sonarlint/issuestore/e/0/e0125022dc09c660aafc07a7948c7339e74c7849 index d77a355..4ebe358 100644 --- a/.idea/sonarlint/issuestore/e/0/e0125022dc09c660aafc07a7948c7339e74c7849 +++ b/.idea/sonarlint/issuestore/e/0/e0125022dc09c660aafc07a7948c7339e74c7849 @@ -1,40 +1,40 @@  -java:S2293T"YReplace the type specification in this constructor call with the diamond operator ("<>").(J$5eff9514-7ccc-461b-883e-42575676f751 - java:S116Q"ZRename this field "m_formattedText" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(æJ$d3e81dbd-9122-47ff-a0e8-bba0debfcdad - java:S116R"\Rename this field "m_unformattedText" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ůJ$c38e0fd9-0d01-4656-a98f-8e89f583ed28 +java:S2293T"YReplace the type specification in this constructor call with the diamond operator ("<>").(J$e00d9708-bfdf-4e0b-9ccc-0396679db444 + java:S116Q"ZRename this field "m_formattedText" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(æJ$99b98ac9-6865-43ce-938d-b861c735adcc + java:S116R"\Rename this field "m_unformattedText" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ůJ$6f416013-d90d-4d67-a713-2ea32a294be0  -java:S65484"A Singleton implementation was detected. Make sure the use of the Singleton pattern is required and the implementation is the right one for the context.(ʇJ$421b4411-e09c-405e-9b57-23d7088c1e42 +java:S65484"A Singleton implementation was detected. Make sure the use of the Singleton pattern is required and the implementation is the right one for the context.(ʇJ$fd20f931-f152-4552-84d8-cf7eef35a213  -java:S1149"_Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder".(҉J$fe0f9947-cdd3-41fe-901c-2cc361662258 +java:S1149"_Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder".(҉J$2fefea8c-0356-4ee9-9cfc-8c658d331567  -java:S1149"_Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder".(҉J$55ae796e-072d-4ee6-b500-cacf6b07834c +java:S1149"_Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder".(҉J$f81fe692-2500-4f4a-9787-5819f97020b0  -java:S1149"_Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder".(J$a39501ec-b4f3-4c02-ad8c-4f4e17737b46 +java:S1149"_Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder".(J$2d261956-769d-4391-a683-bb4876a8d8a3 s -java:S1135>"2Complete the task associated to this TODO comment.(J$e2a2e11d-c9fc-41b8-8746-d1086703a17e +java:S1135>"2Complete the task associated to this TODO comment.(J$570ef38f-551f-418b-9302-3ac59631895c s -java:S1135?"2Complete the task associated to this TODO comment.(J$9025e44f-ebe5-4d92-90ab-e12722f2e410 +java:S1135?"2Complete the task associated to this TODO comment.(J$816931a2-ab3c-423a-b7d5-47302074b18a n -java:S1135@"2Complete the task associated to this TODO comment.(J$37a92402-6014-4d1b-ae67-aa3bcacb4596 +java:S1135@"2Complete the task associated to this TODO comment.(J$b35889d7-b23c-46c0-8a0f-ffac5510b826 n -java:S1135A"2Complete the task associated to this TODO comment.(J$09335e37-1c77-4c50-bf41-7bf5e5791936 -| java:S125M" deck : m_decks) { + for (Card card : deck) { + String existingFrontText = card.getFrontSide().getText().getUnformatted(); + String existingBackText = card.getBackSide().getText().getUnformatted(); + if (existingFrontText.equals(frontText) && existingBackText.equals(backText)) { + return true; // Identical card already exists + } + } + } + + return false; // No identical card found + } + public void addCard(Card card) { - addCard(card, 0); + if (checkForIdenticalCard(card.getFrontSide(),card.getBackSide())) { + addCard(card, 0); + }else return; + + } /** diff --git a/src/jmemorize/core/FormattedText.java b/src/jmemorize/core/FormattedText.java index 9561241..98af227 100644 --- a/src/jmemorize/core/FormattedText.java +++ b/src/jmemorize/core/FormattedText.java @@ -332,7 +332,7 @@ private static String getFormattedText(Element e, int startSelection, return sb.toString(); } - + //seif private static String escape(String text) { return text.replaceALL("<", "<").replaceALL(">", ">");