예제 #1
0
 public Ring(Field field, string[] vars)
 {
     this.field = field;
     Dimension  = vars.Length;
     for (int i = 0; i < vars.Length; i++)
     {
         VariableOrder.Add(i, i);
         VariableIndexToString.Add(i, vars[i]);
         VariableStringToIndex.Add(vars[i], i);
     }
 }
예제 #2
0
        /// <param name="sortBy"></param>
        /// <param name="sortOrder"></param>
        /// <param name="variable">
        /// Mandatory when <paramref name="sortBy" /> is either
        /// <see cref="TaskSorting.ProcessVariable"/>, <see cref="TaskSorting.ExecutionVariable"/>, <see cref="TaskSorting.TaskVariable"/>, <see cref="TaskSorting.CaseExecutionVariable"/> or <see cref="TaskSorting.CaseInstanceVariable"/>
        /// </param>
        public TaskQuery Sort(TaskSorting sortBy, SortOrder sortOrder = SortOrder.Ascending, VariableOrder variable = null)
        {
            Dictionary <string, object> parameters = null;

            TaskSorting[] variableSorting = new[] {
                TaskSorting.ProcessVariable,
                TaskSorting.ExecutionVariable,
                TaskSorting.TaskVariable,
                TaskSorting.CaseExecutionVariable,
                TaskSorting.CaseInstanceVariable
            };

            bool isVariableSorting = variableSorting.Contains(sortBy);

            if (isVariableSorting ^ variable != null)
            {
                throw new ArgumentException("Variable is mandatory when sortBy is either processVariable, executionVariable, taskVariable, caseExecutionVariable or caseInstanceVariable.", nameof(variable));
            }

            if (variable != null)
            {
                parameters = new Dictionary <string, object>()
                {
                    ["variable"] = variable.VariableName,
                    ["type"]     = variable.Type.ToString(),
                };
            }

            Sorting.Add(new SortingInfo <TaskSorting>()
            {
                SortBy = sortBy, SortOrder = sortOrder, Parameters = parameters
            });

            return(this);
        }