diff options
author | Pacien TRAN-GIRARD | 2014-05-03 19:06:37 +0200 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2014-05-03 19:06:37 +0200 |
commit | 0a845d99117e4d4186d5be5a63cd8719901caafb (patch) | |
tree | 79689781d4f6ab1789a86b0bcd1e763e68f45dd6 /src/net | |
parent | 23c4d7012568277b7985f1b1e633c4b8242f9ddd (diff) | |
download | esieequest-0a845d99117e4d4186d5be5a63cd8719901caafb.tar.gz |
Use IntrinsicMap (custom HashMap)
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/pacien/util/IntrinsicMap.java | 59 | ||||
-rw-r--r-- | src/net/pacien/util/Mappable.java | 7 | ||||
-rw-r--r-- | src/net/pacien/util/pacienutils.gwt.xml | 3 | ||||
-rw-r--r-- | src/net/pacien/util/package-info.java | 8 |
4 files changed, 77 insertions, 0 deletions
diff --git a/src/net/pacien/util/IntrinsicMap.java b/src/net/pacien/util/IntrinsicMap.java new file mode 100644 index 0000000..a68dcbe --- /dev/null +++ b/src/net/pacien/util/IntrinsicMap.java | |||
@@ -0,0 +1,59 @@ | |||
1 | /** | ||
2 | * | ||
3 | */ | ||
4 | package net.pacien.util; | ||
5 | |||
6 | import java.util.HashMap; | ||
7 | import java.util.Map; | ||
8 | |||
9 | /** | ||
10 | * @author pacien | ||
11 | * | ||
12 | */ | ||
13 | public class IntrinsicMap<K, V extends Mappable> extends HashMap<K, V> { | ||
14 | |||
15 | /** | ||
16 | * | ||
17 | */ | ||
18 | private static final long serialVersionUID = 1L; | ||
19 | |||
20 | /** | ||
21 | * | ||
22 | */ | ||
23 | public IntrinsicMap() { | ||
24 | super(); | ||
25 | } | ||
26 | |||
27 | /** | ||
28 | * @param initialCapacity | ||
29 | */ | ||
30 | public IntrinsicMap(int initialCapacity) { | ||
31 | super(initialCapacity); | ||
32 | } | ||
33 | |||
34 | /** | ||
35 | * @param m | ||
36 | */ | ||
37 | public IntrinsicMap(Map<? extends K, ? extends V> m) { | ||
38 | super(m); | ||
39 | } | ||
40 | |||
41 | /** | ||
42 | * @param initialCapacity | ||
43 | * @param loadFactor | ||
44 | */ | ||
45 | public IntrinsicMap(int initialCapacity, float loadFactor) { | ||
46 | super(initialCapacity, loadFactor); | ||
47 | } | ||
48 | |||
49 | @SuppressWarnings("unchecked") | ||
50 | public V put(V value) { | ||
51 | return super.put((K) value.getKey(), value); | ||
52 | } | ||
53 | |||
54 | @Override | ||
55 | public V put(K key, V value) { | ||
56 | return this.put(value); | ||
57 | } | ||
58 | |||
59 | } | ||
diff --git a/src/net/pacien/util/Mappable.java b/src/net/pacien/util/Mappable.java new file mode 100644 index 0000000..b5bbf06 --- /dev/null +++ b/src/net/pacien/util/Mappable.java | |||
@@ -0,0 +1,7 @@ | |||
1 | package net.pacien.util; | ||
2 | |||
3 | public interface Mappable { | ||
4 | |||
5 | public Object getKey(); | ||
6 | |||
7 | } | ||
diff --git a/src/net/pacien/util/pacienutils.gwt.xml b/src/net/pacien/util/pacienutils.gwt.xml new file mode 100644 index 0000000..d2a88de --- /dev/null +++ b/src/net/pacien/util/pacienutils.gwt.xml | |||
@@ -0,0 +1,3 @@ | |||
1 | <module rename-to="pacienutils"> | ||
2 | <source path=""/> | ||
3 | </module> \ No newline at end of file | ||
diff --git a/src/net/pacien/util/package-info.java b/src/net/pacien/util/package-info.java new file mode 100644 index 0000000..924b56f --- /dev/null +++ b/src/net/pacien/util/package-info.java | |||
@@ -0,0 +1,8 @@ | |||
1 | /** | ||
2 | * | ||
3 | */ | ||
4 | /** | ||
5 | * @author pacien | ||
6 | * | ||
7 | */ | ||
8 | package net.pacien.util; \ No newline at end of file | ||