private void buttonLaden_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            //dialog.Filter = "JSON Dateien | *.json | Alle Dateien | *.*";

            if (dialog.ShowDialog() == true)
            {
                FileStream stream = null;

                try
                {
                    stream = File.OpenRead(dialog.FileName);
                    //Ereignisabos des alten Automaten entfernen
                    checkBoxAutoRefill_Unchecked(checkBoxAutoRefill, new RoutedEventArgs());
                    _automat = (Automat)_serializer.ReadObject(stream);
                    Datenbindung();
                    MessageBox.Show("Automat geladen.");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    stream?.Close();
                }
            }
        }
示例#2
0
        private static void Modul4Demos()
        {
            Automat a1 = Automat.ErstelleStandardAutomat();

            Console.WriteLine(a1.Zubereiten("Kakao", out bool erledigt));
            Console.WriteLine(a1.Zubereiten("Kaffee", out erledigt));
            Console.WriteLine(a1.Zubereiten("Espresso", out erledigt));
            Console.WriteLine(a1.Zubereiten("Milchkaffee", out erledigt));
            Console.WriteLine(a1.Zubereiten("Cappuccino", out erledigt));
            Console.WriteLine();

            //Behaelter[] behaelterListe = new Behaelter[3];
            //behaelterListe[0] = new Behaelter(Inhaltsstoff.Wasser, 200);
            //behaelterListe[1] = new Behaelter(Inhaltsstoff.Kaffee, 100);
            //behaelterListe[2] = new Behaelter(Inhaltsstoff.Milch, 150);

            //foreach (var item in behaelterListe)
            //{
            //    Console.WriteLine($"{item.Volumen} cl {item.Typ}");
            //}

            //Console.WriteLine();
            //Array.Sort(behaelterListe);
            //Console.WriteLine("Nach der Sortierung.");

            //foreach (var item in behaelterListe)
            //{
            //    Console.WriteLine($"{item.Volumen} cl {item.Typ}");
            //}
        }
示例#3
0
        static void Main()
        {
            IAutomatReader automatReader = new AutomatFileReader();


            Automat automat1 = automatReader.ReadAutomat(@"../../automate/automat1.txt");

            Console.WriteLine("Automat1");
            Console.WriteLine("==================================");
            Console.WriteLine(automat1);

            Automat automat2 = automatReader.ReadAutomat(@"../../automate/automat2.txt");

            Console.WriteLine("Automat2");
            Console.WriteLine("=================================");
            Console.WriteLine(automat2);

            IOperatiiAutomateService operatiiAutomateService = new OperatiiAutomateService(new MultimeService());

            Automat produs = null;

            try
            {
                produs = operatiiAutomateService.Produs(automat1, automat2);
            }catch (AlfabeteDiferiteException ex)
            {
                Console.WriteLine(ex.Message);
                return;
            }

            Console.WriteLine("Produsul:");
            Console.WriteLine(produs);

            Console.ReadKey();
        }
        public VisuAnzeigen(MainWindow mw, Automat tw)
        {
            _mainWindow     = mw;
            _transportwagen = tw;



            System.Threading.Tasks.Task.Run(VisuAnzeigenTask);
        }
示例#5
0
        static void Main(string[] args)
        {
            napoj_gazowany    Cola      = new napoj_gazowany("Coca cola", 23);
            napoj_niegazowany Tymbark   = new napoj_niegazowany("Tymbark", 24);
            Automat           Automacik = new Automat();

            Automacik.PrzygotujNapoj(Cola);
            Automacik.PrzygotujNapoj(Tymbark);
        }
示例#6
0
        public AutomatDTO GetAutomatDTO(Automat model)
        {
            List <int>           states      = new List <int>(model.States);
            int                  startState  = model.StartState;
            List <int>           finalStates = new List <int>(model.FinalStates);
            List <TransitionDTO> transitions = GetTransitionDTO(model.Transitions);

            return(new AutomatDTO(states, transitions, startState, finalStates));
        }
