APPENDIX A. SOURCE CODE
76
A.2 countRoadUsers for the self organizing traffic
ligths
For updating kappa in the proposed self-organizing traffic light controllers it is
needed to count the vehicles of a specific lane.
public int countRoadusers ( Drivelane lane , int range) {
int cntr = 0;
Roaduser ru ;
boolean stop = false ;
LinkedList queue = lane . getQueue ();
ListIterator li = queue. listIterator ();
while ( li . hasNext () && !stop) {
try
{
ru = ( Roaduser) li . next ();
}
catch (Exception e)
{
// When this exception is thrown you removed the first element
// of the queue, therefore re -create the iterator .
System.out. println ("CME");
li = queue. listIterator ();
continue ;
}
if (ru . getPosition () <= range)
cntr ++;
else
stop = true ;
}
return cntr ;
}
More intriguing information
1. A Theoretical Growth Model for Ireland2. Accurate, fast and stable denoising source separation algorithms
3. A Rare Case Of Fallopian Tube Cancer
4. Fighting windmills? EU industrial interests and global climate negotiations
5. The name is absent
6. The constitution and evolution of the stars
7. A Bayesian approach to analyze regional elasticities
8. Distortions in a multi-level co-financing system: the case of the agri-environmental programme of Saxony-Anhalt
9. Popular Conceptions of Nationhood in Old and New European
10. A Rational Analysis of Alternating Search and Reflection Strategies in Problem Solving