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

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

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

add

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

Parameters:
collection - Collection of integer values.

add

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

Parameters:
array - Array of integer values.

remove

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

Parameters:
index - Index of the integer value.

set

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

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

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

getCount

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

Returns:
Count of integer values.

indexOf

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

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

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

Parameters:
value - Value to remove.

isEmpty

boolean isEmpty()
If this collection contains no values

Returns:
True, if the collection is empty

pop

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

Returns:
Value from the end of the collection.

push

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

Parameters:
value - Value, which should be added.

push

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

Parameters:
values - Array of integer values.

peek

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

Returns:
Integer value.

clear

void clear()
Removes all values from this collection.


swap

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

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

Overrides:
toString in class java.lang.Object
Returns:
String representation of the collection.


Copyright ? 2003 Chaperon project. All Rights Reserved.