APPENDIX A. SOURCE CODE
80
public TLDecision [][] decideTLs() {
TLDecision currentDec ;
Drivelane curLane;
// System.out . println ("#### TLDATA-"+this.getCurCycle()+" ####");
// adjust data after last cycle
updateTLDs();
for ( int i = 0; i < tld . length ; i++) { // for all nodes
Node currentNode = null ;
for ( int j = 0; j < tld [i ]. length ; j++)
if (currentNode == null ) currentNode= tld [ i ][ j ]. getTL (). getNode ();
if (currentNode != null && currentNode.getKeepTLDFlag()) {
currentNode. decrPhaseMinimal ();
}
for (int j = 0; j < tld [i ]. length; j++) { // for all inbound lanes in node
currentDec = tld [ i ][ j ];
curLane = tld [i ][j ]. getTL (). getLane ();
int cntr = countRoadusers(curLane,VISIBLE);
if (! tld [ i ][j ]. getTL (). getState ())
currentDec . addKappa(cntr );
if (currentNode. getPhaseMinimal() <= 0
&& !currentNode. isPlatoonCrossing ()
&& currentDec.getKappa() >= TETA) {
currentDec . setQValue(currentDec . getKappa ());
currentNode . setKeepTLDFlag(false);
// curDec.setQValue (1);
}
else