1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.millscript.millscript.datatypes;
22
23 import java.util.HashMap;
24 import java.util.Map;
25
26 /**
27 * This interface provides a version of the usual <code>WeakHashMap</code> that
28 * includes a notion of a default which can be exploited by the MillScript
29 * index operator.
30 *
31 * @deprecated As of MillScript 10.2.0, this functionallity has been subsumed
32 * by the MillScript-Util project and it's Map API, see
33 * {@link org.millscript.commons.util.map.EWeakHashMap}.
34 */
35 @Deprecated
36 public class WeakHashMapWithDefault extends HashMap< Object, Object > implements MapWithDefault< Object, Object > {
37
38 /**
39 * This is the ID from the release 10.0.0 for future compatibility.
40 */
41 private static final long serialVersionUID = -8034136570368421314L;
42
43 /**
44 * This weak hash map's default value.
45 */
46 private Object def = null;
47
48 /**
49 * @see org.millscript.millscript.datatypes.MapWithDefault#getDefault()
50 */
51 public Object getDefault() { return def; }
52
53 /**
54 * @see org.millscript.millscript.datatypes.MapWithDefault#setDefault(java.lang.Object)
55 */
56 public void setDefault( final Object d ) { def = d; }
57
58 /**
59 * Constructs a new weak hash map with default, using the default capacity
60 * and load factor.
61 */
62 public WeakHashMapWithDefault() {
63 super();
64 }
65
66 /**
67 * Constructs a new weak hash map with default, using the specified
68 * capacity and default load factor.
69 *
70 * @param c the initial capacity
71 */
72 public WeakHashMapWithDefault( final int c ) {
73 super( c );
74 }
75
76 /**
77 * Constructs a new weak hash map with default, using the specified
78 * capacity and load factor.
79 *
80 * @param c the initial capacity
81 * @param f the load factor
82 */
83 public WeakHashMapWithDefault( final int c, final float f ) {
84 super( c, f );
85 }
86
87 /**
88 * Constructs a new weak hash map with default, which will have the same
89 * mappings as the specified map. The new weak hash map will use the
90 * default load factor and an initial capacity sufficient to hold all the
91 * mappings in the specified map.
92 *
93 * @param t the map to copy into this map
94 */
95 public WeakHashMapWithDefault( final Map< ?, ? > t ) {
96 super( t );
97 }
98
99 }