public LearningStatistic(LearnedSolver learnedSolver)
        {
            LearningQuality learningQuality = (LearningQuality)LearningQuality.where (new Query("LearningQuality").addTypeQuery(TypeQuery.select)
                                                                                      .addCondition("LearnedSolverID", "=", learnedSolver.ID.ToString()), typeof(LearningQuality))[0];

            MistakeTest  = learningQuality.MistakeTest;
            MistakeTrain = learningQuality.MistakeTrain;
            ClosingError = Convert.ToSingle(learningQuality.ClosingError);
        }
示例#2
0
        public void deleteSelection(Entity selection)
        {
            List <Entity> listForDelete = new List <Entity>();

            int          templateId = ((Selection)selection).TaskTemplateID;
            TaskTemplate template   = ((TaskTemplate)services.DatabaseManager.SharedManager.entityById(templateId, typeof(TaskTemplate)));

            List <Entity> taskTemplates = TaskTemplate.where (new Query("TaskTemplate").addTypeQuery(TypeQuery.select)
                                                              .addCondition("TaskID", "=", template.TaskID.ToString()), typeof(TaskTemplate));
            List <Entity> selections = new List <Entity>();

            foreach (Entity entity in taskTemplates)
            {
                List <Entity> sels = TaskTemplate.where (new Query("Selection").addTypeQuery(TypeQuery.select)
                                                         .addCondition("TaskTemplateId", "=", entity.ID.ToString())
                                                         .addCondition("Name", "=", ((Selection)selection).Name), typeof(Selection));
                if (sels.Count == 0)
                {
                    continue;
                }
                else
                {
                    listForDelete = listForDelete.Concat(sels).ToList();
                    selections    = selections.Concat(sels).ToList();
                }
            }

            foreach (Entity sel in selections)
            {
                List <Entity> selectionRows = SelectionRow.where (new Query("SelectionRow").addTypeQuery(TypeQuery.select)
                                                                  .addCondition("SelectionID", "=", sel.ID.ToString()), typeof(SelectionRow));
                listForDelete = listForDelete.Concat(selectionRows).ToList();
                for (int i = 0; i < selectionRows.Count; i++)
                {
                    List <Entity> values = ValueParameter.where (new Query("ValueParameter").addTypeQuery(TypeQuery.select)
                                                                 .addCondition("SelectionRowID", "=", selectionRows[i].ID.ToString()), typeof(ValueParameter));
                    listForDelete = listForDelete.Concat(values).ToList();
                }

                List <Entity> learnedSolverList = LearnedSolver.where (new Query("LearnedSolver").addTypeQuery(TypeQuery.select)
                                                                       .addCondition("SelectionID", "=", sel.ID.ToString()), typeof(LearnedSolver));
                listForDelete = listForDelete.Concat(learnedSolverList).ToList();
                foreach (Entity lSolver in learnedSolverList)
                {
                    List <Entity> learningQualityList = LearningQuality.where (new Query("LearningQuality").addTypeQuery(TypeQuery.select)
                                                                               .addCondition("LearnedSolverID", "=", lSolver.ID.ToString()), typeof(LearningQuality));
                    listForDelete = listForDelete.Concat(learningQualityList).ToList();
                }
            }

            DatabaseManager.SharedManager.deleteMultipleEntities(listForDelete);
        }
示例#3
0
        public void deleteTask(Entity task)
        {
            List <Entity> listForDelete = new List <Entity>();

            listForDelete.Add(task);

            List <Entity> templates = TaskTemplate.where (new Query("TaskTemplate").addTypeQuery(TypeQuery.select)
                                                          .addCondition("TaskID", "=", task.ID.ToString()), typeof(TaskTemplate));

            listForDelete = listForDelete.Concat(templates).ToList();

            foreach (Entity template in templates)
            {
                List <Entity> parameters = models.Parameter.where (new Query("Parameter").addTypeQuery(TypeQuery.select)
                                                                   .addCondition("TaskTemplateID", "=", template.ID.ToString()), typeof(models.Parameter));
                listForDelete = listForDelete.Concat(parameters).ToList();

                List <Entity> selections = Selection.where (new Query("Selection").addTypeQuery(TypeQuery.select)
                                                            .addCondition("TaskTemplateID", "=", template.ID.ToString()), typeof(Selection));
                listForDelete = listForDelete.Concat(selections).ToList();

                foreach (Entity selection in selections)
                {
                    List <Entity> selectionRows = SelectionRow.where (new Query("SelectionRow").addTypeQuery(TypeQuery.select)
                                                                      .addCondition("SelectionID", "=", selection.ID.ToString()), typeof(SelectionRow));
                    listForDelete = listForDelete.Concat(selectionRows).ToList();

                    for (int i = 0; i < selectionRows.Count; i++)
                    {
                        List <Entity> values = ValueParameter.where (new Query("ValueParameter").addTypeQuery(TypeQuery.select)
                                                                     .addCondition("SelectionRowID", "=", selectionRows[i].ID.ToString()), typeof(ValueParameter));
                        listForDelete = listForDelete.Concat(values).ToList();
                    }

                    List <Entity> learnedSolverList = LearnedSolver.where (new Query("LearnedSolver").addTypeQuery(TypeQuery.select)
                                                                           .addCondition("SelectionID", "=", selection.ID.ToString()), typeof(LearnedSolver));
                    listForDelete = listForDelete.Concat(learnedSolverList).ToList();
                    foreach (Entity lSolver in learnedSolverList)
                    {
                        List <Entity> learningQualityList = LearningQuality.where (new Query("LearningQuality").addTypeQuery(TypeQuery.select)
                                                                                   .addCondition("LearnedSolverID", "=", lSolver.ID.ToString()), typeof(LearningQuality));
                        listForDelete = listForDelete.Concat(learningQualityList).ToList();
                    }
                }
            }

            DatabaseManager.SharedManager.deleteMultipleEntities(listForDelete);
        }