APPENDIX A. SOURCE CODE
77
A.3 MorevtsSotlPhase
updateT LDs and decideT Ls of the Sotl-phase traffic light controller is given
below.
public void updateTLDs() {
for ( int i = 0; i < tld . length ; i++) {
boolean switched = false ;
for ( int j = 0; j < tld [i ]. length ; j++)
if( tld [i ][j ]. getTL (). getCycleSwitched()==getCurCycle()-1)
switched = true ;
if ( switched) {
if (! tld [i ][0]. getTL (). getNode (). getKeepTLDFlag())
{
tld [i ][0]. getTL (). getNode (). setKeepTLDFlag(true);
tld [i ][0]. getTL (). getNode (). setPhaseMinimal(PHASE_MIN);
for ( int j= 0; j < tld [i ]. length ; j++)
if ( tld [ i ][ j ]. getTL (). getState ())
tld [i ][ j ]. setKappa (0);
}
}
}
}
public TLDecision [][] decideTLs() {
TLDecision currentDec ;
Drivelane curLane;
// 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 ();
More intriguing information
1. CREDIT SCORING, LOAN PRICING, AND FARM BUSINESS PERFORMANCE2. Psychological Aspects of Market Crashes
3. The name is absent
4. Achieving the MDGs – A Note
5. Beyond Networks? A brief response to ‘Which networks matter in education governance?’
6. SME'S SUPPORT AND REGIONAL POLICY IN EU - THE NORTE-LITORAL PORTUGUESE EXPERIENCE
7. Multimedia as a Cognitive Tool
8. The name is absent
9. The name is absent
10. Group cooperation, inclusion and disaffected pupils: some responses to informal learning in the music classroom