1 /***
2 * NormalEdge
3 *
4 * This is a normal flow control edge in the
5 * flow control graph.
6 */
7
8 package junit.quilt.cover.generic;
9
10 import junit.quilt.exception.InvalidTransitionException;
11
12 import org.apache.commons.graph.Edge;
13
14 import org.apache.bcel.generic.*;
15
16 public class NormalEdge
17 extends FlowControlEdge
18 {
19 public NormalEdge(BlockVertex source,
20 BlockVertex target)
21 {
22 super( source, target );
23 }
24
25 public void connect( MethodGen method,
26 InstructionList il,
27 InstructionHandle source,
28 InstructionHandle target )
29 throws InvalidTransitionException
30 {
31 if (source == null) return;
32 if (target == null) return;
33
34 if (source.getInstruction() instanceof GotoInstruction) {
35 ((GotoInstruction) source.getInstruction()).setTarget( target );
36 } else {
37 if (source.getNext() != target) {
38 il.append( source, new GOTO( target ));
39 }
40 }
41 }
42
43 public FlowControlEdge copy( BlockVertex start,
44 BlockVertex end ) {
45 return new NormalEdge( start, end );
46 }
47
48 public String toString() {
49 return "[N: " + getSource() + " -> " + getTarget() + "]";
50 }
51 }
52
53
54
55
This page was automatically generated by Maven