Tam taramtam tam tam (By Ania Kłos)

This commit is contained in:
Tomasz Piechucki 2011-05-04 09:06:47 +00:00
parent 1e8867ec9b
commit 8a647f0fed
2 changed files with 30 additions and 3 deletions

View file

@ -101,6 +101,8 @@ public class WindaView extends FrameView{
t.start(); t.start();
this.drawAnimation(); this.drawAnimation();
this.setupDemoPassangersList(); this.setupDemoPassangersList();
this.jCheckBox2.setVisible(false);
this.jButton4.setVisible(false);
} }
private void setupDemoPassangersList(){ private void setupDemoPassangersList(){
@ -157,6 +159,8 @@ public class WindaView extends FrameView{
private void goToPieto(){ private void goToPieto(){
this.em.setPietro((ArrayList) this.w.GetTrasa(), 1); this.em.setPietro((ArrayList) this.w.GetTrasa(), 1);
if (this.jCheckBox2.isSelected())
this.em.setPietro((ArrayList) this.w.GetTrasaDwa(), 2);
this.em.setEnterExitTime(czasWeWy); this.em.setEnterExitTime(czasWeWy);
Thread t = new Thread(em); Thread t = new Thread(em);
t.start(); t.start();
@ -963,10 +967,13 @@ public class WindaView extends FrameView{
}//GEN-LAST:event_jMenuItem3ActionPerformed }//GEN-LAST:event_jMenuItem3ActionPerformed
private void jCheckBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox2ActionPerformed private void jCheckBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox2ActionPerformed
if(jCheckBox2.isSelected()) if(jCheckBox2.isSelected()) {
this.em.enableSecondElevator(); this.em.enableSecondElevator();
else this.w.SetDwieWindy();
} else {
this.em.disableSecondElevator(); this.em.disableSecondElevator();
this.w.SetJednaWindy();
}
this.newAnimation(this.floor_count); this.newAnimation(this.floor_count);
}//GEN-LAST:event_jCheckBox2ActionPerformed }//GEN-LAST:event_jCheckBox2ActionPerformed

View file

@ -25,6 +25,8 @@ public class Winda {
private List<Pasazer> pasazerowieCollection = new ArrayList<Pasazer>(); private List<Pasazer> pasazerowieCollection = new ArrayList<Pasazer>();
private Parser parser = new Parser(); private Parser parser = new Parser();
private List<Pietro> Trasa; private List<Pietro> Trasa;
private List<Pietro> TrasaDwa;
private boolean DwieWindy = false;
private Logger log; private Logger log;
public Winda(){ public Winda(){
@ -42,6 +44,14 @@ public class Winda {
this.CzasJazdyPietro = czas; this.CzasJazdyPietro = czas;
} }
public void SetDwieWindy (){
this.DwieWindy = true;
}
public void SetJednaWindy (){
this.DwieWindy = false;
}
public void SetCzasWeWyOsoby(double czas){ public void SetCzasWeWyOsoby(double czas){
this.CzasWeWyOsoby = czas; this.CzasWeWyOsoby = czas;
} }
@ -84,6 +94,10 @@ public class Winda {
return this.Trasa; return this.Trasa;
} }
public List<Pietro> GetTrasaDwa(){
return this.TrasaDwa;
}
public void ZapiszPasazerow(String filename){ public void ZapiszPasazerow(String filename){
parser.Zapisz(filename, getPasazerowieCollection()); parser.Zapisz(filename, getPasazerowieCollection());
} }
@ -101,7 +115,13 @@ public class Winda {
public void Start(){ public void Start(){
AlgorytmWindy.SetMaxPietro(IloscPieter); AlgorytmWindy.SetMaxPietro(IloscPieter);
Trasa.clear(); Trasa.clear();
Trasa = AlgorytmWindy.Trasa(getPasazerowieCollection()); if (DwieWindy){
List<List<Pietro>> trasy = AlgorytmWindy.TrasaDwieWindy(pasazerowieCollection);
this.Trasa = trasy.get(0);
this.TrasaDwa = trasy.get(1);
} else {
Trasa = AlgorytmWindy.Trasa(getPasazerowieCollection());
}
CzasJazdy = Trasa.size()*CzasJazdyPietro+IloscPasazerow*CzasWeWyOsoby*2; CzasJazdy = Trasa.size()*CzasJazdyPietro+IloscPasazerow*CzasWeWyOsoby*2;
CzasSredniObslugi = CzasJazdy / IloscPasazerow; CzasSredniObslugi = CzasJazdy / IloscPasazerow;
CzasPietra = CzasJazdy / IloscPieter; CzasPietra = CzasJazdy / IloscPieter;