Clover coverage report - PMD - 3.7 Coverage timestamp: Wed May 31 2006 09:25:59 EDT FRAMES NO FRAMES |

file stats: | LOC: | 72 |  | Methods: | 12
| NCLOC: | 54 |  | Classes: | 1

Source file | Conditionals | Statements | Methods | TOTAL
CurrentPath.java | 0% | 4.5% | 8.3% | 4.8% |

1 |  | package net.sourceforge.pmd.dfa.pathfinder;
2 |  |
3 |  | import net.sourceforge.pmd.dfa.IDataFlowNode;
4 |  | import net.sourceforge.pmd.dfa.NodeType;
5 |  |
6 |  | import java.util.Iterator;
7 |  | import java.util.LinkedList;
8 |  |
9 |  | public class CurrentPath {
10 |  |
11 |  | private LinkedList list;
12 |  |
13 | 1 | public CurrentPath() {
14 | 1 | list = new LinkedList();
15 |  | }
16 |  |
17 | 0 | public Iterator iterator() {
18 | 0 | return list.iterator();
19 |  | }
20 |  |
21 | 0 | public IDataFlowNode getLast() {
22 | 0 | return (IDataFlowNode) list.getLast();
23 |  | }
24 |  |
25 | 0 | public void removeLast() {
26 | 0 | list.removeLast();
27 |  | }
28 |  |
29 | 0 | public boolean isEmpty() {
30 | 0 | return list.isEmpty();
31 |  | }
32 |  |
33 | 0 | public void addLast(IDataFlowNode n) {
34 | 0 | list.addLast(n);
35 |  | }
36 |  |
37 | 0 | public boolean isDoBranchNode() {
38 | 0 | return ((IDataFlowNode) list.getLast()).isType(NodeType.DO_EXPR);
39 |  | }
40 |  |
41 | 0 | public boolean isFirstDoStatement() {
42 | 0 | return isFirstDoStatement((IDataFlowNode) list.getLast());
43 |  | }
44 |  |
45 | 0 | public IDataFlowNode getDoBranchNodeFromFirstDoStatement() {
46 | 0 | IDataFlowNode inode = (IDataFlowNode) list.getLast();
47 | 0 | if (!isFirstDoStatement()) return null;
48 | 0 | for (int i = 0; i < inode.getParents().size(); i++) {
49 | 0 | IDataFlowNode parent = (IDataFlowNode) inode.getParents().get(i);
50 | 0 | if (parent.isType(NodeType.DO_EXPR)) {
51 | 0 | return parent;
52 |  | }
53 |  | }
54 | 0 | return null;
55 |  | }
56 |  |
57 | 0 | public boolean isEndNode() {
58 | 0 | return ((IDataFlowNode) list.getLast()).getChildren().size() == 0;
59 |  | //return inode instanceof StartOrEndDataFlowNode;
60 |  | }
61 |  |
62 | 0 | public boolean isBranch() {
63 | 0 | return ((IDataFlowNode) list.getLast()).getChildren().size() > 1;
64 |  | }
65 |  |
66 | 0 | private boolean isFirstDoStatement(IDataFlowNode inode) {
67 | 0 | int index = inode.getIndex() - 1;
68 | 0 | if (index < 0) return false;
69 | 0 | return ((IDataFlowNode) inode.getFlow().get(index)).isType(NodeType.DO_BEFORE_FIRST_STATEMENT);
70 |  | }
71 |  | }
72 |  |