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

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

public class DefaultSingleViperSubTree
extends AbstractSingleViperSubTree

The default single subtree is a simple chain selection, where the nodes that are descendents of the chain are all marked as selected. To test to see if an element is in the chain or just a descendant of it, use the isFilteredBy(Class) method.


Field Summary
 
Fields inherited from class edu.umd.cfar.lamp.viper.util.AbstractViperSelection
notifyingListeners
 
Constructor Summary
DefaultSingleViperSubTree()
          Creates an empty subtree with no root, so nothing is selected.
DefaultSingleViperSubTree(ViperData root)
          Creates an empty subtree with the specified root, so everything is selected and nothing is filtered by.
 
Method Summary
protected  void finalize()
           
 AttrConfig getFirstAttrConfig()
          Get all the first attribute schema node in the selection.
 Attribute getFirstAttribute()
          Get all the first attribute node in the selection.
 Config getFirstConfig()
          Get all the first descriptor schema node in the selection.
 Descriptor getFirstDescriptor()
          Get all the first descriptor node in the selection.
 Sourcefile getFirstSourcefile()
          Get all the first sourcefile node in the selection.
 ViperData getRoot()
          Gets the root these elements are selected from.
 boolean isFilteredBy(java.lang.Class type)
          Only nodes beneath some subset of the nodes of the specified type are selected.
 void selectPathTo(Node n)
          Select the path to the given node.
 void setAttrConfig(AttrConfig config)
          Sets the attribute config to select on.
 void setAttribute(Attribute attribute)
          Sets the attribute to select on.
 void setConfig(Config config)
          Sets the descriptor config to select on.
 void setDescriptor(Descriptor descriptor)
          Sets the descriptor to select on.
 void setRoot(ViperData root)
          Sets the root of the selection.
 void setSourcefile(Sourcefile sourcefile)
          Sets the sourcefile to select on.
 
Methods inherited from class edu.umd.cfar.lamp.viper.util.AbstractSingleViperSubTree
getAttrConfigs, getAttributes, getConfigs, getDescriptors, getSourcefiles, isMultipleSelectionAllowedOn, isSelected
 
Methods inherited from class edu.umd.cfar.lamp.viper.util.AbstractViperSubTree
fireChangeEvent, fireSelectionChanged, getSelectedBy, isEmpty, toString
 
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, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.umd.cfar.lamp.viper.util.ViperSelection
addChangeListener, getChangeListeners, removeChangeListener
 

Constructor Detail

DefaultSingleViperSubTree

public DefaultSingleViperSubTree()
Creates an empty subtree with no root, so nothing is selected.


DefaultSingleViperSubTree

public DefaultSingleViperSubTree(ViperData root)
Creates an empty subtree with the specified root, so everything is selected and nothing is filtered by.

Parameters:
root - the root of the tree to select from
Method Detail

setRoot

public void setRoot(ViperData root)
Sets the root of the selection. Note: this does not fire a change event.

Parameters:
root - the root of the tree that this selects from

finalize

protected void finalize()
                 throws java.lang.Throwable
Throws:
java.lang.Throwable

getRoot

public ViperData getRoot()
Description copied from interface: ViperSubTree
Gets the root these elements are selected from.

Returns:
the root node
See Also:
ViperSubTree.getRoot()

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
Overrides:
isFilteredBy in class AbstractViperSubTree
See Also:
AbstractViperSubTree.isFilteredBy(java.lang.Class)

getFirstSourcefile

public Sourcefile getFirstSourcefile()
Description copied from interface: ViperSubTree
Get all the first sourcefile node in the selection.

Returns:
the first selected sourcefile node
See Also:
ViperSubTree.getFirstSourcefile()

getFirstConfig

public Config getFirstConfig()
Description copied from interface: ViperSubTree
Get all the first descriptor schema node in the selection.

Returns:
the first selected descriptor schema node
See Also:
ViperSubTree.getFirstConfig()

getFirstAttrConfig

public AttrConfig getFirstAttrConfig()
Description copied from interface: ViperSubTree
Get all the first attribute schema node in the selection.

Returns:
the first selected attribute schema node
See Also:
ViperSubTree.getFirstAttrConfig()

getFirstDescriptor

public Descriptor getFirstDescriptor()
Description copied from interface: ViperSubTree
Get all the first descriptor node in the selection.

Returns:
the first selected descriptor node
See Also:
ViperSubTree.getFirstDescriptor()

getFirstAttribute

public Attribute getFirstAttribute()
Description copied from interface: ViperSubTree
Get all the first attribute node in the selection.

Returns:
the first selected attribute node
See Also:
ViperSubTree.getFirstAttribute()

setAttrConfig

public void setAttrConfig(AttrConfig config)
Sets the attribute config to select on. Selecting null removes the current attribute schema node selection.

Parameters:
config - the attribute config to filter on, or null if none is to be filtered on

selectPathTo

public void selectPathTo(Node n)
Select the path to the given node. This works by calling the approprite setNodeType method, so it won't remove part of the chain that is beneath it in the tree.

Parameters:
n - the node to select to

setAttribute

public void setAttribute(Attribute attribute)
Sets the attribute to select on. Selecting null removes the current attribute selection.

Parameters:
attribute - the attribute to filter on, or null if none is to be filtered on

setConfig

public void setConfig(Config config)
Sets the descriptor config to select on. Selecting null removes the current config selection.

Parameters:
config - the descriptor config to filter on, or null if none is to be filtered on

setDescriptor

public void setDescriptor(Descriptor descriptor)
Sets the descriptor to select on. Selecting null removes the current descriptor selection.

Parameters:
descriptor - the descriptor to filter on, or null if none is to be filtered on

setSourcefile

public void setSourcefile(Sourcefile sourcefile)
Sets the sourcefile to select on. Selecting null removes the current sourcefile selection.

Parameters:
sourcefile - the sourcefile to filter on, or null if none is to be filtered on