[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Selection.java,1.5,1.6
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-01-13 13:23:06
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26794/src/net/sourceforge/bprocessor/model Modified Files: Selection.java Log Message: Selection rembers the order in which objects were selected Index: Selection.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Selection.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Selection.java 13 Jan 2006 09:38:55 -0000 1.5 --- Selection.java 13 Jan 2006 13:22:53 -0000 1.6 *************** *** 21,27 **** */ public class Selection implements Collection { ! /** The collection of objects */ private Set mark; /** The observers */ --- 21,29 ---- */ public class Selection implements Collection { ! /** The collection of objects mark is used to test for membership */ private Set mark; + /** The order of the objects */ + private List selection; /** The observers */ *************** *** 45,48 **** --- 47,51 ---- super(); mark = new HashSet(); + selection = new LinkedList(); observers = new LinkedList(); } *************** *** 64,67 **** --- 67,71 ---- public boolean add(Object object) { if (mark.add(object)) { + selection.add(object); changed(); return true; *************** *** 78,81 **** --- 82,86 ---- public boolean remove(Object object) { if (mark.remove(object)) { + selection.remove(object); changed(); return true; *************** *** 90,93 **** --- 95,99 ---- public void clear() { mark.clear(); + selection.clear(); changed(); } *************** *** 108,112 **** */ public Iterator iterator() { ! return mark.iterator(); } --- 114,118 ---- */ public Iterator iterator() { ! return selection.iterator(); } *************** *** 143,147 **** */ public int size() { ! return mark.size(); } --- 149,153 ---- */ public int size() { ! return selection.size(); } *************** *** 151,155 **** */ public boolean isEmpty() { ! return mark.isEmpty(); } --- 157,161 ---- */ public boolean isEmpty() { ! return selection.isEmpty(); } *************** *** 159,163 **** */ public Object[] toArray() { ! return mark.toArray(); } --- 165,169 ---- */ public Object[] toArray() { ! return selection.toArray(); } *************** *** 168,172 **** */ public Object[] toArray(Object[] array) { ! return mark.toArray(array); } --- 174,178 ---- */ public Object[] toArray(Object[] array) { ! return selection.toArray(array); } *************** *** 186,190 **** */ public boolean addAll(Collection objects) { ! if (mark.addAll(objects)) { changed(); return true; --- 192,205 ---- */ public boolean addAll(Collection objects) { ! boolean touched = false; ! Iterator iter = objects.iterator(); ! while (iter.hasNext()) { ! Object current = iter.next(); ! if (mark.add(current)) { ! selection.add(current); ! touched = true; ! } ! } ! if (touched) { changed(); return true; *************** *** 200,204 **** */ public boolean removeAll(Collection objects) { ! if (mark.removeAll(objects)) { changed(); return true; --- 215,228 ---- */ public boolean removeAll(Collection objects) { ! boolean touched = false; ! Iterator iter = objects.iterator(); ! while (iter.hasNext()) { ! Object current = iter.next(); ! if (mark.remove(current)) { ! selection.remove(current); ! touched = true; ! } ! } ! if (touched) { changed(); return true; *************** *** 214,223 **** */ public boolean retainAll(Collection objects) { ! if (mark.retainAll(objects)) { ! changed(); ! return true; ! } else { ! return false; ! } } } --- 238,245 ---- */ public boolean retainAll(Collection objects) { ! clear(); ! addAll(objects); ! changed(); ! return true; } } |