org.severe.jripples.eig
Class JRipplesEIG

java.lang.Object
  extended by org.severe.jripples.eig.JRipplesEIG

public final class JRipplesEIG
extends java.lang.Object

A software system can be viewed as a set of components and their interoperations and can be formally modeled as graph. In a nutshell, in this graph components are represented as nodes and interactions are represented as edges among the nodes. As the software evolves and changes, its components change too. Moreover, a change, introduced in a one component, may propagate through the interoperation dependencies to other components as well. To reflect the change process in the graph, we use marks.

The described graph, which contains components, their interoperations, marks and has a set of propagation rules defined, is called Evolving Interoperation Graph (EIG).

JRipples EIG is created by

  1. setting up a project under analysis,
  2. setting up a main class to an analysis from,
  3. adding IMember Java Elements of the project under analysis to wrapped with JRipples EIG nodes
  4. adding edges between created nodes

There is only one instance of JRipplesEIG is created during JRipples plug-in lifecycle and thus only one project can be analyzed in the same time. Consequently, most of the JRipplesEIG methods are static and refer to the same dependency graph.

Even though storing in the same way, JRipples EIG classifies every node as a top node or a member node based on whether underlying IMember object is a top in a class nesting hierarchy.

Here is a short example on how JRipples EIG is typically used:

 

 JRipplesEIG.initEIG();
 
 JRipplesEIG.setProject((IProject) someProject);
 JRipplesEIG.setMainClass((IType) someType);

JRipplesEIG.doLock(this);
 JRipplesEIGNode node1=JRippelsEIG.addNode((IMember) member1);
 JRipplesEIGNode node2=JRippelsEIG.addNode((IMember) member2);
 JRipplesEIGNode node3=JRippelsEIG.addNode((IMember) member3);
 
 JRippelsEIGEdge edge1=JRippelsEIG.addEdge(node1, node2);
 JRippelsEIGEdge edge1=JRippelsEIG.addEdge(node1, JRipplesEIG.getNode((IMember)member2));
 JRippelsEIGEdge edge1=JRippelsEIG.addEdge(JRipplesEIG.getNode((IMember)member3), JRipplesEIG.getNode((IMember)member2));
 JRipplesEIG.doUnLock(this); //All the EIG listeners will be notified of the changes
 
 ...some logic...
 
 JRipplesEIG.doLock(this);
 
 node1.setMark("Changed");
 JRipplesEIG.removeNode(node2);
 node3.setMark("Visited");
 
 JRipplesEIG.doUnLock(this); //All the EIG listeners will be notified of the changes
 
 node3.setProbability("12"); //All the EIG listeners will be notified of the change
 
 
 

Author:
Maksym Petrenko
See Also:
initEIG(), setProject(IProject), setMainClass(IType), addNode(IMember), addEdge(JRipplesEIGNode, JRipplesEIGNode), JRipplesEIGNode, JRipplesEIGEdge

Field Summary
static int DIRECTION_CONSIDERED_BOTH_CALLING_AND_CALLED
          direction constant indicating that both called and calling nodes should be returned
to be used with edgesToNeigbors(Set, int, int)
static int DIRECTION_CONSIDERED_CALLED_NODES_ONLY
          direction constant indicating that only called nodes (nodes, that are called from the supplied centralNode) should be returned
to be used with edgesToNeigbors(Set, int, int)
static int DIRECTION_CONSIDERED_CALLING_NODES_ONLY
          direction constant indicating that only calling nodes (nodes, that call the supplied centralNode) should be returned
to be used with edgesToNeigbors(Set, int, int)
static int NESTING_CONSIDERED_BOTH_TOP_AND_MEMBER_NODES
          nesting constant indicating that both top and member nodes should be returned
to be used with edgesToNeigbors(Set, int, int)
static int NESTING_CONSIDERED_MEMBER_NODES_ONLY
          nesting constant indicating that only member nodes should be returned
to be used with edgesToNeigbors(Set, int, int)
static int NESTING_CONSIDERED_TOP_NODES_ONLY
          nesting constant indicating that only top nodes should be returned
to be used with edgesToNeigbors(Set, int, int)
 
