org.mindswap.pellet.utils.intset
Class ArrayIntSet

java.lang.Object
  extended by org.mindswap.pellet.utils.intset.ArrayIntSet
All Implemented Interfaces:
IntSet

public class ArrayIntSet
extends java.lang.Object
implements IntSet

Title:

Description:

Copyright: Copyright (c) 2007

Company: Clark & Parsia, LLC.

Author:
Evren Sirin

Constructor Summary
ArrayIntSet()
           
ArrayIntSet(ArrayIntSet other)
           
 
Method Summary
 void add(int value)
          Adds a new integer to this set.
 void addAll(IntSet values)
          Adds all the integers from another set to this set.
 boolean contains(int value)
          Checks if the given integer value is in this set.
 IntSet copy()
          Creates a copy of this set.
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 boolean isEmpty()
          Cehcks if the set is empty.
 IntIterator iterator()
          An iterator over the values of this set.
 int max()
          Returns the maximum integer in this set.
 int min()
          Returns the minimum integer in this set.
 void remove(int value)
          Remove the given integer value from this set.
 int size()
          Returns the number of elements in the set.
 java.lang.String toString()
          
 IntSet union(IntSet values)
          Creates a new IntSet that is the union of this set and the given set.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArrayIntSet

public ArrayIntSet()

ArrayIntSet

public ArrayIntSet(ArrayIntSet other)
Method Detail

add

public void add(int value)
Adds a new integer to this set.

Specified by:
add in interface IntSet
Parameters:
value - integer value to be added

addAll

public void addAll(IntSet values)
Adds all the integers from another set to this set.

Specified by:
addAll in interface IntSet
Parameters:
values - the set whose elements will be added

contains

public boolean contains(int value)
Checks if the given integer value is in this set.

Specified by:
contains in interface IntSet
Parameters:
value - the integer value being checked
Returns:
true if the value is in this set

copy

public IntSet copy()
Creates a copy of this set.

Specified by:
copy in interface IntSet
Returns:
a copy of this set

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

isEmpty

public boolean isEmpty()
Cehcks if the set is empty.

Specified by:
isEmpty in interface IntSet
Returns:
true if there are no elements in the set

iterator

public IntIterator iterator()
An iterator over the values of this set. There is no guarantee on the order of the elements.

Specified by:
iterator in interface IntSet
Returns:
an iterator over the values of the set

max

public int max()
Returns the maximum integer in this set.

Specified by:
max in interface IntSet
Returns:
the maximum integer in this set

min

public int min()
Returns the minimum integer in this set.

Specified by:
min in interface IntSet
Returns:
the minimum integer in this set

remove

public void remove(int value)
Remove the given integer value from this set.

Specified by:
remove in interface IntSet
Parameters:
value - the integer value to be removed

size

public int size()
Returns the number of elements in the set.

Specified by:
size in interface IntSet
Returns:
the number of elements in the set

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

union

public IntSet union(IntSet values)
Description copied from interface: IntSet
Creates a new IntSet that is the union of this set and the given set. Neither of the sets are changed by this operation.

Specified by:
union in interface IntSet
Parameters:
values - the other set that will be included in the union result
Returns:
a new IntSet instance that is the union of two sets


Copyright © 2004 Evren Sirin. All Rights Reserved.