示例#7
0
        public Automat Produs(Automat automat1, Automat automat2)
        {
            bool acelasiAlfabet = multimeService.Egalitate(automat1.Alfabet.ToList(), automat2.Alfabet.ToList());

            if (!acelasiAlfabet)
            {
                throw new AlfabeteDiferiteException("Alfabetele celor doua automate difera!");
            }

            int stareInitiala = automat1.StareInitiala;

            int nrStari = automat1.NrStari + automat2.NrStari;

            List <int> stariTerminale = Shift(automat2.StariTerminale, automat1.NrStari);

            if (automat2.AcceptaCuvantVid)
            {
                stariTerminale = multimeService.Reuniune(automat1.StariTerminale, stariTerminale);
                stariTerminale.Remove(automat2.StareInitiala + automat1.NrStari);
            }

            List <int>[,] functiaDeTranzitie = new List <int> [automat1.Alfabet.Length, nrStari];

            for (int i = 0; i < automat1.NrStari; i++)
            {
                bool esteStareTerminala = automat1.StariTerminale.Contains(i);

                for (int j = 0; j < automat1.Alfabet.Length; j++)
                {
                    if (esteStareTerminala)
                    {
                        functiaDeTranzitie[j, i] = multimeService.Reuniune(
                            automat1.FunctiaDeTranzitie[j, i],
                            Shift(automat2.FunctiaDeTranzitie[j, automat2.StareInitiala], automat1.NrStari));
                    }
                    else
                    {
                        functiaDeTranzitie[j, i] = automat1.FunctiaDeTranzitie[j, i];
                    }
                }
            }

            for (int i = automat1.NrStari; i < nrStari; i++)
            {
                for (int j = 0; j < automat1.Alfabet.Length; j++)
                {
                    functiaDeTranzitie[j, i] = automat2.FunctiaDeTranzitie[j, i - automat1.NrStari];

                    functiaDeTranzitie[j, i] = Shift(functiaDeTranzitie[j, i], automat1.NrStari);
                }
            }

            Automat rezultat = new Automat(nrStari, stareInitiala, automat1.Alfabet, stariTerminale, functiaDeTranzitie);

            return(rezultat);
        }
示例#8
0
        public void GetWordBySymbolReturnNull()
        {
            //Arrange
            Task3_BL helper  = new Task3_BL();
            Automat  automat = new Automat
            {
                StartState  = 1,
                FinalStates = new List <int> {
                    4, 5
                },
                Transitions = new List <Transition>
                {
                    new Transition {
                        CurrentState = 1, Symbol = "a", NextState = 2
                    },
                    new Transition {
                        CurrentState = 1, Symbol = "b", NextState = 1
                    },
                    new Transition {
                        CurrentState = 2, Symbol = "a", NextState = 3
                    },
                    new Transition {
                        CurrentState = 2, Symbol = "b", NextState = 4
                    },
                    new Transition {
                        CurrentState = 2, Symbol = "c", NextState = 5
                    },
                    new Transition {
                        CurrentState = 3, Symbol = "a", NextState = 5
                    },
                    new Transition {
                        CurrentState = 3, Symbol = "b", NextState = 4
                    },
                    new Transition {
                        CurrentState = 4, Symbol = "a", NextState = 1
                    },
                    new Transition {
                        CurrentState = 4, Symbol = "b", NextState = 4
                    },
                    new Transition {
                        CurrentState = 5, Symbol = "a", NextState = 5
                    }
                }
            };

            helper.SetAutomat(automat);

            //Act
            string actual = helper.GetWordBySymbol(new List <int> {
                1
            }, "b", 0);

            //Assert
            Assert.Null(actual);
        }
        public Automat ReadAutomat(string filePath)
        {
            StreamReader reader = new StreamReader(filePath);

            string[] alfabet = reader.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            int nrStari = int.Parse(reader.ReadLine());

            int stareInitiala = int.Parse(reader.ReadLine());

            string[] stariTerminaleString = reader.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            List <int> stariTerminale = new List <int>();

            for (int i = 0; i < stariTerminaleString.Length; i++)
            {
                int stare = int.Parse(stariTerminaleString[i]);

                stariTerminale.Add(stare);
            }

            List <int>[,] functiaDeTranzitie = new List <int> [alfabet.Length, nrStari];
            for (int i = 0; i < alfabet.Length; i++)
            {
                for (int j = 0; j < nrStari; j++)
                {
                    functiaDeTranzitie[i, j] = new List <int>();
                }
            }

            for (int i = 0; i < alfabet.Length; i++)
            {
                for (int j = 0; j < nrStari; j++)
                {
                    string linie = reader.ReadLine();
                    if (linie.Trim().ToLower() == "vid")
                    {
                        continue;
                    }

                    string[] tokens = linie.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                    for (int k = 0; k < tokens.Length; k++)
                    {
                        int stare = int.Parse(tokens[k]);

                        functiaDeTranzitie[i, j].Add(stare);
                    }
                }
            }

            Automat automat = new Automat(nrStari, stareInitiala, alfabet, stariTerminale, functiaDeTranzitie);

            return(automat);
        }
