diff --git a/Winda/src/winda/logic/AlgorytmNajblizszeWezwanie.java b/Winda/src/winda/logic/AlgorytmNajblizszeWezwanie.java index 75df1f5..3af0a28 100644 --- a/Winda/src/winda/logic/AlgorytmNajblizszeWezwanie.java +++ b/Winda/src/winda/logic/AlgorytmNajblizszeWezwanie.java @@ -10,9 +10,114 @@ package winda.logic; * @author Tomek */ public class AlgorytmNajblizszeWezwanie implements IAlgorytm{ + int pietroWindy = 1; + int maxPietro = 12; + int minPietro = 1; + int stop = 0; + int start = 0; + Pasazer p = new Pasazer(0,0,0); - public int[] Trasa(Pasazer[] pasazerowie) { - throw new UnsupportedOperationException("Not supported yet."); + public int[] Trasa(Pasazer[] pasazerowie){ + int [] t = new int[2*pasazerowie.length+1]; + int tab_len = 0; + int iluPasazerow = 0; + t[tab_len] = pietroWindy; + tab_len++; + int zmiana = 0; + + int i = 0; + while(i < pasazerowie.length){ + int z = 0; + Pasazer[] ppp = new Pasazer[2*pasazerowie.length]; int g=0; + for(int l = 0; l < pasazerowie.length; l++){ + if(pietroWindy == pasazerowie[l].GetStart()){ + z = 1; + ppp[g] = pasazerowie[l]; g++; + } + else{ + z = 0; + } + } + + if(z == 1){ + for(int q=0;q= minPietro){ + Pasazer[] pp = new Pasazer[2*pasazerowie.length]; + int e=0; + for(int j = 0; j < pasazerowie.length; j++){ + if(pietroWindy - k == pasazerowie[j].GetStart()){ + pp[e] = pasazerowie[j]; e++; + } + } + for(int q=0;q