Cytoscape 2.8.0 API

cytoscape.groups
Class CyGroupImpl

java.lang.Object
  extended by cytoscape.groups.CyGroupImpl
All Implemented Interfaces:
CyGroup

public class CyGroupImpl
extends Object
implements CyGroup

The CyGroup class provides the implementation for a group model that maintains the list of nodes belonging to a group, the parent of a particular group, and the node that represents the group. Group information is stored in the CyGroup itself, as well as in special group attributes that are associated with the network, nodes, and edges involved. These attributes provide a natural mechanism for the saving and restoration of groups. There are also opaque flags


Field Summary
 
Fields inherited from interface cytoscape.groups.CyGroup
GROUP_LOCAL_ATTR, GROUP_STATE_ATTR, GROUP_VIEWER_ATTR, MEMBER_LIST_ATTR
 
Constructor Summary
protected CyGroupImpl()
          Empty constructor
protected CyGroupImpl(CyNode groupNode)
          Constructor to create an empty group when the group node is specified.
protected CyGroupImpl(CyNode groupNode, List<CyNode> nodeList)
          Constructor to create a group with the listed nodes as initial members, and a predetermined CyNode to act as the group Node.
protected CyGroupImpl(CyNode groupNode, List<CyNode> nodeList, List<CyEdge> internalEdges, List<CyEdge> externalEdges, CyNetwork network)
          Constructor to create an empty group.
protected CyGroupImpl(String groupName)
          Constructor to create an empty group
protected CyGroupImpl(String groupName, List<CyNode> nodeList)
          Constructor to create a group with the listed nodes as initial members.
 
Method Summary
 void addInnerEdge(CyEdge edge)
          Add an inner edge to the map.
 void addNode(CyNode node)
          Add a new node to this group
 void addNode(CyNode node, boolean addEdges)
          Add a new node to this group
 void addOuterEdge(CyEdge edge)
          Add an outer edge to the map.
 boolean contains(CyNode node)
          Determine if a node is a member of this group
 CyNetwork getGraphPerspective()
          Return a CyNetwork that represents the internal components of this group
 String getGroupName()
          Return the name of this group
 CyNode getGroupNode()
          Get the CyNode that represents this group
 List<CyEdge> getInnerEdges()
          Get all of the edges completely contained within this group
 CyNetwork getNetwork()
          Get the network this group is a member of
 Iterator<CyNode> getNodeIterator()
          Get an iterator over all of the nodes in this group
 List<CyNode> getNodes()
          Get all of the nodes in this group
 List<CyEdge> getOuterEdges()
          Get all of the edges partially contained within this group
 int getState()
          Get the state of the group
 String getViewer()
          Get the name of the viewer for this group
 Object getViewValue()
          Get the viewValue for the group
 void removeInnerEdge(CyEdge edge)
          Remove an inner edge from the map.
 void removeNode(CyNode node)
          Remove a node from a group
 void removeOuterEdge(CyEdge edge)
          Remove an outer edge from the map.
 void setGroupName(String name)
          Set the name of this group
 void setNetwork(CyNetwork network, boolean notify)
          Set (or change) the network fro this group
 void setState(int state)
          Set the state of the group.
protected  void setViewer(String viewerName)
          Set the viewer for this group.
 void setViewValue(Object viewValue)
          Set the viewValue for the group
 String toString()
          Provide the default toString method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CyGroupImpl

protected CyGroupImpl()
Empty constructor


CyGroupImpl

protected CyGroupImpl(CyNode groupNode,
                      List<CyNode> nodeList,
                      List<CyEdge> internalEdges,
                      List<CyEdge> externalEdges,
                      CyNetwork network)
Constructor to create an empty group.

Parameters:
groupNode - the CyNode to use for this group
nodeList - the initial set of nodes for this group
internalEdges - the initial set of internal edges for this group
externalEdges - the initial set of external edges for this group
network - the network this group is part of

CyGroupImpl

protected CyGroupImpl(String groupName)
Constructor to create an empty group

Parameters:
groupName - the identifier to use for this group -- should be unique!

CyGroupImpl

protected CyGroupImpl(CyNode groupNode)
Constructor to create an empty group when the group node is specified.

Parameters:
groupNode - the CyNode to use for this group

CyGroupImpl

protected CyGroupImpl(CyNode groupNode,
                      List<CyNode> nodeList)
Constructor to create a group with the listed nodes as initial members, and a predetermined CyNode to act as the group Node.

Parameters:
groupNode - the group node to use for this group
nodeList - the initial set of nodes for this group

CyGroupImpl

protected CyGroupImpl(String groupName,
                      List<CyNode> nodeList)
Constructor to create a group with the listed nodes as initial members.

Parameters:
groupName - the identifier to use for this group -- should be unique!
nodeList - the initial set of nodes for this group
Method Detail