示例#10
0
        private int TmpKMP(string text, string pattern)
        {
            int[,] automat = Automat.Create(pattern);
            int q = 0;

            for (int i = 0; i < text.Length; i++)
            {
                q = automat[q, text[i] - 'A'];
                if (q == pattern.Length)
                {
                    return(i - pattern.Length + 1);
                }
            }
            return(-1);
        }
示例#11
0
        static void Main(string[] args)
        {
            List <Lexeme>  lexemes   = ReadLexemes();
            List <Automat> automates = new List <Automat>();
            CreateAutomat  ca        = new CreateAutomat();

            for (int i = 0; i < lexemes.Count; i++) //внешний цикл по все лексемам
            {
                Console.WriteLine(lexemes[i].regex);
                Automat automat = new Automat(lexemes[i].name, lexemes[i].priority, lexemes[i].regex);
                automat = ca.Create(automat);
                automates.Add(automat);
            }
            SearchSubstring task = new SearchSubstring();

            task.Start(automates);
        }
示例#12
0
        public static void Main()
        {
            Logger.RecordMessageToLog("werfewf");
            IIngsRepository ingsRepo = new IngsRepository();

            IDrinkRepository drinksRepo = new DrinkRepository();

            IDisplay display = new ConsoleDisplay();

            OrderController ordController = new ConsoleOrderController(drinksRepo, ingsRepo, display);

            Automat automat = new Automat(ordController, drinksRepo, display, ingsRepo, "geo:32434:43245");

            AutomatEventService eventService = new AutomatEventService(automat, display);

            automat.StartAutomat();
        }
