Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7005/src/net/sourceforge/bprocessor/model
Modified Files:
Selection.java
Log Message:
Selection implements Collection interface
Index: Selection.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Selection.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Selection.java 6 Jan 2006 10:31:56 -0000 1.3
--- Selection.java 6 Jan 2006 14:13:45 -0000 1.4
***************
*** 19,23 ****
* in the userinterface.
*/
! public class Selection {
/** The collection of objects */
private Collection selection;
--- 19,23 ----
* in the userinterface.
*/
! public class Selection implements Collection {
/** The collection of objects */
private Collection selection;
***************
*** 58,65 ****
* Add an object to the Selection
* @param object The object
*/
! public void add(Object object) {
! selection.add(object);
! changed();
}
--- 58,70 ----
* Add an object to the Selection
* @param object The object
+ * @return True if changed
*/
! public boolean add(Object object) {
! if (selection.add(object)) {
! changed();
! return true;
! } else {
! return false;
! }
}
***************
*** 67,74 ****
* Remove and object from the Selection
* @param object The object
*/
! public void remove(Object object) {
! selection.remove(object);
! changed();
}
--- 72,84 ----
* Remove and object from the Selection
* @param object The object
+ * @return True if changed
*/
! public boolean remove(Object object) {
! if (selection.remove(object)) {
! changed();
! return true;
! } else {
! return false;
! }
}
***************
*** 125,130 ****
}
}
!
!
!
}
--- 135,221 ----
}
}
!
! /**
! * Return the size of selection
! * @return size of selection
! */
! public int size() {
! return selection.size();
! }
!
! /**
! * Return true if empty
! * @return true if empty
! */
! public boolean isEmpty() {
! return selection.isEmpty();
! }
!
! /**
! * Convert to array
! * @return Array of all elements in selection
! */
! public Object[] toArray() {
! return selection.toArray();
! }
!
! /**
! * Add all elements to array
! * @param array Elements to add
! * @return The array
! */
! public Object[] toArray(Object[] array) {
! return selection.toArray(array);
! }
!
! /**
! * Test if selection contains all elements in a collection
! * @param objects The collection
! * @return True if all elements are contained in this selection
! */
! public boolean containsAll(Collection objects) {
! return selection.containsAll(objects);
! }
!
! /**
! * Add all elements from collection
! * @param objects The collection
! * @return True if changed
! */
! public boolean addAll(Collection objects) {
! if (selection.addAll(objects)) {
! changed();
! return true;
! } else {
! return false;
! }
! }
!
! /**
! * Remove all elements from collection
! * @param objects The collection
! * @return True if changed
! */
! public boolean removeAll(Collection objects) {
! if (selection.removeAll(objects)) {
! changed();
! return true;
! } else {
! return false;
! }
! }
!
! /**
! * Retain all elements in collection
! * @param objects Collection
! * @return True if changed
! */
! public boolean retainAll(Collection objects) {
! if (selection.retainAll(objects)) {
! changed();
! return true;
! } else {
! return false;
! }
! }
}
|