|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.severe.jripples.eig.JRipplesEIG
public final class JRipplesEIG
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
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
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 |
---|
public static final int DIRECTION_CONSIDERED_CALLING_NODES_ONLY
edgesToNeigbors(Set, int, int)
public static final int DIRECTION_CONSIDERED_BOTH_CALLING_AND_CALLED
edgesToNeigbors(Set, int, int)
public static final int DIRECTION_CONSIDERED_CALLED_NODES_ONLY
edgesToNeigbors(Set, int, int)
public static final int NESTING_CONSIDERED_TOP_NODES_ONLY
edgesToNeigbors(Set, int, int)
public static final int NESTING_CONSIDERED_BOTH_TOP_AND_MEMBER_NODES
edgesToNeigbors(Set, int, int)
public static final int NESTING_CONSIDERED_MEMBER_NODES_ONLY
edgesToNeigbors(Set, int, int)
Method Detail |
---|
public static JRipplesEIG getEIG()
public static void initEIG()
public static boolean isInitialized()
true
if the JRipples EIG is inialized for analysis, null
otherwisegetProject()
,
getMainClass()
,
getAllNodes()
public static void setProject(org.eclipse.core.resources.IProject proj)
proj
- a project this JRipples EIG analysis reffers togetProject()
,
getMainClass()
,
setMainClass(IType)
public static org.eclipse.core.resources.IProject getProject()
setProject(IProject)
,
getMainClass()
,
setMainClass(IType)
public static void setMainClass(org.eclipse.jdt.core.IType type)
type
- a main class of a project this JRipples EIG analysis reffers togetProject()
,
setProject(IProject)
,
getMainClass()
public static org.eclipse.jdt.core.IType getMainClass()
getProject()
,
setProject(IProject)
,
setMainClass(IType)
public static JRipplesEIGNode addNode(org.eclipse.jdt.core.IMember nodeIMember)
null
if the supplied IMember object is null
public static void removeNode(JRipplesEIGNode node)
node
- node to removegetNodeMembers(JRipplesEIGNode)
,
JRipplesEIGNode.isTop()
,
removeEdge(JRipplesEIGEdge)
public static boolean existsNode(org.eclipse.jdt.core.IMember nodeMember)
nodeMember
- underlying IMember object of a node to find
true
if JRipples EIG database contains a node with provided
IMember object, false
otherwiseJRipplesEIGNode.getNodeIMember()
,
getNode(IMember)
public static JRipplesEIGNode getNode(org.eclipse.jdt.core.IMember nodeMember)
nodeMember
- underlying IMember object of a node to return
null
otherwiseexistsNode(IMember)
,
JRipplesEIGNode.getNodeIMember()
public static JRipplesEIGNode[] getAllNodes()
addNode(IMember)
method).
addNode(IMember)
method),public static JRipplesEIGNode[] getTopNodes()
public static JRipplesEIGNode[] getNodeMembers(JRipplesEIGNode node)
node
- node, whose member nodes should be returned
JRipplesEIGNode.isTop()
,
getTopNodes()
,
findTopNodeForMemberNode(JRipplesEIGNode)
public static JRipplesEIGNode findTopNodeForIMember(org.eclipse.jdt.core.IMember member)
member
- member object, for which a top node should be found
null
otherwisegetTopNodes()
,
getNodeMembers(JRipplesEIGNode)
,
findTopNodeForMemberNode(JRipplesEIGNode)
,
JRipplesEIGNode.isTop()
public static JRipplesEIGNode findTopNodeForMemberNode(JRipplesEIGNode node)
node
-
null
otherwiseJRipplesEIGNode.isTop()
,
getNodeMembers(JRipplesEIGNode)
,
getTopNodes()
public static JRipplesEIGNode findParentNodeForMemberNode(JRipplesEIGNode node)
node
-
null
otherwiseJRipplesEIGNode.isTop()
,
getNodeMembers(JRipplesEIGNode)
,
getTopNodes()
public static java.util.HashSet<JRipplesEIGNode> edgesToNeigbors(java.util.Set<JRipplesEIGNode> nodes, int directionConsidered, int nestingConsidered)
DIRECTION_CONSIDERED_BOTH_CALLING_AND_CALLED
DIRECTION_CONSIDERED_CALLING_NODES_ONLY
DIRECTION_CONSIDERED_CALLED_NODES_ONLY
NESTING_CONSIDERED_BOTH_TOP_AND_MEMBER_NODES
NESTING_CONSIDERED_TOP_NODES_ONLY
NESTING_CONSIDERED_MEMBER_NODES_ONLY
nodes
- Set of JRipplesEIGNode
nodes, of which direct (not transitive through the node's members) neighbors should be returneddirectionConsidered
- whether to return neighbors that only call, are called by, or do both to the supplied nodesnestingConsidered
- whether to return neighbors that are top nodes, member nodes, or both
JRipplesEIGNode
nodes that satisfy specified requirements; set may be emptygetAllAnyNodeNeighbors(JRipplesEIGNode)
,
getAllTopNodeNeighbors(JRipplesEIGNode)
,
getAllMemberNodeNeighbors(JRipplesEIGNode)
,
getIncomingAnyNodeNeighbors(JRipplesEIGNode)
,
getIncomingTopNodeNeighbors(JRipplesEIGNode)
,
getIncomingMemberNodeNeighbors(JRipplesEIGNode)
,
getOutgoingAnyNodeNeighbors(JRipplesEIGNode)
,
getOutgoingTopNodeNeighbors(JRipplesEIGNode)
,
getOutgoingMemberNodeNeighbors(JRipplesEIGNode)
public static JRipplesEIGNode[] getAllTopNodeNeighbors(JRipplesEIGNode node)
edgesToNeigbors(Set, int, int)
method with predefined parameters
node
- node, whose neighboring nodes should be returned
public static JRipplesEIGNode[] getIncomingTopNodeNeighbors(JRipplesEIGNode node)
edgesToNeigbors(Set, int, int)
method with predefined parameters
node
- node, whose neighboring nodes should be returned
public static JRipplesEIGNode[] getOutgoingTopNodeNeighbors(JRipplesEIGNode node)
edgesToNeigbors(Set, int, int)
method with predefined parameters
node
- node, whose neighboring nodes should be returned
public static JRipplesEIGNode[] getAllMemberNodeNeighbors(JRipplesEIGNode node)
edgesToNeigbors(Set, int, int)
method with predefined parameters
node
- node, whose neighboring nodes should be returned
public static JRipplesEIGNode[] getIncomingMemberNodeNeighbors(JRipplesEIGNode node)
edgesToNeigbors(Set, int, int)
method with predefined parameters
node
- node, whose neighboring nodes should be returned
public static JRipplesEIGNode[] getOutgoingMemberNodeNeighbors(JRipplesEIGNode node)
edgesToNeigbors(Set, int, int)
method with predefined parameters
node
- node, whose neighboring nodes should be returned
public static JRipplesEIGNode[] getAllAnyNodeNeighbors(JRipplesEIGNode node)
edgesToNeigbors(Set, int, int)
method with predefined parameters
node
- node, whose neighboring nodes should be returned
public static JRipplesEIGNode[] getIncomingAnyNodeNeighbors(JRipplesEIGNode node)
edgesToNeigbors(Set, int, int)
method with predefined parameters
node
- node, whose neighboring nodes should be returned
public static JRipplesEIGNode[] getOutgoingAnyNodeNeighbors(JRipplesEIGNode node)
edgesToNeigbors(Set, int, int)
method with predefined parameters
node
- node, whose neighboring nodes should be returned
public static JRipplesEIGEdge addEdge(JRipplesEIGNode nodeFrom, JRipplesEIGNode nodeTo)
nodeFrom
- a node, from which this dependency originatesnodeTo
- a node, to which which this dependency points
null
if one or both of the supplied nodes is null
, or nodes are equal, or nodes are declared within the same top classpublic static void flattenEIG()
public static JRipplesEIGEdge getEdge(JRipplesEIGNode nodeFrom, JRipplesEIGNode nodeTo)
nodeFrom
- a node, from which this dependency originatesnodeTo
- a node, to which which this dependency points
null
otherwisepublic static JRipplesEIGEdge[] getAllEdges()
addEdge(JRipplesEIGNode, JRipplesEIGNode)
method).
addEdge(JRipplesEIGNode, JRipplesEIGNode)
method).public static void removeEdge(JRipplesEIGEdge edge)
edge
- edge to removepublic static boolean existsEdge(JRipplesEIGNode nodeFrom, JRipplesEIGNode nodeTo)
existsEdge(A,B)==true
does not imply existsEdge(B,A)==true
nodeFrom
- a node, from which this edge originatesnodeTo
- a node, to which this to which which this dependency points
true
if an edge between two given nodes exists, false
otherwisepublic static void addJRipplesEIGListener(JRipplesEIGListener listener)
JRipplesEIGListener
to receive updates on lyficycle and content events of JRipples EIG nodes and edges
listener
- Listener to registerpublic static void removeJRipplesEIGListener(JRipplesEIGListener listener)
addJRipplesEIGListener(JRipplesEIGListener)
.
listener
- Listener to unregisterpublic static boolean isLocked()
doLock(Object)
for more details.
true
if the JRipples EIG is locked, false
otherwisepublic static void doLock(java.lang.Object lockingObj)
doUnLock(Object)
is called,
should be treated as a one event. doUnLock(Object)
is called to unlock the EIG.doLock(Object)
and doUnLock(Object)
should be used to ensure the correctness of the organization of events.
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.
lockingObj
- object that starts a sequence of actions;doUnLock(Object)
method to unlock the EIG.doUnLock(Object)
,
isLocked()
public static void doUnLock(java.lang.Object lockingObj)
lockingObj
- the same object that was used to lock the EIG with the doLock(Object)
commanddoLock(Object)
,
isLocked()
public static void clearHistory()
undo()
,
redo()
public static void undo()
doLock(Object)
and doUnLock(Object)
methods
will be grouped into a single set of operations and, thus, canceled as such.
redo()
public static void redo()
undo()
public static boolean canRedo()
true
if there are any operations, availbale for redofalse
otherwiseredo()
public static boolean canUndo()
true
if there are any operations, availbale for undofalse
otherwiseundo()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |