KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > chaperon > common > IntegerCollection


1 /*
2  * Copyright (C) Chaperon. All rights reserved.
3  * -------------------------------------------------------------------------
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE file.
7  */

8
9 package net.sourceforge.chaperon.common;
10
11 /**
12  * This interface represents an abstract collection of integer values.
13  *
14  * @author <a HREF="mailto:stephan@apache.org">Stephan Michels</a>
15  * @version CVS $Id: IntegerCollection.java,v 1.3 2003/12/09 19:55:52 benedikta Exp $
16  */

17 public interface IntegerCollection
18 {
19   /**
20    * Add a value to the collection.
21    *
22    * @param value Integer value.
23    *
24    * @return Index of this value.
25    */

26   public int add(int value);
27
28   /**
29    * Add the values of an other integer collection.
30    *
31    * @param collection Collection of integer values.
32    */

33   public void add(IntegerCollection collection);
34
35   /**
36    * Add the values of an array.
37    *
38    * @param array Array of integer values.
39    */

40   public void add(int[] array);
41
42   /**
43    * Removes a value giving by an index.
44    *
45    * @param index Index of the integer value.
46    */

47   public void remove(int index);
48
49   /**
50    * Replace a value, given by an index.
51    *
52    * @param index Index of the value, which should be replaced.
53    * @param value The new value.
54    */

55   public void set(int index, int value);
56
57   /**
58    * Return a value from this collection.
59    *
60    * @param index Index of the value.
61    *
62    * @return Integer value.
63    */

64   public int get(int index);
65
66   /**
67    * Returns the count of values in this collection.
68    *
69    * @return Count of integer values.
70    */

71   public int getCount();
72
73   /**
74    * Return the index of a value, otherwise -1.
75    *
76    * @param value Value, which should found in this collection.
77    *
78    * @return Index of this value.
79    */

80   public int indexOf(int value);
81
82   /**
83    * If the collection contains a value
84    *
85    * @param value Value, which should found in this collection.
86    *
87    * @return True, if this collection contains the value.
88    */

89   public boolean contains(int value);
90
91   /**
92    * Removes a value from this collection.
93    *
94    * @param value Value to remove.
95    */

96   public void removeValue(int value);
97
98   /**
99    * If this collection contains no values
100    *
101    * @return True, if the collection is empty
102    */

103   public boolean isEmpty();
104
105   /**
106    * Pops a value of the end of this collection.
107    *
108    * @return Value from the end of the collection.
109    */

110   public int pop();
111
112   /**
113    * Pushs a value on top to this collection.
114    *
115    * @param value Value, which should be added.
116    */

117   public void push(int value);
118
119   /**
120    * Push values from an array on top on this collection.
121    *
122    * @param values Array of integer values.
123    */

124   public void push(int[] values);
125
126   /**
127    * Peek a value of the end of this collection.
128    *
129    * @return Integer value.
130    */

131   public int peek();
132
133   /**
134    * Removes all values from this collection.
135    */

136   public void clear();
137
138   /**
139    * Swaps two values from this collection.
140    *
141    * @param index1 Index from the first value.
142    * @param index2 Index from the second value.
143    */

144   public void swap(int index1, int index2);
145
146   /**
147    * Return a string representation of the collection.
148    *
149    * @return String representation of the collection.
150    */

151   public String JavaDoc toString();
152 }
153
Popular Tags