Cytoscape 2.4.1 (c) 2006,2007 ISB, MSKCC, UCSD

cytoscape.data
Class FlagFilter

java.lang.Object
  extended by cytoscape.data.FlagFilter
All Implemented Interfaces:
Filter, GraphPerspectiveChangeListener, EventListener

Deprecated. As of 2.3, replaced with SelectFilter

public class FlagFilter
extends Object
implements Filter, GraphPerspectiveChangeListener

This class implements the ability to attach a flag to every node or edge in a GraphPerspective. The flag can be either on or off. Methods are provided for inspecting the current state of any graph object, for setting the state, or getting the full set of currently flagged nodes or edges. This functionality is often used to identify a set of interesting nodes or edges in the graph.

A non-null GraphPerspective reference is required to construct an instance of this class. This class will listen to the graph to respond to the removal of graph objects. A currently flagged object that is removed from the graph will lose its flag, even if it is later added back to the graph.

When the state of a node or edge is changed, a event of type FlagEvent is fired. When a group of nodes or edges are changed together in a single operation, one event will be fired for the whole group (but separate events for nodes and edges). Note: a listener should not be removed from this object in response to the firing of an event, as this may cause a ConcurrentModificationException.

WARNING: for performance reasons, the set of objects returned by the getSelectedXX methods is the actual data object, not a copy. Users should not directly modify these sets.

Performance note: the implementation is a HashSet of flagged objects, so most methods are O(1). Operations on groups of nodes are O(N) where N is either the number of flagged objects or the number of objects in the graph, as applicable.


Constructor Summary
FlagFilter(GraphPerspective graph)
          Deprecated. Standard Constructor.
FlagFilter(SelectFilter selectFilter)
          Deprecated. Constructor added so that FlagFilter can be properly deprecated
 
Method Summary
 void addFlagEventListener(FlagEventListener listener)
          Deprecated. If the argument is not already a listener to this object, it is added.
 Set flagAllEdges()
          Deprecated. Sets the flagged state to true for all Edges in the GraphPerspective.
 Set flagAllNodes()
          Deprecated. Sets the flagged state to true for all Nodes in the GraphPerspective.
 List getFlagEventListeners()
          Deprecated. Gets a List of All Registered Listeners.
 Set getFlaggedEdges()
          Deprecated. Returns the set of all flagged edges in the referenced GraphPespective.
 Set getFlaggedNodes()
          Deprecated. Returns the set of all flagged nodes in the referenced GraphPespective.
 void graphPerspectiveChanged(GraphPerspectiveChangeEvent event)
          Deprecated. Implementation of the GraphPerspectiveChangeListener interface.
 boolean isFlagged(Edge edge)
          Deprecated. Returns true if the argument is a flagged Edge in the referenced GraphPerspective, false otherwise.
 boolean isFlagged(Node node)
          Deprecated. Returns true if the argument is a flagged Node in the referenced GraphPerspective, false otherwise.
 boolean passesFilter(Object o)
          Deprecated. Implementation of the Filter interface.
 void removeFlagEventListener(FlagEventListener listener)
          Deprecated. If the argument is a listener to this object, removes it from the list of listeners.
 boolean setFlagged(Edge edge, boolean newState)
          Deprecated. If the first argument is an Edge in the referenced GraphPerspective, sets its flagged state to the value of the second argument.
 boolean setFlagged(Node node, boolean newState)
          Deprecated. If the first argument is a Node in the referenced GraphPerspective, sets its flagged state to the value of the second argument.
 Set setFlaggedEdges(Collection edgesToSet, boolean newState)
          Deprecated. Sets the flagged state defined by the second argument for all Edges contained in the first argument, which should be a Collection of Edge objects contained in the referenced GraphPerspective.
 Set setFlaggedNodes(Collection nodesToSet, boolean newState)
          Deprecated. Sets the flagged state defined by the second argument for all Nodes contained in the first argument, which should be a Collection of Node objects contained in the referenced GraphPerspective.
 Set unflagAllEdges()
          Deprecated. Sets the flagged state to false for all Edges in the GraphPerspective.
 Set unflagAllNodes()
          Deprecated. Sets the flagged state to false for all Nodes in the GraphPerspective.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlagFilter

public FlagFilter(GraphPerspective graph)
Deprecated. 
Standard Constructor. The argument is the graph that this filter will apply to; it cannot be null.

