edu.umd.cfar.lamp.viper.util
Class ViperSelectionSet

java.lang.Object
  extended byedu.umd.cfar.lamp.viper.util.AbstractViperSelection
      extended byedu.umd.cfar.lamp.viper.util.ViperSelectionSet
All Implemented Interfaces:
ViperSelection
Direct Known Subclasses:
ViperSelectionSetWithPrimarySelection

public class ViperSelectionSet
extends AbstractViperSelection

Author:
davidm TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Generation - Code and Comments

Field Summary
 
Fields inherited from class edu.umd.cfar.lamp.viper.util.AbstractViperSelection
notifyingListeners
 
Constructor Summary
ViperSelectionSet()
          Constructs an empty selection set.
 
Method Summary
 void addNode(Node n)
          Adds a new node to the set of selected nodes.
 void clear()
          Removes any selection.
 ViperData getRoot()
           
 java.util.Iterator getSelectionBeneath(Node n)
          Returns the nodes in the selection set that are beneaththe given node in the tree
 boolean isEmpty()
          Tests to see if something is selected.
 boolean isSelected(Node n)
          Tests to see if the given node is selected.
 void removeNode(Node n)
          Removes the given node from the set of selected nodes.
 void setRoot(ViperData root)
           
 void setTo(Node node)
          Sets to the single element selection 'node'
 void setTo(java.util.Set set)
          Replaces the current set of selections with the given set.
 
Methods inherited from class edu.umd.cfar.lamp.viper.util.AbstractViperSelection
addChangeListener, fireChangeEvent, getChangeListeners, removeChangeListener, writeLock, writeUnlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViperSelectionSet

public ViperSelectionSet()
Constructs an empty selection set.

Method Detail

isSelected

public boolean isSelected(Node n)
Description copied from interface: ViperSelection
Tests to see if the given node is selected.

Parameters:
n - the viper data node to test
Returns:
true iff the node is selected

addNode

public void addNode(Node n)
Adds a new node to the set of selected nodes.

Parameters:
n -

clear

public void clear()
Removes any selection.


removeNode

public void removeNode(Node n)
Removes the given node from the set of selected nodes.

Parameters:
n - the node to remove

setTo

public void setTo(java.util.Set set)
Replaces the current set of selections with the given set.

Parameters:
set -

setTo

public void setTo(Node node)
Sets to the single element selection 'node'

Parameters:
node - the node to select

isEmpty

public boolean isEmpty()
Description copied from interface: ViperSelection
Tests to see if something is selected.

Returns:
if anything is selected

getRoot

public ViperData getRoot()
Returns:

setRoot

public void setRoot(ViperData root)
Parameters:
root -

getSelectionBeneath

public java.util.Iterator getSelectionBeneath(Node n)
Returns the nodes in the selection set that are beneaththe given node in the tree

Parameters:
n - the common ancestor
Returns:
the selected nodes beneath the ancestor node