示例#13
0
        public async Task <ActionResult <string> > SolveTask([FromBody] Automat model)
        {
            try
            {
                var result = await _helper.GetResultTask2Async(model);

                var key = Guid.NewGuid().ToString();

                _keyResults.Add(key, result);

                return(Ok("\"" + key + "\""));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
示例#14
0
    static void Main(string[] args)
    {
        Console.SetIn(new StreamReader(@"..\..\test2.txt"));

        int casesCount = int.Parse(Console.ReadLine());

        while (casesCount-- > 0)
        {
            var automat = new Automat();
            // states
            int statesCount = int.Parse(Console.ReadLine());
            automat.InputSymbols = Console.ReadLine();

            // symbols
            int finalStatesCount = int.Parse(Console.ReadLine());
            var states           = Console.ReadLine();
            automat.FinalStates = states.Split(' ').Select(int.Parse).ToList();

            // change functions
            int edgesCount = int.Parse(Console.ReadLine());
            for (int i = 0; i < edgesCount; i++)
            {
                string line = Console.ReadLine();
                automat.Transitions.Add(new Transition
                {
                    InputState  = line[0] - '0',
                    Symbol      = line[2],
                    OutputState = line[4] - '0',
                });
            }


            int testsCount = int.Parse(Console.ReadLine());
            for (int i = 0; i < testsCount; i++)
            {
                var result = automat.Run(Console.ReadLine());
                Console.WriteLine(result ? "ANO" : "NE");
            }

            if (casesCount != 0)
            {
                Console.WriteLine();
            }
        }
    }
示例#15
0
        public string GetResultTask2(Automat automat)
        {
            this.automat = automat;
            var    alpabet = GetAlphabet();
            string currentWord;

            foreach (var item in alpabet)
            {
                currentWord = GetWordBySymbol(new List <int> {
                    automat.StartState
                }, item, 0);
                if (!String.IsNullOrEmpty(currentWord))
                {
                    return(currentWord);
                }
            }
            return("Words consisting of the same characters do not translate the automaton to its final state");
        }
示例#16
0
        private static void Modul3Demos()
        {
            Behaelter wasserBehaelter = new Behaelter(Inhaltsstoff.Wasser);

            //wasserBehaelter.Typ = Zutat.Wasser; nicht möglich wegen Schreibschutz

            //todo Ereignisbehandlung 5: Ereignis abonnieren
            wasserBehaelter.BinLeer += Program.LeerstandAnzeigen;
            //Langnotation: wasserBehaelter.BinLeer += new BinLeerEventHandler(Program.LeerstandAnzeigen);
            Automat automat = new Automat();

            wasserBehaelter.BinLeer += automat.Auffuellen;

            wasserBehaelter.Fuellen();
            wasserBehaelter.Entnehmen(150);

            Console.WriteLine($"Aktueller Füllstand: {wasserBehaelter.Fuellstand} cl.");
        }
示例#17
0
            public bool IsUnacceptable(Automat automat, string nextChar)
            {
                if (!string.IsNullOrWhiteSpace(_newState) && !automat._initialState.Equals(_newState))
                {
                    return(true);
                }
                automat.DoAllEpsilonTransitions(false);
                List <Transition> acceptableTransitions = new List <Transition>();

                foreach (var state in automat._currentStates)
                {
                    acceptableTransitions.AddRange(automat._transitions.Where(p => p._currentState.Equals(state) && p._onSymbol.Equals(nextChar.ToString())).ToList());
                }
                if (acceptableTransitions == null || acceptableTransitions.Count == 0)
                {
                    return(true);
                }
                return(false);
            }
示例#18
0
 public void Create_Guns(string type)
 {
     if (type == "S")
     {
         Sniper temp = WeaponsFacotry.CreateWeapon(type) as Sniper;
         Assert.AreEqual(10, temp.ammo);
         Assert.AreEqual("AWP", temp.name);
         Assert.AreEqual(75, temp.damage);
         Assert.AreEqual(900, temp.cost);
     }
     else if (type == "A")
     {
         Automat temp = WeaponsFacotry.CreateWeapon(type) as Automat;
         Assert.AreEqual(30, temp.ammo);
         Assert.AreEqual("AK-47", temp.name);
         Assert.AreEqual(45, temp.damage);
         Assert.AreEqual(750, temp.cost);
     }
     else if (type == "P")
     {
         Pistol temp = WeaponsFacotry.CreateWeapon(type) as Pistol;
         Assert.AreEqual(7, temp.ammo);
         Assert.AreEqual("Desert Eagle", temp.name);
         Assert.AreEqual(30, temp.damage);
         Assert.AreEqual(500, temp.cost);
     }
     else if (type == "B")
     {
         Bazooka temp = WeaponsFacotry.CreateWeapon(type) as Bazooka;
         Assert.AreEqual(1, temp.ammo);
         Assert.AreEqual("RukyBazuky", temp.name);
         Assert.AreEqual(100, temp.damage);
         Assert.AreEqual(1000, temp.cost);
     }
     else
     {
         Granade temp = WeaponsFacotry.CreateWeapon(type) as Granade;
         Assert.AreEqual(1, temp.ammo);
         Assert.AreEqual("small", temp.name);
         Assert.AreEqual(10, temp.damage);
         Assert.AreEqual(0, temp.cost);
     }
 }
示例#19
0
            public void HandleData(string data)
            {
                output = new StringBuilder();
                output.Clear();
                var _readGeneratorDataArray = data.Split(new string[] { "----------------------------" }, StringSplitOptions.None);

                _allAutomats = new List <Automat>();
                int automatID = 1;

                foreach (var automat in _readGeneratorDataArray)
                {
                    if (string.IsNullOrWhiteSpace(automat) || automat.Equals("\r\n"))
                    {
                        break;
                    }
                    var addAutomat = new Automat(automat, automatID);
                    _allAutomats.Add(addAutomat);
                    automatID++;
                }
                _actionAutomats = _allAutomats.Where(x => x.actions.Count > 0).ToList().Select(o => o.Clone()).ToList();
            }
 static void Main(string[] args)
 {
     Console.WriteLine(Automat.Oblicz("..\\..\\..\\dane.txt"));
     Console.ReadKey();
 }
示例#21
0
 public ViewModel(MainWindow mainWindow)
 {
     Automat   = new Automat();
     ViAnzeige = new VisuAnzeigen(mainWindow, Automat);
 }
示例#22
0
        public static void MainJabuka(string[] args)
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            string outPath = Path.GetDirectoryName(new System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName());

            outPath += "\\analizator" + "\\data.txt";
            if (File.Exists(outPath))
            {
                File.Delete(outPath);
            }

            /**
             * Privremeni ulaz koji je na kraju potrebno zamijeniti sa -> stdin
             */
            string inPath = Path.GetDirectoryName(new System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName());

            inPath += "\\analizator" + "\\UlaznaDatoteka.txt";

            string[] readText = File.ReadAllLines(inPath);

            //ucitavanje reg izraza
            Dictionary <string, string> regIzrazi = new Dictionary <string, string>();

            foreach (var line in readText)
            {
                if (line.StartsWith("%X"))
                {
                    initialStateLex = line.Split(' ')[1];
                    break;
                }
                var name = line.Substring(0, line.IndexOf("}") + 1);
                var str  = "(" + line.Substring(line.IndexOf("}") + 2) + ")";
                regIzrazi.Add(name, str);
            }
            Console.WriteLine();

            /**GLAVNI PROGRAM
             */
            bool          below       = false;
            bool          actions     = false;
            string        regIzraz    = "";
            string        prvoStanje  = "";
            Automat       temp        = null;
            List <string> actionsList = null;

            foreach (var str in readText)
            {
                if (str.StartsWith("%L"))
                {
                    below = true;
                    continue;
                }

                if (actions && !str.StartsWith("{"))
                {
                    if (!str.Equals("}"))
                    {
                        actionsList.Add(str);
                    }
                    else
                    {
                        using (StreamWriter sw = File.AppendText(outPath))
                        {
                            sw.WriteLine("Početno: " + prvoStanje);
                            sw.WriteLine("Prihvatljivo: " + temp.prih_stanje);
                            sw.WriteLine("Prijelazi:");
                            sw.WriteLine("ep$|" + prvoStanje + "->" + "0");
                            foreach (var item in temp.prijelazi)
                            {
                                sw.WriteLine(item);
                            }
                            sw.WriteLine("Akcije:");
                            foreach (var act in actionsList)
                            {
                                if (act.Equals("NOVI_REDAK"))
                                {
                                    sw.WriteLine("fun1");
                                }
                                else if (act.StartsWith("UDJI_U_STANJE"))
                                {
                                    sw.WriteLine("fun2" + " " + act.Split(' ')[1]);
                                }
                                else if (act.StartsWith("VRATI_SE"))
                                {
                                    sw.WriteLine("fun3" + " " + act.Split(' ')[1]);
                                }
                                else
                                {
                                    sw.WriteLine(act);
                                }
                            }
                            sw.WriteLine("----------------------------");
                        }

                        actions = false;
                    }
                    continue;
                }


                if (below && str.Contains(">"))
                {
                    regIzraz   = str.Substring(str.IndexOf(">") + 1);
                    prvoStanje = str.Substring(1, str.IndexOf(">") - 1);
                    regIzraz   = NadopuniRegIzraz(regIzraz, regIzrazi);
                    temp       = new Automat();

                    Pretvori(temp, regIzraz);
                    actions     = true;
                    actionsList = new List <string>();
                }
            }


            //zapis akcija

            string analizatorPath = Path.GetDirectoryName(new System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName());

            analizatorPath += "\\analizator" + "\\Leksicki_analizator.cs";
            var txtLines = File.ReadAllLines(analizatorPath).ToList();

            ReplaceLine(analizatorPath, txtLines);

            stopWatch.Stop();
            Console.WriteLine("Time: " + stopWatch.ElapsedMilliseconds + " mSec");
            Console.ReadKey();
        }
示例#23
0
 public void SetAutomat(Automat automat)
 {
     this.automat = automat;
 }
 public AutomatWindow()
 {
     InitializeComponent();
     _automat    = Automat.ErstelleStandardAutomat();
     _serializer = new DataContractJsonSerializer(typeof(Automat));
 }
示例#25
0
 public async Task <string> GetResultTask2Async(Automat automat)
 {
     return(await Task.Run(() => GetResultTask2(automat)));
 }
示例#26
0
    static void Main(string[] args)
    {
        Console.SetIn(new StreamReader(@"..\..\test2.txt"));

        int casesCount = int.Parse(Console.ReadLine());
        while (casesCount-- > 0)
        {
            var automat = new Automat();
            // states
            int statesCount = int.Parse(Console.ReadLine());
            automat.InputSymbols = Console.ReadLine();

            // symbols
            int finalStatesCount = int.Parse(Console.ReadLine());
            var states = Console.ReadLine();
            automat.FinalStates = states.Split(' ').Select(int.Parse).ToList();

            // change functions
            int edgesCount = int.Parse(Console.ReadLine());
            for (int i = 0; i < edgesCount; i++)
            {
                string line = Console.ReadLine();
                automat.Transitions.Add(new Transition
                {
                    InputState = line[0] - '0',
                    Symbol = line[2],
                    OutputState = line[4] - '0',
                });
            }

            int testsCount = int.Parse(Console.ReadLine());
            for (int i = 0; i < testsCount; i++)
            {
                var result = automat.Run(Console.ReadLine());
                Console.WriteLine(result ? "ANO" : "NE");
            }

            if (casesCount != 0)
                Console.WriteLine();
        }
    }
示例#27
0
        private static void Pretvori(Automat temp, string regIzraz)
        {
            List <string> izbori     = new List <string>();
            int           cnt        = 0;
            int           br_zagrada = 0;
            int           lastCnt    = 0;

            for (int i = 0; i < regIzraz.Length; i++)
            {
                if (regIzraz[i].Equals('(') && Is_operator(regIzraz, i))
                {
                    br_zagrada++;
                }
                else if (regIzraz[i].Equals(')') && Is_operator(regIzraz, i))
                {
                    br_zagrada--;
                }
                else if (br_zagrada == 0 && regIzraz[i].Equals('|') && Is_operator(regIzraz, i))
                {
                    izbori.Add(regIzraz.Substring(lastCnt, cnt));
                    lastCnt = i + 1;
                    cnt     = -1;
                }

                cnt++;
            }

            if (lastCnt != 0)
            {
                izbori.Add(regIzraz.Substring(lastCnt));
            }


            int lijevo_stanje = temp.Novo_Stanje();
            int desno_stanje  = temp.Novo_Stanje();

            if (lastCnt != 0)
            {
                //ako je pronađen barem jedan operator izbora
                foreach (var izbor in izbori)
                {
                    Pretvori(temp, izbor);
                    temp.Dodaj_eps_prijelaz(lijevo_stanje, temp.poc_stanje);
                    temp.Dodaj_eps_prijelaz(temp.prih_stanje, desno_stanje);
                }
            }
            else
            {
                bool prefiks       = false;
                int  zadnje_stanje = lijevo_stanje;
                for (int i = 0; i < regIzraz.Length; i++)
                {
                    int a, b;
                    a = b = 0; //radi epsilon prijelaza na kraju

                    if (prefiks)
                    {
                        //ako je prefiksirano istina
                        //slučaj 1
                        prefiks = false;
                        string character;
                        if (regIzraz[i].Equals('t'))
                        {
                            character = @"\t";
                        }
                        else if (regIzraz[i].Equals('n'))
                        {
                            character = @"\n";
                        }
                        else if (regIzraz[i].Equals('_'))
                        {
                            character = @" ";
                        }
                        else
                        {
                            character = regIzraz[i].ToString();;
                        }
                        a = temp.Novo_Stanje();
                        b = temp.Novo_Stanje();
                        temp.Dodaj_prijelaz(a, b, character.ToString());
                    }
                    else
                    {
                        if (regIzraz[i] == '\\')
                        {
                            prefiks = true;
                            continue;
                        }

                        if (regIzraz[i] != '(')
                        {
                            a = temp.Novo_Stanje();
                            b = temp.Novo_Stanje();
                            if (regIzraz[i] == '$')
                            {
                                temp.Dodaj_eps_prijelaz(a, b);
                            }
                            else
                            {
                                temp.Dodaj_prijelaz(a, b, regIzraz[i].ToString());
                            }
                        }
                        else
                        {
                            //slučaj 2b
                            int zagrada  = 1;
                            int pocIndex = i;
                            int duzina   = 0;
                            while (zagrada != 0)
                            {
                                i++;
                                duzina++;
                                if (regIzraz[i].Equals('(') && Is_operator(regIzraz, i))
                                {
                                    zagrada++;
                                }
                                else if (regIzraz[i].Equals(')') && Is_operator(regIzraz, i))
                                {
                                    zagrada--;
                                }
                            }

                            Pretvori(temp, regIzraz.Substring(pocIndex + 1, duzina - 1));
                            a = temp.poc_stanje;
                            b = temp.prih_stanje;
                        }
                    }
                    if ((i + 1) < regIzraz.Length)
                    {
                        //provjera ponavljanja
                        if (regIzraz[i + 1].Equals('*'))
                        {
                            int x = a;
                            int y = b;
                            a = temp.Novo_Stanje();
                            b = temp.Novo_Stanje();
                            temp.Dodaj_eps_prijelaz(a, x);
                            temp.Dodaj_eps_prijelaz(y, b);
                            temp.Dodaj_eps_prijelaz(a, b);
                            temp.Dodaj_eps_prijelaz(y, x);
                            i++;
                        }
                    }

                    //povezivanje s ostatkom automata
                    temp.Dodaj_eps_prijelaz(zadnje_stanje, a);
                    zadnje_stanje = b;
                }
                temp.Dodaj_eps_prijelaz(zadnje_stanje, desno_stanje);
            }
            temp.poc_stanje  = lijevo_stanje;
            temp.prih_stanje = desno_stanje;
        }