Throws:
NullPointerException - if the argument is null.

FlagFilter

public FlagFilter(SelectFilter selectFilter)
Deprecated. 
Constructor added so that FlagFilter can be properly deprecated

Parameters:
selectFilter - the SelectFilter that performs all the methods in this FlagFilter
Method Detail

getFlaggedNodes

public Set getFlaggedNodes()
Deprecated. 
Returns the set of all flagged nodes in the referenced GraphPespective.

WARNING: the returned set is the actual data object, not a copy. Don't directly modify this set.


getFlaggedEdges

public Set getFlaggedEdges()
Deprecated. 
Returns the set of all flagged edges in the referenced GraphPespective.

WARNING: the returned set is the actual data object, not a copy. Don't directly modify this set.


isFlagged

public boolean isFlagged(Node node)
Deprecated. 
Returns true if the argument is a flagged Node in the referenced GraphPerspective, false otherwise.


isFlagged

public boolean isFlagged(Edge edge)
Deprecated. 
Returns true if the argument is a flagged Edge in the referenced GraphPerspective, false otherwise.


passesFilter

public boolean passesFilter(Object o)
Deprecated. 
Implementation of the Filter interface. Returns true if the argument is a flagged Node or Edge in the referenced GraphPerspective, false otherwise.

Specified by:
passesFilter in interface Filter

setFlagged

public boolean setFlagged(Node node,
                          boolean newState)
Deprecated. 
If the first argument is a Node in the referenced GraphPerspective, sets its flagged state to the value of the second argument. An event will be fired iff the new state is different from the old state.

Returns:
true if an actual change was made, false otherwise

setFlagged

public boolean setFlagged(Edge edge,
                          boolean newState)
Deprecated. 
If the first argument is an Edge in the referenced GraphPerspective, sets its flagged state to the value of the second argument. An event will be fired iff the new state is different from the old state.

Returns:
true if an actual change was made, false otherwise

setFlaggedNodes

public Set setFlaggedNodes(Collection nodesToSet,
                           boolean newState)
Deprecated. 
Sets the flagged state defined by the second argument for all Nodes contained in the first argument, which should be a Collection of Node objects contained in the referenced GraphPerspective. One event will be fired for the full set of changes. This method does nothing if the first argument is null.

Returns:
a Set containing the objects for which the flagged state changed
Throws:
ClassCastException - if the first argument contains objects other than giny.model.Node objects

setFlaggedEdges

public Set setFlaggedEdges(Collection edgesToSet,
                           boolean newState)
Deprecated. 
Sets the flagged state defined by the second argument for all Edges contained in the first argument, which should be a Collection of Edge objects contained in the referenced GraphPerspective. One event will be fired for the full set of changes. This method does nothing if the first argument is null.

Returns:
a Set containing the objects for which the flagged state changed
Throws:
ClassCastException - if the first argument contains objects other than giny.model.Edge objects

flagAllNodes

public Set flagAllNodes()
Deprecated. 
Sets the flagged state to true for all Nodes in the GraphPerspective.

Returns:
a Set of nodes that changed state

flagAllEdges

public Set flagAllEdges()
Deprecated. 
Sets the flagged state to true for all Edges in the GraphPerspective.


unflagAllNodes

public Set unflagAllNodes()
Deprecated. 
Sets the flagged state to false for all Nodes in the GraphPerspective.


unflagAllEdges

public Set unflagAllEdges()
Deprecated. 
Sets the flagged state to false for all Edges in the GraphPerspective.


graphPerspectiveChanged

public void graphPerspectiveChanged(GraphPerspectiveChangeEvent event)
Deprecated. 
Implementation of the GraphPerspectiveChangeListener interface. Responds to the removal of nodes and edges by removing them from the set of flagged graph objects if needed. Fires an event only if there was an actual change in the current flagged set.

Specified by:
graphPerspectiveChanged in interface GraphPerspectiveChangeListener

addFlagEventListener

public void addFlagEventListener(FlagEventListener listener)
Deprecated. 
If the argument is not already a listener to this object, it is added. Does nothing if the argument is null.


removeFlagEventListener

public void removeFlagEventListener(FlagEventListener listener)
Deprecated. 
If the argument is a listener to this object, removes it from the list of listeners.


getFlagEventListeners

public List getFlagEventListeners()
Deprecated. 
Gets a List of All Registered Listeners.

Returns:

www.cytoscape.org