Example #1
0
 public bool Equals(GfaInstruction instruction)
 {
     return (this.Si == instruction.Si) && (this.Xi.Equals(instruction.Xi)) && (this.Sj == instruction.Sj);
 }
Example #2
0
        private void Ajouter_Click(object sender, EventArgs e)
        {
            int Si = (int)SI.SelectedIndex;
            char car = (char)UserGfa.X[SiXSj.SelectedIndex];
            foreach (string j in SJ.SelectedItems)
            {
                int Sj = SJ.Items.IndexOf(j);
                GfaInstruction trip = new GfaInstruction(Si, car, Sj);

                if (instructionExists(trip)==-1)
                {
                    transitions.Items.Add(trip);
                    GfaTransitions.Add(trip);

                }
            }
            if (MotLu.Text.Length > 0)
            {
                foreach (char x in MotLu.Text)
                    if (!SiXSj.Items.Contains(x))
                    {
                        MessageBox.Show("La lettre '" + x + "' n'est pas dans l'alphabet!");
                        return;
                    }
                foreach (string SjItem in SJ.SelectedItems)
                {
                    int Sj = SJ.Items.IndexOf(SjItem);
                    GfaInstruction trip = new GfaInstruction(Si, MotLu.Text, Sj);
                    if (instructionExists(trip) == -1)
                    {
                        transitions.Items.Add(trip);
                        GfaTransitions.Add(trip);
                        if (!UserGfa.Read.Contains(MotLu.Text))
                            UserGfa.Read.Add(MotLu.Text);
                    }
                }
                MotLu.Text = "";
            }
        }
Example #3
0
 public void AddInstruction(GfaInstruction instruction)
 {
     AddInstruction(instruction.Si, instruction.Xi, instruction.Sj);
 }
Example #4
0
 private int instructionExists(GfaInstruction instruction)
 {
     foreach (GfaInstruction inst in GfaTransitions)
         if (inst.Equals(instruction))
             return GfaTransitions.IndexOf(inst);
     return -1;
 }
Example #5
0
 public void RemoveInstruction(GfaInstruction instruction)
 {
     RemoveInstruction(instruction.Si, instruction.Xi, instruction.Sj);
 }