From 85f31f5615d0bf4701df0f59f449aad4f590ff03 Mon Sep 17 00:00:00 2001 From: Igor Bochkor Date: Wed, 24 Mar 2021 15:05:05 +0200 Subject: [PATCH 1/3] added solution LongMapImpl with tests --- pom.xml | 16 +- .../opensource/longmap/LongMapImpl.java | 147 +++++++++- .../opensource/longmap/LongMapImplTest.java | 139 ++++++++++ target/checkstyle-cachefile | 2 + target/checkstyle-checker.xml | 250 ++++++++++++++++++ target/checkstyle-result.xml | 24 ++ .../comparus/opensource/longmap/LongMap.class | Bin 0 -> 586 bytes .../opensource/longmap/LongMapImpl$Node.class | Bin 0 -> 1805 bytes .../opensource/longmap/LongMapImpl.class | Bin 0 -> 5301 bytes .../opensource/longmap/LongMapImplTest.class | Bin 0 -> 4730 bytes .../compile/default-compile/createdFiles.lst | 4 + .../compile/default-compile/inputFiles.lst | 3 + 12 files changed, 575 insertions(+), 10 deletions(-) create mode 100644 src/main/java/de/comparus/opensource/longmap/LongMapImplTest.java create mode 100644 target/checkstyle-cachefile create mode 100644 target/checkstyle-checker.xml create mode 100644 target/checkstyle-result.xml create mode 100644 target/classes/de/comparus/opensource/longmap/LongMap.class create mode 100644 target/classes/de/comparus/opensource/longmap/LongMapImpl$Node.class create mode 100644 target/classes/de/comparus/opensource/longmap/LongMapImpl.class create mode 100644 target/classes/de/comparus/opensource/longmap/LongMapImplTest.class create mode 100644 target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst diff --git a/pom.xml b/pom.xml index 36c092b..88d2c48 100644 --- a/pom.xml +++ b/pom.xml @@ -18,8 +18,8 @@ 3.3 UTF-8 - 1.8 - 1.8 + 9 + 9 @@ -27,10 +27,16 @@ - junit - junit - 4.12 + org.junit.jupiter + junit-jupiter-engine + 5.4.0 test + + org.junit.jupiter + junit-jupiter-api + 5.4.0 + compile + diff --git a/src/main/java/de/comparus/opensource/longmap/LongMapImpl.java b/src/main/java/de/comparus/opensource/longmap/LongMapImpl.java index 2f0b54b..1de694a 100644 --- a/src/main/java/de/comparus/opensource/longmap/LongMapImpl.java +++ b/src/main/java/de/comparus/opensource/longmap/LongMapImpl.java @@ -1,43 +1,180 @@ package de.comparus.opensource.longmap; +import java.util.Objects; + public class LongMapImpl implements LongMap { + + private static final int DEFAULT_INITIAL_CAPACITY = 16; + private static final int DEFAULT_INCREASE_CAPACITY = 2; + private static final float DEFAULT_LOAD_FACTOR = 0.75F; + private int size; + private float threshold; + private Node[] table; + + public LongMapImpl() { + threshold = (int) (DEFAULT_INITIAL_CAPACITY * DEFAULT_LOAD_FACTOR); + table = new Node[DEFAULT_INITIAL_CAPACITY]; + } + + private static class Node { + private V value; + private long key; + private Node next; + + public Node(V value, long key, Node next) { + this.value = value; + this.key = key; + this.next = next; + } + } + public V put(long key, V value) { - return null; + if (threshold < size) { + resize(); + } + Node[] currentTable = table; + int index = getIndex(key); + if (currentTable[index] == null) { + currentTable[index] = new Node<>(value, key, null); + size++; + return value; + } + + Node currentNode = currentTable[index]; + while (currentNode.next != null || key == currentNode.key) { + if (key == currentNode.key) { + currentNode.value = value; + return value; + } + currentNode = currentNode.next; + } + + currentNode.next = new Node<>(value, key, null); + size++; + + return value; } public V get(long key) { + Node currentNode = table[getIndex(key)]; + while (currentNode != null) { + if (key == currentNode.key) { + return currentNode.value; + } + currentNode = currentNode.next; + } return null; } public V remove(long key) { + int index = getIndex(key); + if (isEmpty() || table[index] == null) { + return null; + } + Node currentNode = table[index]; + if (currentNode.key == key) { + table[index] = currentNode.next; + size--; + return currentNode.value; + } + while (currentNode.next != null) { + if (currentNode.next.key == key) { + V value = currentNode.next.value; + currentNode.next = currentNode.next.next; + size--; + return value; + } + currentNode = currentNode.next; + } return null; } public boolean isEmpty() { - return false; + return size == 0; } public boolean containsKey(long key) { + Node currentNode = table[getIndex(key)]; + while (currentNode != null) { + if (key == currentNode.key) { + return true; + } + currentNode = currentNode.next; + } return false; } public boolean containsValue(V value) { + Node[] currentTable = table; + for (Node vNode : currentTable) { + Node currentNode = vNode; + while (currentNode != null) { + if (Objects.equals(value, currentNode.value)) { + return true; + } + currentNode = currentNode.next; + } + } return false; } public long[] keys() { - return null; + Node[] currentTable = table; + long[] keysArray = new long[size]; + int k = 0; + for (Node vNode : currentTable) { + Node currentNode = vNode; + while (currentNode != null) { + keysArray[k++] = currentNode.key; + currentNode = currentNode.next; + } + } + return keysArray; } public V[] values() { - return null; + Node[] currentTable = table; + V[] valuesArray = (V[]) new Object[size]; + int k = 0; + for (Node vNode : currentTable) { + Node currentNode = vNode; + while (currentNode != null) { + valuesArray[k++] = currentNode.value; + currentNode = currentNode.next; + } + } + return valuesArray; } public long size() { - return 0; + return size; } public void clear() { + Node[] currentTable = table; + if (currentTable != null && size > 0) { + size = 0; + for (int i = 0; i < currentTable.length; i++) { + currentTable[i] = null; + } + } + } + + private int getIndex(long key) { + return (int) Math.abs(key % table.length); + } + private void resize() { + Node[] oldTable = table; + size = 0; + table = new Node[oldTable.length * DEFAULT_INCREASE_CAPACITY]; + threshold = table.length * DEFAULT_LOAD_FACTOR; + for (int i = 0; i < oldTable.length; i++) { + Node nodeOld = oldTable[i]; + while (nodeOld != null) { + put(nodeOld.key, nodeOld.value); + nodeOld = nodeOld.next; + } + } } } diff --git a/src/main/java/de/comparus/opensource/longmap/LongMapImplTest.java b/src/main/java/de/comparus/opensource/longmap/LongMapImplTest.java new file mode 100644 index 0000000..62c038a --- /dev/null +++ b/src/main/java/de/comparus/opensource/longmap/LongMapImplTest.java @@ -0,0 +1,139 @@ +package de.comparus.opensource.longmap; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class LongMapImplTest { + + @Test + public void testMethodSize_Ok() { + LongMap map = new LongMapImpl<>(); + map.put(1L, "First"); + assertEquals(1, map.size()); + map.put(2L, "Second"); + assertEquals(2, map.size()); + map.put(17L, "Third"); + assertEquals(3, map.size()); + map.put(-100L, "Forth"); + assertEquals(4, map.size()); + } + + @Test + public void testMethodPut_Ok() { + LongMap map = new LongMapImpl<>(); + assertEquals("first", map.put(20L, "first")); + assertEquals("second", map.put(120L, "second")); + assertEquals("third", map.put(-120L, "third")); + assertEquals("forth", map.put(0L, "forth")); + assertEquals("fifth", map.put(1L, "fifth")); + assertEquals("One hundred", map.put(8L, "One hundred")); + } + + @Test + public void testMethodPutForCorrectWorkSameKey_Ok() { + LongMap map = new LongMapImpl<>(); + assertEquals(10, map.put(100L, 10)); + assertEquals(20, map.put(100L, 20)); + assertEquals(-10020, map.put(100L, -10020)); + assertNull(map.put(100L, null)); + } + + @Test + public void testMethodGet_Ok() { + LongMap map = new LongMapImpl<>(); + assertEquals(map.put(20L, "first"), map.get(20L)); + assertEquals(map.put(-20L, "second"), map.get(-20L)); + assertEquals(map.put(120L, "third"), map.get(120L)); + assertEquals(map.put(220L, null), map.get(220L)); + assertNull(map.get(-123L)); + } + + @Test + public void testMethodRemove_Ok() { + LongMap map = new LongMapImpl<>(); + assertEquals(map.put(20L, "first"), map.remove(20L)); + assertEquals(map.put(-20L, "second"), map.remove(-20L)); + assertEquals(map.put(120L, "third"), map.remove(120L)); + assertNull(map.remove(120L)); + assertEquals(map.put(220L, null), map.remove(220L)); + assertNull(map.remove(-11220L)); + map.put(20L, "first"); + map.put(52L, "second"); + assertEquals(map.put(36L, "third"), map.remove(36L)); + } + + @Test + public void testMethodIsEmpty_Ok() { + LongMap map = new LongMapImpl<>(); + assertTrue(map.isEmpty()); + map.put(10L, "value"); + assertFalse(map.isEmpty()); + } + + @Test + public void testMethodClear_Ok() { + LongMap map = new LongMapImpl<>(); + map.clear(); + assertEquals(0, map.size()); + map.put(10L, 1); + map.put(1L, 10); + assertNotEquals(0, map.size()); + map.clear(); + assertEquals(0, map.size()); + } + + @Test + public void testMethodContainKey_Ok() { + LongMap map = new LongMapImpl<>(); + map.put(0L, 0); + assertTrue(map.containsKey(0)); + assertFalse(map.containsKey(1000L)); + } + + @Test + public void testMethodContainValue_Ok() { + LongMap map = new LongMapImpl<>(); + map.put(100L, "One"); + assertTrue(map.containsValue("One")); + assertFalse(map.containsValue("Three")); + } + + @Test + public void testMethodKeys_Ok() { + LongMap map = new LongMapImpl<>(); + map.put(20L, "first"); + map.put(36L, "first"); + map.put(19L, "first"); + map.put(-20L, "second"); + map.put(120L, "third"); + map.put(220L, null); + long[] expected = new long[]{19L, 20L, 36L, -20L, 120L, 220L}; + long[] actual = map.keys(); + Assertions.assertArrayEquals(expected, actual); + } + + @Test + public void testMethodValues_Ok() { + LongMap map = new LongMapImpl<>(); + Integer[] expected = new Integer[10]; + for (int i = 0; i < 10; i++) { + map.put(i, i); + expected[i] = i; + } + Assertions.assertArrayEquals(expected, map.values()); + } + + @Test + public void testForResize_Ok() { + LongMap map = new LongMapImpl<>(); + for (int i = 0; i < 10000; i++) { + map.put(i, i); + } + assertEquals(10000, map.size()); + } +} diff --git a/target/checkstyle-cachefile b/target/checkstyle-cachefile new file mode 100644 index 0000000..664eea0 --- /dev/null +++ b/target/checkstyle-cachefile @@ -0,0 +1,2 @@ +#Wed Mar 24 14:42:55 EET 2021 +configuration*?=A0C24151AC5414A17DDEB9D7E8BA4CC711435AB9 diff --git a/target/checkstyle-checker.xml b/target/checkstyle-checker.xml new file mode 100644 index 0000000..ea0a529 --- /dev/null +++ b/target/checkstyle-checker.xml @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/target/checkstyle-result.xml b/target/checkstyle-result.xml new file mode 100644 index 0000000..e2ce08b --- /dev/null +++ b/target/checkstyle-result.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/target/classes/de/comparus/opensource/longmap/LongMap.class b/target/classes/de/comparus/opensource/longmap/LongMap.class new file mode 100644 index 0000000000000000000000000000000000000000..5267d14a5a0a1ec7192d93b21cc369e7c13d16a3 GIT binary patch literal 586 zcmZvZxlY4C7=&koW0MQQVeYGfb%QG!g6NqQNVS-i<={&`B85kz-~o6j#P0=C z#1yOD`84zIX!rB${R6-SP7E9wIA&N%%YxyIJHv^X3Of|BZ$CUwq*n~AI$~&z0zVc- znMpcx=g}Qlv}lemX^zRAe^WYfWz#bmB~!{8L4FgZ#f*~NdSd8!NnD5^&hI2Kjr;_A zf6x_SNgDrb#VEiDh;Xg*b;Sknuo$dqy! z_?3HE&tBINLwl5znI~_9kY;syYAcVJ?XbA8b&sQ-AJ@MEe04{HCl|1@=$}euEC7tL7U4)V~1XQ zEsA7oH573yV-1Vd9qIawdQ-GIvD;|MC~kCGzI4Mzv|ATVx61X6Xs*?pVNq3J>1SDU zmWgPEi9^dl6tq_~ye{>VSkGFuQm&EJYQk!)8borVQ{R@YEwLRYGBtb=)^EB*~vNOt@p+P@juj9sxs_~NxH0C`y zuCe4TX?T~tM*oqP`%Mb(;z=)0_4<5)URiH#`2xzG2trX`W(PTterdV(ykC};eiKF7 zOg_a|fx6Fye?G(oH34i`7`AZ`p4b!!6Vu$!v1S@S&NYqC6O`JG zVw_Pag_*)IJI&IgfVx~&OwRcZ<105h!;!E7*(e}(8bDYC!sMH{)l1fU$@-UbCEq5_ zv~wj97qFc9_ta-_@2P~QmG))>3wP9M5XD{G8(8QJ5`zly_*kfj`#m}*TAYFBlolkA VO8Ni~6Y?dDaaE${@R*00{|jK|r-T3i literal 0 HcmV?d00001 diff --git a/target/classes/de/comparus/opensource/longmap/LongMapImpl.class b/target/classes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>4&YnIQ(h0afbRf)1vw zlPOCwC0#x>vu?V^E7B#9rz+B=xoZCC)MZhsArqM_VXmSx$kJ@0opf?0Odq`2Ngd(M zK6sZchv+UJnsRKP#w`d__|pRGQ|Od4VI*S9VzzU7ZURIt5Z$mM5i7 zrP+z7!Lxy&m-us+*3VXj7#QlzYlUD}2QOh7a z!Vn!`h`Je+9){>3%ivLl=nyWT7uWGoyo^4+tRM4*?6w=Sn-w7wNM*>p+GRj$)41qyATf#7B#NW7N2(pI{e~?KPc@c%3=zIz3A7HIqE{J5fXSV`P66>v?uJ@gUtv?t96( zhv#}9PxWDP^wf;FYWgeG2&A(AbXUz4M@`aIQxo*K*R0}@C`%FXUdOHo^b@3doagzI zJR(l;fOyJBE$LEwpn{q}Dyhx=2WmW|;(boqh4EOx;ub&bm=)AAq^6VF9Lsi|)E52= zYLzuGFR3YER#=ExT6Ux6omzG~*{>U6_dBm1Vap>-*s`C6?KJLmtoqH`nIPwk&4jq( z*i02$b8M!XGskAaoHI6~(tB)}<@30Lk*-}U81PER?$aDaFH&@#ub%=B>LOo6XV{en zzbZ;tf{Dv0<0{Tt!RWMwxOuwdfm5`CzPGUOstnL+86f} zkO7KC-a`9u@L+2!as#c&*5y{W%DP&GJ#jUt+ Date: Wed, 24 Mar 2021 15:09:47 +0200 Subject: [PATCH 2/3] fixed checkstyle --- .gitignore | 5 +++-- src/main/java/de/comparus/opensource/longmap/LongMap.java | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index a870eaf..4f94b89 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -.idea/ -long-map.iml \ No newline at end of file +.idea/* +*.iml +target/* \ No newline at end of file diff --git a/src/main/java/de/comparus/opensource/longmap/LongMap.java b/src/main/java/de/comparus/opensource/longmap/LongMap.java index adbf242..4612631 100644 --- a/src/main/java/de/comparus/opensource/longmap/LongMap.java +++ b/src/main/java/de/comparus/opensource/longmap/LongMap.java @@ -2,16 +2,22 @@ public interface LongMap { V put(long key, V value); + V get(long key); + V remove(long key); boolean isEmpty(); + boolean containsKey(long key); + boolean containsValue(V value); long[] keys(); + V[] values(); long size(); + void clear(); } From 1791f01fb9dc7a37a377c6ee1202e005e0a75ef7 Mon Sep 17 00:00:00 2001 From: Igor Bochkor Date: Wed, 24 Mar 2021 15:13:17 +0200 Subject: [PATCH 3/3] added solution --- target/checkstyle-cachefile | 2 - target/checkstyle-checker.xml | 250 ------------------ target/checkstyle-result.xml | 24 -- .../comparus/opensource/longmap/LongMap.class | Bin 586 -> 0 bytes .../opensource/longmap/LongMapImpl$Node.class | Bin 1805 -> 0 bytes .../opensource/longmap/LongMapImpl.class | Bin 5301 -> 0 bytes .../opensource/longmap/LongMapImplTest.class | Bin 4730 -> 0 bytes .../compile/default-compile/createdFiles.lst | 4 - .../compile/default-compile/inputFiles.lst | 3 - 9 files changed, 283 deletions(-) delete mode 100644 target/checkstyle-cachefile delete mode 100644 target/checkstyle-checker.xml delete mode 100644 target/checkstyle-result.xml delete mode 100644 target/classes/de/comparus/opensource/longmap/LongMap.class delete mode 100644 target/classes/de/comparus/opensource/longmap/LongMapImpl$Node.class delete mode 100644 target/classes/de/comparus/opensource/longmap/LongMapImpl.class delete mode 100644 target/classes/de/comparus/opensource/longmap/LongMapImplTest.class delete mode 100644 target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst delete mode 100644 target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst diff --git a/target/checkstyle-cachefile b/target/checkstyle-cachefile deleted file mode 100644 index 664eea0..0000000 --- a/target/checkstyle-cachefile +++ /dev/null @@ -1,2 +0,0 @@ -#Wed Mar 24 14:42:55 EET 2021 -configuration*?=A0C24151AC5414A17DDEB9D7E8BA4CC711435AB9 diff --git a/target/checkstyle-checker.xml b/target/checkstyle-checker.xml deleted file mode 100644 index ea0a529..0000000 --- a/target/checkstyle-checker.xml +++ /dev/null @@ -1,250 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/target/checkstyle-result.xml b/target/checkstyle-result.xml deleted file mode 100644 index e2ce08b..0000000 --- a/target/checkstyle-result.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/target/classes/de/comparus/opensource/longmap/LongMap.class b/target/classes/de/comparus/opensource/longmap/LongMap.class deleted file mode 100644 index 5267d14a5a0a1ec7192d93b21cc369e7c13d16a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 586 zcmZvZxlY4C7=&koW0MQQVeYGfb%QG!g6NqQNVS-i<={&`B85kz-~o6j#P0=C z#1yOD`84zIX!rB${R6-SP7E9wIA&N%%YxyIJHv^X3Of|BZ$CUwq*n~AI$~&z0zVc- znMpcx=g}Qlv}lemX^zRAe^WYfWz#bmB~!{8L4FgZ#f*~NdSd8!NnD5^&hI2Kjr;_A zf6x_SNgDrb#VEiDh;Xg*b;Sknuo$dqy! z_?3HE&tBINLwl5znI~_9kY;syYAcVJ?XbA8b&sQ-AJ@MEe04{HCl|1@=$}euEC7tL7U4)V~1XQ zEsA7oH573yV-1Vd9qIawdQ-GIvD;|MC~kCGzI4Mzv|ATVx61X6Xs*?pVNq3J>1SDU zmWgPEi9^dl6tq_~ye{>VSkGFuQm&EJYQk!)8borVQ{R@YEwLRYGBtb=)^EB*~vNOt@p+P@juj9sxs_~NxH0C`y zuCe4TX?T~tM*oqP`%Mb(;z=)0_4<5)URiH#`2xzG2trX`W(PTterdV(ykC};eiKF7 zOg_a|fx6Fye?G(oH34i`7`AZ`p4b!!6Vu$!v1S@S&NYqC6O`JG zVw_Pag_*)IJI&IgfVx~&OwRcZ<105h!;!E7*(e}(8bDYC!sMH{)l1fU$@-UbCEq5_ zv~wj97qFc9_ta-_@2P~QmG))>3wP9M5XD{G8(8QJ5`zly_*kfj`#m}*TAYFBlolkA VO8Ni~6Y?dDaaE${@R*00{|jK|r-T3i diff --git a/target/classes/de/comparus/opensource/longmap/LongMapImpl.class b/target/classes/de/comparus/opensource/longmap/LongMapImpl.class deleted file mode 100644 index 9998a5561f49a1a4307368c1cd87ab178b02cc42..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5301 zcmbtX{Zmxe8Gi2Wy?cS(l@CQ(qM|K@WdT8|q*)Y21O)-DAXH6iR@lhOvWvS5iAjt} zi$-HVrcIlf+9We|+Myq&wbK}#wxPe7nf}u0On>Sh(3y7nTYqUBEq&f|?tY}uDWoIb zk8|Jip7(v;=Y7uE-~a2^ivV`xjS^H~+{T32wI3*k3sD=-$^D#MCQEpU$>n?rEKJEI zE|+P!B;=Bm%Z!*@C_xHo8<`T!V$R%0hcf)UjTa1YAdsKaeY~e@ zxF+XGKh5SMFvrvnM_5~lgapm0V@+Z8|PTt>4Ax8 z%Xo5nCX$*>wd^Bw1()p=Y-(eX@2!}1}f zITgLgdh`?gIjO6Gij~ZKVE>A_dpNGlJgMk(a*ny%v2@S$OooWC{HG+p zWFixZCDKO(C6o3X^k)ZEBZ&Luh>4vwr(y8~B_0l##G3RlgAJ#Ncd@*6rBV@kcFBM- zWn+j8RCSDI|nYw;O8}l^Rv@t?=^rEo{Hb|AnXz!)ZJ%i(mBNMZDz0%edsjE4b{#t9Z?aui&db zbmO3nc^|IeDntLzmb3A?57%(rhgR$~P`A2(3>;d4QT?j~H7|*xUnP<8@n||-+uGV{ zU?RA7A8VeGUvsCdx$9G`Nt$NkZfk8bFt&Cd%Q?BC0%VtIm1VyBDVAAXMGI>3f8g0B zc=oJ4$Q3g$S6rRV#Ny8OK*8}uFU&^be5hZ6e=8tLNn4kv{9q(AN!^T`RT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