1 /* $RCSfile$
2  * $Author: hansonr $
3  * $Date: 2007-04-26 16:57:51 -0500 (Thu, 26 Apr 2007) $
4  * $Revision: 7502 $
5  *
6  * Copyright (C) 2005  The Jmol Development Team
7  *
8  * Contact: jmol-developers@lists.sf.net
9  *
10  *  This library is free software; you can redistribute it and/or
11  *  modify it under the terms of the GNU Lesser General Public
12  *  License as published by the Free Software Foundation; either
13  *  version 2.1 of the License, or (at your option) any later version.
14  *
15  *  This library is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  *  Lesser General Public License for more details.
19  *
20  *  You should have received a copy of the GNU Lesser General Public
21  *  License along with this library; if not, write to the Free Software
22  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24 
25 package javajs.util;
26 
27 import java.util.ArrayList;
28 
29 /**
30  * created to remove ambiguities in add and remove
31  *
32  * @param <V>
33  */
34 public class Lst<V> extends ArrayList<V> {
35 
Lst()36   public Lst() {
37     super();
38   }
39 
40   /**
41    * @j2sIgnore
42    *
43    */
44   @Override
45   @Deprecated
add(V v)46   public boolean add(V v) {
47     throw new NullPointerException("use addLast(value), not add(value) in List for JavaScript compatibility");
48   }
49 
addLast(V v)50   public boolean addLast(V v) {
51     /**
52      * no overloading of add(Object) in JavaScript
53      *
54      * @j2sNative
55      *
56      * return this.add1(v);
57      *
58      */
59     {
60       return super.add(v);
61     }
62   }
63 
64   /**
65    * @j2sIgnore
66    *
67    */
68 //  @Override
69 //  @Deprecated
remove(int location)70   public V remove(int location) {
71     throw new NullPointerException("use Lst.removeItemAt(location), not Lst.remove(location)");
72   }
73 
removeItemAt(int location)74   public V removeItemAt(int location) {
75     /**
76      * no overloading of remove(location) in JavaScript
77      *
78      * @j2sNative
79      *
80      * return this._removeItemAt(location);
81      *
82      */
83     {
84       return super.remove(location);
85     }
86   }
87 
88   /**
89    * @j2sIgnore
90    *
91    */
92   @Override
93   @Deprecated
remove(Object v)94   public boolean remove(Object v) {
95     throw new NullPointerException("use Lst.removeObj(obj), not Lst.remove(obj)");
96   }
97 
removeObj(Object v)98   public boolean removeObj(Object v) {
99     /**
100      * no overloading of remove(Object) in JavaScript
101      *
102      * @j2sNative
103      *
104      * return this._removeObject(v);
105      *
106      */
107     {
108       return super.remove(v);
109     }
110   }
111 
112 }
113