Example #1
0
 public WordSmall(Lex.Dane d, Lex.Word w, WordList flp, FlowLayoutPanel f)
 {
     word      = w;
     dane      = d;
     wordList  = flp;
     panelSlow = f;
     InitializeComponent();
 }
Example #2
0
 public Word(Lex.Word w, Lex.Dane d, FlowLayoutPanel flp, Sentense sentence, UserControl1 uc)
 {
     InitializeComponent();
     word          = w;
     dane          = d;
     uc1           = uc;
     panelSentence = flp;
     this.sentence = sentence;
 }
Example #3
0
        private void WordList_Load(object sender, EventArgs e)
        {
            Random          rnd  = new Random();
            List <Lex.Word> temp = dane.treesome.Values.SelectMany(t => t.words).ToList();

            for (int i = 0; i < liczbaWyswietlanychSlow; i++)
            {
                Lex.Word w = temp[rnd.Next(0, temp.Count)];
                words.Add(w);
                panelSlow.Controls.Add(new WordSmall(dane, w, this, panelSlow));
            }
        }
Example #4
0
 public ParseError(ParseErrorType parseErrorType, int lineNum, int columnNum, Lex.Token errorInfo)
     : base(lineNum, columnNum)
 {
     if (errorInfo is Lex.Word)
     {
         Lex.Word word = errorInfo as Lex.Word;
         ErrorInfo = word.Lexeme;
     }
     else
     {
         ErrorInfo = errorInfo.TokenInfo;
     }
     ParseErrorType = parseErrorType;
 }
Example #5
0
 public void AddWord(Lex.Word w)
 {
     sentence.AddWord(w);
     panelZdania.Controls.Add(new Word(w, dane, panelZdania, sentence, this));
     updateStatistic();
 }
Example #6
0
        public void Search()
        {
            if (textLiczbaSlow.Text == String.Empty || textLiczbaSlow.Text == null)
            {
                liczbaWyswietlanychSlow = 100;
            }
            else
            {
                liczbaWyswietlanychSlow = Convert.ToInt32(textLiczbaSlow.Text);
            }
            //Szukanie czesci słowa
            if (textContent.Text != null && textContent.Text != String.Empty)
            {
                List <Lex.Word> wor = new List <Lex.Word>();
                wor = dane.words.Values.Where(w => w.Content.Contains(textContent.Text)).ToList();
                for (int i = 0; i < wor.Count; i++)
                {
                    Lex.Word w = wor[i];
                    words.Add(w);
                    panelSlow.Controls.Add(new WordSmall(dane, w, this, panelSlow));
                    if (i > liczbaWyswietlanychSlow)
                    {
                        break;
                    }
                }
                return;
            }
            //Szukanie dokładnego słowa
            if (textDokladne.Text != null && textDokladne.Text != String.Empty)
            {
                if (dane.words.ContainsKey(textDokladne.Text))
                {
                    panelSlow.Controls.Add(new WordSmall(dane, dane.words[textDokladne.Text], this, panelSlow));
                }
                return;
            }

            Random rnd = new Random();

            //Sprawdzanie czy rzadkosc zaznaczona
            if (checkGodlike.Checked == false && checkLegendary.Checked == false && checkEpic.Checked == false &&
                checkRare.Checked == false && checkCommon.Checked == false && checkUncommon.Checked == false)
            {
                checkGodlike.Checked = true; checkLegendary.Checked = true; checkEpic.Checked = true;
                checkRare.Checked    = true; checkCommon.Checked = true; checkUncommon.Checked = true;
            }
            //Sprawdzanie czy wartosc minimalna zaznaczona
            if (textMin.Text == null || textMin.Text == String.Empty)
            {
                textMin.Text = "0";
            }
            if (textMax.Text == null || textMax.Text == String.Empty)
            {
                textMax.Text = "100";
            }
            //Tworzenie listy z ktorej losowane sa słowa
            List <Lex.Word> temp;

            if (checkUsedTreefone.Checked == true)
            {
                temp = dane.treesome.Values.Where(t => Rarity.IsInRarirty(
                                                      checkGodlike.Checked,
                                                      checkLegendary.Checked,
                                                      checkEpic.Checked,
                                                      checkRare.Checked,
                                                      checkUncommon.Checked,
                                                      checkCommon.Checked, t.words.Count)).SelectMany(t => t.words).ToList();
            }
            else
            {
                temp = dane.UnUsedtreesome.Values.Where(t => Rarity.IsInRarirty(
                                                            checkGodlike.Checked,
                                                            checkLegendary.Checked,
                                                            checkEpic.Checked,
                                                            checkRare.Checked,
                                                            checkUncommon.Checked,
                                                            checkCommon.Checked, t.words.Count)).SelectMany(t => t.words).ToList();
            }

            //Sprawdzanie poprawności max i min wartości
            if ((textMin.Text == null || textMin.Text == String.Empty) && (textMax.Text == null || textMax.Text == String.Empty))
            {
            }
            else
            {
                int min = Convert.ToInt32(textMin.Text);
                int max = Convert.ToInt32(textMax.Text);
                if (min > max)
                {
                    int ii = min;
                    min = max;
                    max = ii;
                }
                temp = temp.Where(w => w.Content.Length >= min && w.Content.Length <= max).ToList();
            }
            //Dodawanie losowych słow
            temp.Shuffle();
            if (temp.Count <= 0)
            {
                panelSlow.Controls.Add(new Label
                {
                    Text      = "Nie znaleziono wyników",
                    BackColor = Color.DarkRed
                });
                return;
            }
            for (int i = 0; i < temp.Count(); i++)
            {
                if (temp.Count > 0)
                {
                    Lex.Word w = temp[i];
                    words.Add(w);
                    panelSlow.Controls.Add(new WordSmall(dane, w, this, panelSlow));
                }
                if (i >= liczbaWyswietlanychSlow)
                {
                    break;
                }
            }
        }