Beispiel #1
0
        private void ButtonAddFluent_Click(object sender, RoutedEventArgs e)
        {
            if (TextBoxFluents.Text == "")
            {
                LabelFluentsActionsValidation.Content = "Fluent name is required.";
                return;
            }
            if (!System.Text.RegularExpressions.Regex.IsMatch(TextBoxFluents.Text, @"[a-zA-Z]+[a-zA-Z0-9\-]*$"))
            {
                LabelFluentsActionsValidation.Content = "Fluent name should be alphanumeric.";
                return;
            }

            if (!Fluents.Contains(Fluents.FirstOrDefault(f => (f.Name == TextBoxFluents.Text))))
            {
                var f = new Fluent {
                    Name = this.TextBoxFluents.Text
                };
                Fluents.Add(f);
                TextBoxFluents.Text = "";
                LabelFluentsActionsValidation.Content = "";
            }
            else
            {
                LabelFluentsActionsValidation.Content = "Fluent with this name already exists.";
            }
        }
Beispiel #2
0
        public void AddFluent(string fluent)
        {
            var negFluent = "not_" + fluent;

            Fluents.Add(fluent);
            Fluents.Add(negFluent);
            Negations.Add($"negation({fluent}, {negFluent}).");
            Negations.Add($"negation({negFluent}, {fluent}).");
        }