getGroupName

public String getGroupName()
Return the name of this group

Specified by:
getGroupName in interface CyGroup

setGroupName

public void setGroupName(String name)
Set the name of this group


getNodes

public List<CyNode> getNodes()
Get all of the nodes in this group

Specified by:
getNodes in interface CyGroup
Returns:
list of nodes in the group

getGroupNode

public CyNode getGroupNode()
Get the CyNode that represents this group

Specified by:
getGroupNode in interface CyGroup
Returns:
CyNode representing the group

getNodeIterator

public Iterator<CyNode> getNodeIterator()
Get an iterator over all of the nodes in this group

Specified by:
getNodeIterator in interface CyGroup
Returns:
node iterator

getInnerEdges

public List<CyEdge> getInnerEdges()
Get all of the edges completely contained within this group

Specified by:
getInnerEdges in interface CyGroup
Returns:
list of edges in the group

getOuterEdges

public List<CyEdge> getOuterEdges()
Get all of the edges partially contained within this group

Specified by:
getOuterEdges in interface CyGroup
Returns:
list of edges in the group

addOuterEdge

public void addOuterEdge(CyEdge edge)
Add an outer edge to the map. Some viewers may need to do this if they add and remove edges, for example.

Specified by:
addOuterEdge in interface CyGroup
Parameters:
edge - the CyEdge to add to the outer edge map

removeOuterEdge

public void removeOuterEdge(CyEdge edge)
Remove an outer edge from the map. Some viewers may need to do this if they add and remove edges, for example.

Specified by:
removeOuterEdge in interface CyGroup
Parameters:
edge - the CyEdge to add to the outer edge map

addInnerEdge

public void addInnerEdge(CyEdge edge)
Add an inner edge to the map. Some viewers may need to do this if they add and remove edges, for example.

Specified by:
addInnerEdge in interface CyGroup
Parameters:
edge - the CyEdge to add to the innter edge map

removeInnerEdge

public void removeInnerEdge(CyEdge edge)
Remove an inner edge from the map. Some viewers may need to do this if they add and remove edges, for example.

Specified by:
removeInnerEdge in interface CyGroup
Parameters:
edge - the CyEdge to add to the innter edge map

getNetwork

public CyNetwork getNetwork()
Get the network this group is a member of

Specified by:
getNetwork in interface CyGroup
Returns:
the network, or null if this is a global group

setNetwork

public void setNetwork(CyNetwork network,
                       boolean notify)
Set (or change) the network fro this group

Specified by:
setNetwork in interface CyGroup
Parameters:
network - the network to change this group to
notify - whether to notify any viewers

contains

public boolean contains(CyNode node)
Determine if a node is a member of this group

Specified by:
contains in interface CyGroup
Parameters:
node - the CyNode to test
Returns:
true if node is a member of the group

getGraphPerspective

public CyNetwork getGraphPerspective()
Return a CyNetwork that represents the internal components of this group

Specified by:
getGraphPerspective in interface CyGroup
Returns:
the CyNetwork

setState

public void setState(int state)
Set the state of the group. Setting the state of a group has two byproducts. First, the attribute "__groupState" is set to the state value to allow persistance across saves and restores. Second, if there is a viewer for this group, it is informed that the state has changed. This is used by the metaNode viewer, for example to provide programmatic control of whether the group is expanded or collapsed.

Specified by:
setState in interface CyGroup
Parameters:
state - the state to set

getState

public int getState()
Get the state of the group

Specified by:
getState in interface CyGroup
Returns:
group state

setViewValue

public void setViewValue(Object viewValue)
Set the viewValue for the group

Parameters:
viewValue - the view value to set

getViewValue

public Object getViewValue()
Get the viewValue for the group

Returns:
the view value

toString

public String toString()
Provide the default toString method

Specified by:
toString in interface CyGroup
Overrides:
toString in class Object
Returns:
group name

setViewer

protected void setViewer(String viewerName)
Set the viewer for this group. In order to maintain the static tables correctly, this method is protected and CyGroup.setGroupViewer(group, viewer, notify) should be used instead.

Parameters:
viewerName - name of the viewer for the group

getViewer

public String getViewer()
Get the name of the viewer for this group

Specified by:
getViewer in interface CyGroup
Returns:
viewer for this group

addNode

public void addNode(CyNode node)
Add a new node to this group

Specified by:
addNode in interface CyGroup
Parameters:
node - the node to add

addNode

public void addNode(CyNode node,
                    boolean addEdges)
Add a new node to this group

Parameters:
node - the node to add

removeNode

public void removeNode(CyNode node)
Remove a node from a group

Specified by:
removeNode in interface CyGroup
Parameters:
node - the node to remove

Cytoscape 2.8.0 API

Copyright 2010 Cytoscape Consortium. All rights reserved.