View Javadoc

1   /*
2    * Copyright  2000-2004 The Apache Software Foundation
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License"); 
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License. 
15   *
16   */ 
17  package org.apache.bcel.verifier.statics;
18  
19  
20  import java.util.ArrayList;
21  import java.util.List;
22  
23  /***
24   * A small utility class representing a set of basic int values.
25   *
26   * @version $Id: IntList.java 386056 2006-03-15 11:31:56Z tcurdt $
27   * @author Enver Haase
28   */
29  public class IntList{
30  	/*** The int are stored as Integer objects here. */
31  	private List theList;
32  	/*** This constructor creates an empty list. */
33  	IntList(){
34  		theList = new ArrayList();
35  	}
36  	/*** Adds an element to the list. */
37  	void add(int i){
38  		theList.add(new Integer(i));
39  	}
40  	/*** Checks if the specified int is already in the list. */
41  	boolean contains(int i){
42  		Integer[] ints = new Integer[theList.size()];
43  		theList.toArray(ints);
44  		for (int j=0; j<ints.length; j++){
45  			if (i == ints[j].intValue()) {
46                  return true;
47              }
48  		}
49  		return false;
50  	}
51  }