blob: bb9317989a59d7a8fa1586c0dbccfc2b9845ac87 (
plain) (
blame)
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
72
73
74
|
/*******************************************************************************
* Copyright (c) 2009, 2012 Alena Laskavaia
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Alena Laskavaia - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.core.cfg;
import java.util.ArrayList;
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;
/**
* TODO: add description
*/
public class ConnectorNode extends AbstractSingleOutgoingNode implements IConnectorNode {
protected ArrayList<IBasicBlock> incoming = new ArrayList<IBasicBlock>(2);
protected ConnectorNode() {
super();
}
@Override
public void addIncoming(IBasicBlock node) {
incoming.add(node);
}
/*
* (non-Javadoc)
*
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IBasicBlock#
* getIncomingIterator()
*/
@Override
public IBasicBlock[] getIncomingNodes() {
return incoming.toArray(new IBasicBlock[incoming.size()]);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.codan.core.model.cfg.IBasicBlock#getIncomingSize ()
*/
@Override
public int getIncomingSize() {
return incoming.size();
}
/*
* (non-Javadoc)
*
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IConnectorNode#
* hasBackwardIncoming()
*/
@Override
public boolean hasBackwardIncoming() {
for (IBasicBlock node : incoming) {
if (node instanceof IJumpNode) {
if (((IJumpNode) node).isBackwardArc())
return true;
}
}
return false;
}
}
|