Package openllet.core.utils.intset
Interface IntSet
-
- All Known Implementing Classes:
AbstractIntSet,ArrayIntSet,BitIntSet,ShiftedBitIntSet
public interface IntSetDescription: An interface describing a set of primitive integers. An implementation may only accept certain types of integers (e.g. only positive integers).
Copyright: Copyright (c) 2007
Company: Clark & Parsia, LLC.
- Author:
- Evren Sirin
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidadd(int value)Adds a new integer to this set.voidaddAll(IntSet other)Adds all the integers from another set to this set.booleancontains(int value)Checks if the given integer value is in this set.IntSetcopy()Creates a copy of this set.booleanisEmpty()Cehcks if the set is empty.IntIteratoriterator()An iterator over the values of this set.intmax()Returns the maximum integer in this set.intmin()Returns the minimum integer in this set.voidremove(int value)Remove the given integer value from this set.intsize()Returns the number of elements in the set.IntSetunion(IntSet set)Creates a new IntSet that is the union of this set and the given set.
-
-
-
Method Detail
-
add
void add(int value) throws java.lang.IllegalArgumentException
Adds a new integer to this set.- Parameters:
value- integer value to be added- Throws:
java.lang.IllegalArgumentException- if the value is not supported by this set implementation
-
addAll
void addAll(IntSet other)
Adds all the integers from another set to this set.- Parameters:
other- the set whose elements will be added- Throws:
java.lang.IllegalArgumentException- if any of the values in the other set is not supported by this set implementation
-
contains
boolean contains(int value)
Checks if the given integer value is in this set.- Parameters:
value- the integer value being checked- Returns:
trueif the value is in this set
-
copy
IntSet copy()
Creates a copy of this set.- Returns:
- a copy of this set
-
isEmpty
boolean isEmpty()
Cehcks if the set is empty.- Returns:
trueif there are no elements in the set
-
iterator
IntIterator iterator()
An iterator over the values of this set. There is no guarantee on the _order of the elements.- Returns:
- an iterator over the values of the set
-
max
int max() throws java.util.NoSuchElementException
Returns the maximum integer in this set.- Returns:
- the maximum integer in this set
- Throws:
java.util.NoSuchElementException- if the set is empty
-
min
int min()
Returns the minimum integer in this set.- Returns:
- the minimum integer in this set
- Throws:
java.util.NoSuchElementException- if the set is empty
-
remove
void remove(int value)
Remove the given integer value from this set.- Parameters:
value- the integer value to be removed
-
union
IntSet union(IntSet set)
Creates a new IntSet that is the union of this set and the given set. Neither of the sets are changed by this operation.- Parameters:
set- the other set that will be included in the union result- Returns:
- a new IntSet instance that is the union of two sets
-
size
int size()
Returns the number of elements in the set.- Returns:
- the number of elements in the set
-
-