Method Summary
static JRipplesEIGEdge addEdge(JRipplesEIGNode nodeFrom, JRipplesEIGNode nodeTo)
          Creates and adds to the JRipples EIG an edge connecting two supplied nodes:
( fromNode O-------------------------> toNode )
Please note, that the edge is omni-directional, that is fromNode->toNode does not imply toNode->fromNode.
static void addJRipplesEIGListener(JRipplesEIGListener listener)
          Registers a JRipplesEIGListener to receive updates on lyficycle and content events of JRipples EIG nodes and edges
static JRipplesEIGNode addNode(org.eclipse.jdt.core.IMember nodeIMember)
          Creates and adds to the JRipples EIG a node that wraps a supplied IMember object
static boolean canRedo()
          Checks if there are any operations, availbale for redo.
static boolean canUndo()
          Checks if there are any operations, availbale for undo.
static void clearHistory()
          Clears the list of operations, availbale for undo and redo.
static void doLock(java.lang.Object lockingObj)
          Notifies JRipples EIG that all lifecycle and content changes to EIG nodes and edges that will follow until the doUnLock(Object) is called, should be treated as a one event.
static void doUnLock(java.lang.Object lockingObj)
          Unlocks JRipples EIG and notifies all listers, registered with the EIG, of the all changes that occured during the event that has ended.
