blob: b5198d0ac59ffa9e70584bfa033c8b861ff76647 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*******************************************************************************
* Copyright (c) 2010 Alena Laskavaia and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alena Laskavaia - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.core.cfg;
import org.eclipse.cdt.codan.core.model.cfg.IBasicBlock;
import org.eclipse.cdt.codan.core.model.cfg.IConnectorNode;
import org.eclipse.cdt.codan.core.model.cfg.IJumpNode;
/**
* Jump node is node that connects unusual control pass, such as goto, break and
* continue
*
*/
public class JumpNode extends AbstractSingleIncomingNode implements IJumpNode {
private IConnectorNode jump;
private boolean backward;
protected JumpNode() {
super();
}
public IBasicBlock[] getOutgoingNodes() {
return new IBasicBlock[] { jump };
}
public int getOutgoingSize() {
return 1;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.codan.core.model.cfg.IJumpNode#getJumpNode()
*/
public IConnectorNode getJumpNode() {
return jump;
}
public IBasicBlock getOutgoing() {
return jump;
}
public boolean isBackwardArc() {
return backward;
}
public void setJump(IConnectorNode jump, boolean backward) {
if (this.jump != null && this.jump != jump)
throw new IllegalArgumentException(
"Cannot modify exiting connector"); //$NON-NLS-1$
this.jump = jump;
this.backward = backward;
}
public void setBackward(boolean backward) {
this.backward = backward;
}
@Override
public void addOutgoing(IBasicBlock node) {
setJump((IConnectorNode) node, backward);
}
}
|