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