blob: 7c91818722276d4dc4af5ffdc56d03c0c42e3dea (
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
|
/*******************************************************************************
* Copyright (c) 2009, 2010 Alena Laskavaia
* 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 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()
*/
public IBasicBlock[] getIncomingNodes() {
return incoming.toArray(new IBasicBlock[incoming.size()]);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.codan.core.model.cfg.IBasicBlock#getIncomingSize ()
*/
public int getIncomingSize() {
return incoming.size();
}
/*
* (non-Javadoc)
*
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IConnectorNode#
* hasBackwardIncoming()
*/
public boolean hasBackwardIncoming() {
for (IBasicBlock node : incoming) {
if (node instanceof IJumpNode) {
if (((IJumpNode) node).isBackwardArc())
return true;
}
}
return false;
}
}
|