Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19293/src/net/sourceforge/bprocessor/model
Added Files:
Selection.java
Log Message:
Added a Selection class to handle the selection
--- NEW FILE: Selection.java ---
//---------------------------------------------------------------------------------
// $Id: Selection.java,v 1.1 2006/01/06 09:59:23 henryml Exp $
//
// Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net)
// Released under the Lesser GNU Public License v2.1
//---------------------------------------------------------------------------------
package net.sourceforge.bprocessor.model;
import java.util.Collection;
import java.util.HashSet;
/**
* The represents a collection of objects.
* The primary collection are shared for all elements
* in the userinterface.
*/
public class Selection {
/** The collection of objects */
private Collection selection;
/** The primary selection */
private static Selection primary = new Selection();
/**
* Return the primary selection
* @return The primary selection
*/
public static Selection primary() {
return primary;
}
/**
* Constructor for Selection
*/
public Selection() {
super();
selection = new HashSet();
}
/**
* Add an object to the Selection
* @param object The object
*/
public void add(Object object) {
selection.add(object);
}
/**
* Remove and object from the Selection
* @param object The object
*/
public void remove(Object object) {
selection.remove(object);
}
/**
* Clear the selection
*/
public void clear() {
selection.clear();
}
/**
* Set the selection
* @param object The object
*/
public void set(Object object) {
clear();
add(object);
}
}
|