View Javadoc

1   ////////////////////////////////////////////////////////////////////////////////
2   // MillScript: an Open Spice interpreter and batch website creation tool
3   // Copyright (C) 2001-2004 Open World Ltd
4   //
5   // This file is part of MillScript.
6   //
7   // MillScript is free software; you can redistribute it and/or modify it under
8   // the terms of the GNU General Public License as published by the Free
9   // Software Foundation; either version 2 of the License, or (at your option)
10  // any later version.
11  //
12  // MillScript is distributed in the hope that it will be useful, but WITHOUT
13  // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15  // more details.
16  //
17  // You should have received a copy of the GNU General Public License along with
18  // MillScript; if not, write to the Free Software Foundation, Inc., 59 Temple
19  // Place, Suite 330, Boston, MA  02111-1307  USA
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  }