use of y.base.Edge in project binnavi by google.
the class ZyGraphBuilder method convertEdges.
/**
* Converts the edges of a view into Graph2D edges.
*
* @param edges The edges to convert.
* @param graph2D The graph where the edges are inserted.
* @param rawNodeToNodeMap Keeps track of view node => graph node mappings.
* @param adjustColors
*/
private void convertEdges(final Collection<INaviEdge> edges, final Graph2D graph2D, final Map<INaviViewNode, Node> rawNodeToNodeMap, final boolean adjustColors) {
for (final INaviEdge edge : edges) {
// Get the nodes connected by the edge
final NaviNode sourceNode = m_ynodeToNodeMap.get(rawNodeToNodeMap.get(edge.getSource()));
final NaviNode targetNode = m_ynodeToNodeMap.get(rawNodeToNodeMap.get(edge.getTarget()));
final Pair<Edge, NaviEdge> result = ZyEdgeBuilder.convertEdge(edge, sourceNode, targetNode, graph2D, adjustColors);
m_yedgeToEdgeMap.put(result.first(), result.second());
}
}
use of y.base.Edge in project binnavi by google.
the class CReilInstructionGraph method createInstructionEdge.
/**
* Creates an instruction graph edge between the source node and the destination node and returns
* the resulting yfiles edge.
*
* @param sourceNode The source node of the edge to be created.
* @param destinationNode The destination node of the edge to be created.
* @param isTrueEdge Boolean parameter to determine if the edge is a conditional true edge.
*
* @return The yfiles edge which has been created and inserted in the graph.
*/
private Edge createInstructionEdge(final Node sourceNode, final Node destinationNode, final boolean isTrueEdge) {
final ReilInstruction reilInstruction = m_nodesMap.get(destinationNode).getReilInstruction();
boolean isExitEdge = false;
if (reilInstruction != null) {
final IAddress reilInstructionAddress = reilInstruction.getAddress();
if ((reilInstructionAddress.toLong() & 0xFF) == 0) {
isExitEdge = true;
}
}
final Edge edge = m_internalGraph.createEdge(sourceNode, destinationNode);
m_edgesMap.put(edge, new ReilInstructionGraphEdge(isTrueEdge, isExitEdge));
return edge;
}
use of y.base.Edge in project binnavi by google.
the class CReilInstructionGraph method getOutgoingEdgesForAddress.
/**
* Convenience method to obtain the edge in the ReilInstructionGraph that corresponds to LEAVING a
* particular native instruction
*
* @param nativeInstructionAddress The address of the native instruction
*
* @return The edge corresponding to entering the native instruction
*/
public Iterable<IInstructionGraphEdge> getOutgoingEdgesForAddress(final IAddress nativeInstructionAddress) {
final ArrayList<IInstructionGraphEdge> result = new ArrayList<IInstructionGraphEdge>();
final EdgeCursor edgeCursor = m_internalGraph.edges();
while (edgeCursor.ok()) {
final Edge edge = (Edge) edgeCursor.current();
final long sourceAddress = m_nodesMap.get(edge.source()).getReilInstruction().getAddress().toLong();
final long targetAddress = m_nodesMap.get(edge.target()).getReilInstruction().getAddress().toLong();
if (((targetAddress & 0xFF) == 0) && ((sourceAddress >> 8) == nativeInstructionAddress.toLong())) {
result.add(m_edgesMap.get(edge));
}
edgeCursor.next();
}
return result;
}
Aggregations