Beispiel #1
0
  public void updateRoaduserMove(
      Roaduser ru,
      Drivelane prevlane,
      Sign prevsign,
      int prevpos,
      Drivelane dlanenow,
      Sign signnow,
      int posnow,
      PosMov[] posMovs,
      Drivelane desired) {
    // When a roaduser leaves the city; this will
    if (dlanenow == null || signnow == null) {
      dlanenow = prevlane;
      signnow = prevsign;
      posnow = -1;
      return; // ?? is recalculation is not necessary ??
    }
    // This ordening is important for the execution of the algorithm!

    if (prevsign.getType() == Sign.TRAFFICLIGHT
        && (signnow.getType() == Sign.TRAFFICLIGHT || signnow.getType() == Sign.NO_SIGN)) {
      Node dest = ru.getDestNode();
      recalcQ(
          prevsign,
          prevpos,
          dest,
          prevsign.mayDrive(),
          signnow,
          posnow,
          signnow.mayDrive(),
          posMovs);
    }
  }
Beispiel #2
0
	public void updateRoaduserMove(Roaduser ru, Drivelane prevlane, Sign prevsign, int prevpos, Drivelane dlanenow, Sign signnow, int posnow, PosMov[] posMovs, Drivelane desired)
	{
		// Roaduser has just left the building
		if(dlanenow == null || signnow == null) {
			return;
		}
		
		//This ordening is important for the execution of the algorithm!
		int Ktl = dlanenow.getNumRoadusersWaiting();
		if(prevsign.getType()==Sign.TRAFFICLIGHT && (signnow.getType()==Sign.TRAFFICLIGHT || signnow.getType()==Sign.NO_SIGN)) {
			boolean light = prevsign.mayDrive();
			Node dest = ru.getDestNode();
			recalcP(prevsign, prevpos, dest, light, signnow, posnow, Ktl);			
			recalcVa(prevsign, prevpos, dest);
			recalcV(prevsign, prevpos, dest, light, Ktl);			
			recalcQa(prevsign, prevpos, dest, light, signnow, posnow, posMovs);
			recalcQ(prevsign, prevpos, dest, light, signnow, posnow, posMovs, Ktl);
		}
	}