Home | History | Annotate | Download | only in util
      1 /*
      2  * Copyright (C) 2008 The Android Open Source Project
      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 com.android.dexgen.util;
     18 
     19 /**
     20  * A set of integers
     21  */
     22 public interface IntSet {
     23 
     24     /**
     25      * Adds an int to a set
     26      *
     27      * @param value int to add
     28      */
     29     void add(int value);
     30 
     31     /**
     32      * Removes an int from a set.
     33      *
     34      * @param value int to remove
     35      */
     36     void remove(int value);
     37 
     38     /**
     39      * Checks to see if a value is in the set
     40      *
     41      * @param value int to check
     42      * @return true if in set
     43      */
     44     boolean has(int value);
     45 
     46     /**
     47      * Merges {@code other} into this set, so this set becomes the
     48      * union of the two.
     49      *
     50      * @param other {@code non-null;} other set to merge with.
     51      */
     52     void merge(IntSet other);
     53 
     54     /**
     55      * Returns the count of unique elements in this set.
     56      *
     57      * @return {@code > = 0;} count of unique elements
     58      */
     59     int elements();
     60 
     61     /**
     62      * Iterates the set
     63      *
     64      * @return {@code non-null;} a set iterator
     65      */
     66     IntIterator iterator();
     67 }
     68