001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 *
017 */
018 package org.apache.bcel.verifier.statics;
019
020
021 import java.util.ArrayList;
022 import java.util.List;
023
024 /**
025 * A small utility class representing a set of basic int values.
026 *
027 * @version $Id: IntList.java 1149459 2011-07-22 04:34:27Z dbrosius $
028 * @author Enver Haase
029 */
030 public class IntList{
031 /** The int are stored as Integer objects here. */
032 private List<Integer> theList;
033 /** This constructor creates an empty list. */
034 IntList(){
035 theList = new ArrayList<Integer>();
036 }
037 /** Adds an element to the list. */
038 void add(int i){
039 theList.add(Integer.valueOf(i));
040 }
041 /** Checks if the specified int is already in the list. */
042 boolean contains(int i){
043 Integer[] ints = new Integer[theList.size()];
044 theList.toArray(ints);
045 for (int j=0; j<ints.length; j++){
046 if (i == ints[j].intValue()) {
047 return true;
048 }
049 }
050 return false;
051 }
052 }