aboutsummaryrefslogtreecommitdiff
path: root/src/net/pacien
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2014-05-03 19:06:37 +0200
committerPacien TRAN-GIRARD2014-05-03 19:06:37 +0200
commit0a845d99117e4d4186d5be5a63cd8719901caafb (patch)
tree79689781d4f6ab1789a86b0bcd1e763e68f45dd6 /src/net/pacien
parent23c4d7012568277b7985f1b1e633c4b8242f9ddd (diff)
downloadesieequest-0a845d99117e4d4186d5be5a63cd8719901caafb.tar.gz
Use IntrinsicMap (custom HashMap)
Diffstat (limited to 'src/net/pacien')
-rw-r--r--src/net/pacien/util/IntrinsicMap.java59
-rw-r--r--src/net/pacien/util/Mappable.java7
-rw-r--r--src/net/pacien/util/pacienutils.gwt.xml3
-rw-r--r--src/net/pacien/util/package-info.java8
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 */
4package net.pacien.util;
5
6import java.util.HashMap;
7import java.util.Map;
8
9/**
10 * @author pacien
11 *
12 */
13public 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 @@
1package net.pacien.util;
2
3public 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 */
8package net.pacien.util; \ No newline at end of file