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

java.lang.Object
  extended byedu.umd.cfar.lamp.viper.util.AbstractViperSelection
      extended byedu.umd.cfar.lamp.viper.util.AbstractViperSubTree
All Implemented Interfaces:
ViperSelection, ViperSubTree
Direct Known Subclasses:
AbstractMultipleViperSubTree, AbstractSingleViperSubTree

public abstract class AbstractViperSubTree
extends AbstractViperSelection
implements ViperSubTree

Implements some of the more annoyingly repetative aspects of the ViperSubTree interface.


Field Summary
 
Fields inherited from class edu.umd.cfar.lamp.viper.util.AbstractViperSelection
notifyingListeners
 
Constructor Summary
AbstractViperSubTree()
           
 
Method Summary
 void fireChangeEvent(javax.swing.event.ChangeEvent e)
          Fire a change event to all registered listeners.
 void fireSelectionChanged(ViperSubTreeChangedEvent e)
          This should be used instead of fireChangeEvent.
 java.util.Iterator getSelectedBy(java.lang.Class c)
          Gets the selections of the given viper node type.
 boolean isEmpty()
          Tests to see if something is selected.
 boolean isFilteredBy(java.lang.Class type)
          Only nodes beneath some subset of the nodes of the specified type are selected.
 java.lang.String toString()
          Prints out the subtree as a chain.
 
Methods inherited from class edu.umd.cfar.lamp.viper.util.AbstractViperSelection
addChangeListener, getChangeListeners, removeChangeListener, writeLock, writeUnlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.umd.cfar.lamp.viper.util.ViperSubTree
getAttrConfigs, getAttributes, getConfigs, getDescriptors, getFirstAttrConfig, getFirstAttribute, getFirstConfig, getFirstDescriptor, getFirstSourcefile, getRoot, getSourcefiles, isMultipleSelectionAllowedOn
 
Methods inherited from interface edu.umd.cfar.lamp.viper.util.ViperSelection
addChangeListener, getChangeListeners, isSelected, removeChangeListener
 

Constructor Detail

AbstractViperSubTree

public AbstractViperSubTree()
Method Detail

fireSelectionChanged

public void fireSelectionChanged(ViperSubTreeChangedEvent e)
This should be used instead of fireChangeEvent.

Parameters:
e -

isFilteredBy

public boolean isFilteredBy(java.lang.Class type)
Description copied from interface: ViperSubTree
Only nodes beneath some subset of the nodes of the specified type are selected.

Specified by:
isFilteredBy in interface ViperSubTree
Parameters:
type - one of the viper.api interfaces, e.g. Sourcefile.class
Returns:
false if there is no filtering by the given type (i.e. all children of selected parents are selected)
See Also:
ViperSubTree.isFilteredBy(java.lang.Class)

fireChangeEvent

public void fireChangeEvent(javax.swing.event.ChangeEvent e)
Description copied from class: AbstractViperSelection
Fire a change event to all registered listeners.

Overrides:
fireChangeEvent in class AbstractViperSelection
Parameters:
e - null if you wish to use a default change event, with this as the source
See Also:
AbstractViperSelection.fireChangeEvent(javax.swing.event.ChangeEvent)

toString

public java.lang.String toString()
Prints out the subtree as a chain.

Returns:
subtree in the form of [ {nodetype: nodes}* ]

getSelectedBy

public java.util.Iterator getSelectedBy(java.lang.Class c)
Description copied from interface: ViperSubTree
Gets the selections of the given viper node type.

Specified by:
getSelectedBy in interface ViperSubTree
Parameters:
c - the node type, e.g. Sourcefile.class
Returns:
an iterator over all, if any, nodes are specifically selected in the tree of the given type

isEmpty

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

Specified by:
isEmpty in interface ViperSelection
Returns:
if anything is selected