net.sourceforge.chaperon.common
Interface IntegerCollection

All Known Implementing Classes:
IntegerList, IntegerSet

public interface IntegerCollection

This interface represents an abstract collection of integer values.

Version:
CVS $Id: IntegerCollection.java,v 1.3 2003/12/09 19:55:52 benedikta Exp $
Author:
Stephan Michels

Method Summary
 int add(int value)
          Add a value to the collection.
 void add(int[] array)
          Add the values of an array.
 void add(IntegerCollection collection)
          Add the values of an other integer collection.
 void clear()
          Removes all values from this collection.
 boolean contains(int value)
          If the collection contains a value
 int get(int index)
          Return a value from this collection.
 int getCount()
          Returns the count of values in this collection.
 int indexOf(int value)
          Return the index of a value, otherwise -1.
 boolean isEmpty()
          If this collection contains no values
 int peek()
          Peek a value of the end of this collection.
 int pop()
          Pops a value of the end of this collection.
 void push(int value)
          Pushs a value on top to this collection.
 void push(int[] values)
          Push values from an array on top on this collection.
 void remove(int index)
          Removes a value giving by an index.
 void removeValue(int value)
          Removes a value from this collection.
 void set(int index, int value)
          Replace a value, given by an index.
 void swap(int index1, int index2)
          Swaps two values from this collection.
 java.lang.String toString()
          Return a string representation of the collection.
 

Method Detail

add

public int add(int value)
Add a value to the collection.

Parameters:
value - Integer value.
Returns:
Index of this value.

add

public void add(IntegerCollection collection)
Add the values of an other integer collection.

Parameters:
collection - Collection of integer values.

add

public void add(int[] array)
Add the values of an array.

Parameters:
array - Array of integer values.

remove

public void remove(int index)
Removes a value giving by an index.

Parameters:
index - Index of the integer value.

set

public void set(int index,
                int value)
Replace a value, given by an index.

Parameters:
index - Index of the value, which should be replaced.
value - The new value.

get

public int get(int index)
Return a value from this collection.

Parameters:
index - Index of the value.
Returns:
Integer value.

getCount

public int getCount()
Returns the count of values in this collection.

Returns:
Count of integer values.

indexOf

public int indexOf(int value)
Return the index of a value, otherwise -1.

Parameters:
value - Value, which should found in this collection.
Returns:
Index of this value.

contains

public boolean contains(int value)
If the collection contains a value

Parameters:
value - Value, which should found in this collection.
Returns:
True, if this collection contains the value.

removeValue

public void removeValue(int value)
Removes a value from this collection.

Parameters:
value - Value to remove.

isEmpty

public boolean isEmpty()
If this collection contains no values

Returns:
True, if the collection is empty

pop

public int pop()
Pops a value of the end of this collection.

Returns:
Value from the end of the collection.

push

public void push(int value)
Pushs a value on top to this collection.

Parameters:
value - Value, which should be added.

push

public void push(int[] values)
Push values from an array on top on this collection.

Parameters:
values - Array of integer values.

peek

public int peek()
Peek a value of the end of this collection.

Returns:
Integer value.

clear

public void clear()
Removes all values from this collection.


swap

public void swap(int index1,
                 int index2)
Swaps two values from this collection.

Parameters:
index1 - Index from the first value.
index2 - Index from the second value.

toString

public java.lang.String toString()
Return a string representation of the collection.

Returns:
String representation of the collection.


Copyright ? 2003 Chaperon project. All Rights Reserved.