01: /*
02: * Copyright 2000-2004 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: import java.util.ArrayList;
20: import java.util.List;
21:
22: /**
23: * A small utility class representing a set of basic int values.
24: *
25: * @version $Id: IntList.java 386056 2006-03-15 11:31:56Z tcurdt $
26: * @author Enver Haase
27: */
28: public class IntList {
29: /** The int are stored as Integer objects here. */
30: private List theList;
31:
32: /** This constructor creates an empty list. */
33: IntList() {
34: theList = new ArrayList();
35: }
36:
37: /** Adds an element to the list. */
38: void add(int i) {
39: theList.add(new Integer(i));
40: }
41:
42: /** Checks if the specified int is already in the list. */
43: boolean contains(int i) {
44: Integer[] ints = new Integer[theList.size()];
45: theList.toArray(ints);
46: for (int j = 0; j < ints.length; j++) {
47: if (i == ints[j].intValue()) {
48: return true;
49: }
50: }
51: return false;
52: }
53: }
|