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.io.Serializable;
24  import java.util.LinkedHashMap;
25  import java.util.Map;
26  
27  /**
28   * This interface provides a version of the usual <code>LinkedHashMap</code>
29   * that 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.ELinkedHashMap}.
35   */
36  @Deprecated
37  public class LinkedHashMapWithDefault extends LinkedHashMap< 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 = 7594446941496718187L;
43  
44      /**
45       * This linked 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 linked hash map with default, using the default
65       * capacity and load factor.
66       */
67      public LinkedHashMapWithDefault() {
68          super();
69      }
70  
71      /**
72       * Constructs a new linked hash map with default, using the specified
73       * capacity and default load factor.
74       *
75       * @param c   the initial capacity
76       */
77      public LinkedHashMapWithDefault( final int c ) {
78          super( c );
79      }
80  
81      /**
82       * Constructs a new linked 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 LinkedHashMapWithDefault( final int c, final float f ) {
89          super( c, f );
90      }
91  
92      /**
93       * Constructs a new linked hash map with default, which will have the same
94       * mappings as the specified map. The new linked hash map will use the
95       * default load factor and an initial capacity sufficient to hold all the
96       * mappings in the specified map.
97       *
98       * @param t   the map to copy into this map
99       */
100     public LinkedHashMapWithDefault( final Map< ?, ? > t ) {
101         super( t );
102     }
103 
104 }