static java.util.HashSet<JRipplesEIGNode> edgesToNeigbors(java.util.Set<JRipplesEIGNode> nodes, int directionConsidered, int nestingConsidered)
          Based on supplied parameters, returns a set of JRippelsEIGNodes that contain either top nodes, or member nodes, or both that either call, or are called, or both by any of the supplied nodes (directly, but not transitively through the nodes's members)
Direction constants: DIRECTION_CONSIDERED_BOTH_CALLING_AND_CALLED DIRECTION_CONSIDERED_CALLING_NODES_ONLY DIRECTION_CONSIDERED_CALLED_NODES_ONLY
Nesting constants: NESTING_CONSIDERED_BOTH_TOP_AND_MEMBER_NODES NESTING_CONSIDERED_TOP_NODES_ONLY NESTING_CONSIDERED_MEMBER_NODES_ONLY
static boolean existsEdge(JRipplesEIGNode nodeFrom, JRipplesEIGNode nodeTo)
          Checks whether JRipples EIG contains an edge between two given nodes.
static boolean existsNode(org.eclipse.jdt.core.IMember nodeMember)
          Checks whether JRipples EIG database contains a node with provided IMember object.
static JRipplesEIGNode findParentNodeForMemberNode(JRipplesEIGNode node)
          Finds a parent node for a supplied member node.
static JRipplesEIGNode findTopNodeForIMember(org.eclipse.jdt.core.IMember member)
          Finds a top node, whose underlying IMember object declares the supplied member parameter.
static JRipplesEIGNode findTopNodeForMemberNode(JRipplesEIGNode node)
          Finds a top node for a supplied member node.
static void flattenEIG()
           
static JRipplesEIGNode[] getAllAnyNodeNeighbors(JRipplesEIGNode node)
          Returns both top and member nodes that both call and are called by both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters
static JRipplesEIGEdge[] getAllEdges()
          Returns all the edges, registered with this EIG (that is, created with addEdge(JRipplesEIGNode, JRipplesEIGNode) method).
static JRipplesEIGNode[] getAllMemberNodeNeighbors(JRipplesEIGNode node)
          Returns member nodes that both call and are called by both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters
static JRipplesEIGNode[] getAllNodes()
          Returns all the nodes, registered with this EIG (that is, created with addNode(IMember) method).
static JRipplesEIGNode[] getAllTopNodeNeighbors(JRipplesEIGNode node)
          Returns top nodes that both call and are called by both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters
static JRipplesEIGEdge getEdge(JRipplesEIGNode nodeFrom, JRipplesEIGNode nodeTo)
          Returns previously created edge between two nodes, if one found in JRipples EIG.
Please note, that the edge is omni-directional, that is request for fromNode->toNode edge will not return toNode->fromNode edge even if such exists.
static JRipplesEIG getEIG()
          Returns an instance of JRipples EIG.
static JRipplesEIGNode[] getIncomingAnyNodeNeighbors(JRipplesEIGNode node)
          Returns both top and member nodes that call both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters
static JRipplesEIGNode[] getIncomingMemberNodeNeighbors(JRipplesEIGNode node)
          Returns member nodes that call both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters
static JRipplesEIGNode[] getIncomingTopNodeNeighbors(JRipplesEIGNode node)
          Returns top nodes that call both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters
static org.eclipse.jdt.core.IType getMainClass()
          Returns the main class (a class to start the analysis from) of a project under analysis, usually chosen through "JRipples > Start" menu.
static JRipplesEIGNode getNode(org.eclipse.jdt.core.IMember nodeMember)
          Checks whether JRipples EIG database contains a node with provided IMember object and returns it if any.
static JRipplesEIGNode[] getNodeMembers(JRipplesEIGNode node)
          Returns member nodes, whose underlying IMember Java elements are defined within IMember Java element of a supplied top node.
static JRipplesEIGNode[] getOutgoingAnyNodeNeighbors(JRipplesEIGNode node)
          Returns both top and member nodes that are called by both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters
static JRipplesEIGNode[] getOutgoingMemberNodeNeighbors(JRipplesEIGNode node)
          Returns member nodes that are called by both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters
static JRipplesEIGNode[] getOutgoingTopNodeNeighbors(JRipplesEIGNode node)
          Returns top nodes that are called by both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters
static org.eclipse.core.resources.IProject getProject()
          Returns a project under analysis, usually chosen through "JRipples > Start" menu.
static JRipplesEIGNode[] getTopNodes()
          Returns all the top nodes (nodes, whose underlying IMember object is top class hierarchy), registered with this EIG.
static void initEIG()
          Reinitializes JRipples EIG for a new analysis - that is, it deletes all nodes and edges from the database and clears undo / redo history.
static boolean isInitialized()
          Checks whether the JRipples EIG is inialized for analysis - that is, whether a main project and main class are set, and whether EIG has at least one node registered with it.
static boolean isLocked()
          Checks is the JRipples EIG is locked.
static void redo()
          Cancels the last undo operation.
static void removeEdge(JRipplesEIGEdge edge)
          Removes an edge from the JRipples EIG.
static void removeJRipplesEIGListener(JRipplesEIGListener listener)
          Unregisters a listener, previously registered with addJRipplesEIGListener(JRipplesEIGListener).
static void removeNode(JRipplesEIGNode node)
          Removes a node from the JRipples EIG.
static void setMainClass(org.eclipse.jdt.core.IType type)
          Sets a main class (a class to start the analysis from) of a project under analysis, usually chosen through "JRipples > Start" menu.
static void setProject(org.eclipse.core.resources.IProject proj)
          Sets a project under analysis, usually chosen through "JRipples > Start" menu.
static void undo()
          Cancels the most recent node and/or edge content operation or set of the operations on JRipples EIG.
Content operations are changes in marks and probabilities of nodes and edges.
Any content operation, done between calls of doLock(Object) and doUnLock(Object) methods will be grouped into a single set of operations and, thus, canceled as such.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIRECTION_CONSIDERED_CALLING_NODES_ONLY

public static final int DIRECTION_CONSIDERED_CALLING_NODES_ONLY
direction constant indicating that only calling nodes (nodes, that call the supplied centralNode) should be returned
to be used with edgesToNeigbors(Set, int, int)

See Also:
Constant Field Values

DIRECTION_CONSIDERED_BOTH_CALLING_AND_CALLED

public static final int DIRECTION_CONSIDERED_BOTH_CALLING_AND_CALLED
direction constant indicating that both called and calling nodes should be returned
to be used with edgesToNeigbors(Set, int, int)

See Also:
Constant Field Values

DIRECTION_CONSIDERED_CALLED_NODES_ONLY

public static final int DIRECTION_CONSIDERED_CALLED_NODES_ONLY
direction constant indicating that only called nodes (nodes, that are called from the supplied centralNode) should be returned
to be used with edgesToNeigbors(Set, int, int)

See Also:
Constant Field Values

NESTING_CONSIDERED_TOP_NODES_ONLY

public static final int NESTING_CONSIDERED_TOP_NODES_ONLY
nesting constant indicating that only top nodes should be returned
to be used with edgesToNeigbors(Set, int, int)

See Also:
Constant Field Values

NESTING_CONSIDERED_BOTH_TOP_AND_MEMBER_NODES

public static final int NESTING_CONSIDERED_BOTH_TOP_AND_MEMBER_NODES
nesting constant indicating that both top and member nodes should be returned
to be used with edgesToNeigbors(Set, int, int)

See Also:
Constant Field Values

NESTING_CONSIDERED_MEMBER_NODES_ONLY

public static final int NESTING_CONSIDERED_MEMBER_NODES_ONLY
nesting constant indicating that only member nodes should be returned
to be used with edgesToNeigbors(Set, int, int)

See Also:
Constant Field Values
Method Detail

getEIG

public static JRipplesEIG getEIG()
Returns an instance of JRipples EIG. JRipples EIG instance is created once the JRipples plugin is activated and remains the same throughout the plug-in lifycycle.

Returns:
the instance of JRipples EIG

initEIG

public static void initEIG()
Reinitializes JRipples EIG for a new analysis - that is, it deletes all nodes and edges from the database and clears undo / redo history.
Please note, that project and main class are not reset.


isInitialized

public static boolean isInitialized()
Checks whether the JRipples EIG is inialized for analysis - that is, whether a main project and main class are set, and whether EIG has at least one node registered with it.

Returns:
true if the JRipples EIG is inialized for analysis,
null otherwise
See Also:
getProject(), getMainClass(), getAllNodes()

setProject

public static void setProject(org.eclipse.core.resources.IProject proj)
Sets a project under analysis, usually chosen through "JRipples > Start" menu.

Parameters:
proj - a project this JRipples EIG analysis reffers to
See Also:
getProject(), getMainClass(), setMainClass(IType)

getProject

public static org.eclipse.core.resources.IProject getProject()
Returns a project under analysis, usually chosen through "JRipples > Start" menu.

Returns:
a project this JRipples EIG analysis reffers to
See Also:
setProject(IProject), getMainClass(), setMainClass(IType)

setMainClass

public static void setMainClass(org.eclipse.jdt.core.IType type)
Sets a main class (a class to start the analysis from) of a project under analysis, usually chosen through "JRipples > Start" menu.

Parameters:
type - a main class of a project this JRipples EIG analysis reffers to
See Also:
getProject(), setProject(IProject), getMainClass()

getMainClass

public static org.eclipse.jdt.core.IType getMainClass()
Returns the main class (a class to start the analysis from) of a project under analysis, usually chosen through "JRipples > Start" menu.

Returns:
a main class of a project this JRipples EIG analysis reffers to
See Also:
getProject(), setProject(IProject), setMainClass(IType)

addNode

public static JRipplesEIGNode addNode(org.eclipse.jdt.core.IMember nodeIMember)
Creates and adds to the JRipples EIG a node that wraps a supplied IMember object

Returns:
an existing node if one found in JRipples EIG,
a created node if there was no such node declared before,
null if the supplied IMember object is null

removeNode

public static void removeNode(JRipplesEIGNode node)
Removes a node from the JRipples EIG. It also removes all edges, associated with this node. If the node is top, the same set of actions will be applied to all member node of this node as well - the member nodes together with their associated edges will be removed from the JRipples EIG.

Parameters:
node - node to remove
See Also:
getNodeMembers(JRipplesEIGNode), JRipplesEIGNode.isTop(), removeEdge(JRipplesEIGEdge)

existsNode

public static boolean existsNode(org.eclipse.jdt.core.IMember nodeMember)
Checks whether JRipples EIG database contains a node with provided IMember object.

Parameters:
nodeMember - underlying IMember object of a node to find
Returns:
true if JRipples EIG database contains a node with provided IMember object,
false otherwise
See Also:
JRipplesEIGNode.getNodeIMember(), getNode(IMember)

getNode

public static JRipplesEIGNode getNode(org.eclipse.jdt.core.IMember nodeMember)
Checks whether JRipples EIG database contains a node with provided IMember object and returns it if any.

Parameters:
nodeMember - underlying IMember object of a node to return
Returns:
a node with supplied underlying IMember object if JRipples EIG database contains such a node ,
null otherwise
See Also:
existsNode(IMember), JRipplesEIGNode.getNodeIMember()

getAllNodes

public static JRipplesEIGNode[] getAllNodes()
Returns all the nodes, registered with this EIG (that is, created with addNode(IMember) method).

Returns:
all the nodes, registered with this EIG (that is, created with addNode(IMember) method),
or empty array if no node was found.

getTopNodes

public static JRipplesEIGNode[] getTopNodes()
Returns all the top nodes (nodes, whose underlying IMember object is top class hierarchy), registered with this EIG.

Returns:
all the top nodes, registered with this EIG,
or empty array if no top node was found.

getNodeMembers

public static JRipplesEIGNode[] getNodeMembers(JRipplesEIGNode node)
Returns member nodes, whose underlying IMember Java elements are defined within IMember Java element of a supplied top node.

Parameters:
node - node, whose member nodes should be returned
Returns:
nodes, whose underlying IMember Java elements are defined within IMember Java element of a supplied top node, if any,
empty array otherwise
See Also:
JRipplesEIGNode.isTop(), getTopNodes(), findTopNodeForMemberNode(JRipplesEIGNode)

findTopNodeForIMember

public static JRipplesEIGNode findTopNodeForIMember(org.eclipse.jdt.core.IMember member)
Finds a top node, whose underlying IMember object declares the supplied member parameter.

Parameters:
member - member object, for which a top node should be found
Returns:
a node, if any, whose underlying IMember object declares the supplied member parameter,
or null otherwise
See Also:
getTopNodes(), getNodeMembers(JRipplesEIGNode), findTopNodeForMemberNode(JRipplesEIGNode), JRipplesEIGNode.isTop()

findTopNodeForMemberNode

public static JRipplesEIGNode findTopNodeForMemberNode(JRipplesEIGNode node)
Finds a top node for a supplied member node.

Parameters:
node -
Returns:
the supplied node if it is top,
a top node, whose underlying IMember Java element declares underlying IMember Java element of the supplied node,
null otherwise
See Also:
JRipplesEIGNode.isTop(), getNodeMembers(JRipplesEIGNode), getTopNodes()

findParentNodeForMemberNode

public static JRipplesEIGNode findParentNodeForMemberNode(JRipplesEIGNode node)
Finds a parent node for a supplied member node.

Parameters:
node -
Returns:
the supplied node if it is top,
a parent node, whose underlying IMember Java element declares underlying IMember Java element of the supplied node,
null otherwise
See Also:
JRipplesEIGNode.isTop(), getNodeMembers(JRipplesEIGNode), getTopNodes()

edgesToNeigbors

public static java.util.HashSet<JRipplesEIGNode> edgesToNeigbors(java.util.Set<JRipplesEIGNode> nodes,
                                                                 int directionConsidered,
                                                                 int nestingConsidered)
Based on supplied parameters, returns a set of JRippelsEIGNodes that contain
Direction constants:
Nesting constants:

Parameters:
nodes - Set of JRipplesEIGNode nodes, of which direct (not transitive through the node's members) neighbors should be returned
directionConsidered - whether to return neighbors that only call, are called by, or do both to the supplied nodes
nestingConsidered - whether to return neighbors that are top nodes, member nodes, or both
Returns:
Set of JRipplesEIGNode nodes that satisfy specified requirements; set may be empty
See Also:
getAllAnyNodeNeighbors(JRipplesEIGNode), getAllTopNodeNeighbors(JRipplesEIGNode), getAllMemberNodeNeighbors(JRipplesEIGNode), getIncomingAnyNodeNeighbors(JRipplesEIGNode), getIncomingTopNodeNeighbors(JRipplesEIGNode), getIncomingMemberNodeNeighbors(JRipplesEIGNode), getOutgoingAnyNodeNeighbors(JRipplesEIGNode), getOutgoingTopNodeNeighbors(JRipplesEIGNode), getOutgoingMemberNodeNeighbors(JRipplesEIGNode)

getAllTopNodeNeighbors

public static JRipplesEIGNode[] getAllTopNodeNeighbors(JRipplesEIGNode node)
Returns top nodes that both call and are called by both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters

Parameters:
node - node, whose neighboring nodes should be returned
Returns:
neighboring nodes

getIncomingTopNodeNeighbors

public static JRipplesEIGNode[] getIncomingTopNodeNeighbors(JRipplesEIGNode node)
Returns top nodes that call both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters

Parameters:
node - node, whose neighboring nodes should be returned
Returns:
neighboring nodes

getOutgoingTopNodeNeighbors

public static JRipplesEIGNode[] getOutgoingTopNodeNeighbors(JRipplesEIGNode node)
Returns top nodes that are called by both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters

Parameters:
node - node, whose neighboring nodes should be returned
Returns:
neighboring nodes

getAllMemberNodeNeighbors

public static JRipplesEIGNode[] getAllMemberNodeNeighbors(JRipplesEIGNode node)
Returns member nodes that both call and are called by both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters

Parameters:
node - node, whose neighboring nodes should be returned
Returns:
neighboring nodes

getIncomingMemberNodeNeighbors

public static JRipplesEIGNode[] getIncomingMemberNodeNeighbors(JRipplesEIGNode node)
Returns member nodes that call both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters

Parameters:
node - node, whose neighboring nodes should be returned
Returns:
neighboring nodes

getOutgoingMemberNodeNeighbors

public static JRipplesEIGNode[] getOutgoingMemberNodeNeighbors(JRipplesEIGNode node)
Returns member nodes that are called by both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters

Parameters:
node - node, whose neighboring nodes should be returned
Returns:
neighboring nodes

getAllAnyNodeNeighbors

public static JRipplesEIGNode[] getAllAnyNodeNeighbors(JRipplesEIGNode node)
Returns both top and member nodes that both call and are called by both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters

Parameters:
node - node, whose neighboring nodes should be returned
Returns:
neighboring nodes

getIncomingAnyNodeNeighbors

public static JRipplesEIGNode[] getIncomingAnyNodeNeighbors(JRipplesEIGNode node)
Returns both top and member nodes that call both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters

Parameters:
node - node, whose neighboring nodes should be returned
Returns:
neighboring nodes

getOutgoingAnyNodeNeighbors

public static JRipplesEIGNode[] getOutgoingAnyNodeNeighbors(JRipplesEIGNode node)
Returns both top and member nodes that are called by both the supplied node and it's member nodes if any
Works by calling edgesToNeigbors(Set, int, int) method with predefined parameters

Parameters:
node - node, whose neighboring nodes should be returned
Returns:
neighboring nodes

addEdge

public static JRipplesEIGEdge addEdge(JRipplesEIGNode nodeFrom,
                                      JRipplesEIGNode nodeTo)
Creates and adds to the JRipples EIG an edge connecting two supplied nodes:
( fromNode O-------------------------> toNode )
Please note, that the edge is omni-directional, that is fromNode->toNode does not imply toNode->fromNode.

Parameters:
nodeFrom - a node, from which this dependency originates
nodeTo - a node, to which which this dependency points
Returns:
an existing edge if one found in JRipples EIG,
a created edge if there was no such edge declared before,
null if one or both of the supplied nodes is null, or nodes are equal, or nodes are declared within the same top class

flattenEIG

public static void flattenEIG()

getEdge

public static JRipplesEIGEdge getEdge(JRipplesEIGNode nodeFrom,
                                      JRipplesEIGNode nodeTo)
Returns previously created edge between two nodes, if one found in JRipples EIG.
Please note, that the edge is omni-directional, that is request for fromNode->toNode edge will not return toNode->fromNode edge even if such exists.

Parameters:
nodeFrom - a node, from which this dependency originates
nodeTo - a node, to which which this dependency points
Returns:
previously created edge between two nodes, if one found in JRipples EIG,
null otherwise

getAllEdges

public static JRipplesEIGEdge[] getAllEdges()
Returns all the edges, registered with this EIG (that is, created with addEdge(JRipplesEIGNode, JRipplesEIGNode) method).

Returns:
all the edges, registered with this EIG (that is, created with addEdge(JRipplesEIGNode, JRipplesEIGNode) method).

removeEdge

public static void removeEdge(JRipplesEIGEdge edge)
Removes an edge from the JRipples EIG.

Parameters:
edge - edge to remove

existsEdge

public static boolean existsEdge(JRipplesEIGNode nodeFrom,
                                 JRipplesEIGNode nodeTo)
Checks whether JRipples EIG contains an edge between two given nodes.
Please note, that this operation is omni-directional, that is existsEdge(A,B)==true does not imply existsEdge(B,A)==true

Parameters:
nodeFrom - a node, from which this edge originates
nodeTo - a node, to which this to which which this dependency points
Returns:
true if an edge between two given nodes exists,
false otherwise

addJRipplesEIGListener

public static void addJRipplesEIGListener(JRipplesEIGListener listener)
Registers a JRipplesEIGListener to receive updates on lyficycle and content events of JRipples EIG nodes and edges

Parameters:
listener - Listener to register

removeJRipplesEIGListener

public static void removeJRipplesEIGListener(JRipplesEIGListener listener)
Unregisters a listener, previously registered with addJRipplesEIGListener(JRipplesEIGListener).

Parameters:
listener - Listener to unregister

isLocked

public static boolean isLocked()
Checks is the JRipples EIG is locked. This usually means that some changes are done EIG and more changes should follow, and thus it is better to wait until the EIG is unlocked. See doLock(Object) for more details.

Returns:
true if the JRipples EIG is locked,
false otherwise

doLock

public static void doLock(java.lang.Object lockingObj)
Notifies JRipples EIG that all lifecycle and content changes to EIG nodes and edges that will follow until the doUnLock(Object) is called, should be treated as a one event.
All the changes, done within this time frame, can be undone or redone simultaneously as a one operation.
No lister, registered with the EIG, is notified of changes until the doUnLock(Object) is called to unlock the EIG.
Has no effect if EIG is already locked (which probably means that the object was called as a result of actions in another object and thus an events of this object are a part of a bigger event). Still, even if the EIG is locked, doLock(Object) and doUnLock(Object) should be used to ensure the correctness of the organization of events.
Please note, that it is a responsibility of the locking object to call the doUnLock(Object) as JRipples EIG does not do any checks on the objectís status and thus locking state persists while the object is alive.

Parameters:
lockingObj - object that starts a sequence of actions;
the same object should be used as a parameter to doUnLock(Object) method to unlock the EIG.
See Also:
doUnLock(Object), isLocked()

doUnLock

public static void doUnLock(java.lang.Object lockingObj)
Unlocks JRipples EIG and notifies all listers, registered with the EIG, of the all changes that occured during the event that has ended.
Has no effect if the lockingObj is not a one used to lock the EIG.

Parameters:
lockingObj - the same object that was used to lock the EIG with the doLock(Object) command
See Also:
doLock(Object), isLocked()

clearHistory

public static void clearHistory()
Clears the list of operations, availbale for undo and redo.

See Also:
undo(), redo()

undo

public static void undo()
Cancels the most recent node and/or edge content operation or set of the operations on JRipples EIG.
Content operations are changes in marks and probabilities of nodes and edges.
Any content operation, done between calls of doLock(Object) and doUnLock(Object) methods will be grouped into a single set of operations and, thus, canceled as such.

See Also:
redo()

redo

public static void redo()
Cancels the last undo operation.

See Also:
undo()

canRedo

public static boolean canRedo()
Checks if there are any operations, availbale for redo.

Returns:
true if there are any operations, availbale for redo
false otherwise
See Also:
redo()

canUndo

public static boolean canUndo()
Checks if there are any operations, availbale for undo.

Returns:
true if there are any operations, availbale for undo
false otherwise
See Also:
undo()