Пример #1
0
 void AssignUniqueIds(Exercise content, ref int cnt) { if (content is EvalExercise) ((EvalExercise)content).Id = cnt++; foreach (Exercise ex in content.SubExercises) AssignUniqueIds(ex, ref cnt); }
Пример #2
0
 void AssignOwners(Exercise ex, Exercise owner) {
   ex.Owner = owner; ex.Expand();
   foreach (Exercise subex in ex.SubExercises) AssignOwners(subex, ex);
 }
Пример #3
0
 protected static IEnumerable<Exercise> getSubExcs(Exercise[] excs) { return excs == null ? Enumerable.Empty<Exercise>() : excs; }
Пример #4
0
 protected static Exercise[] expandHelper(Exercise[] excs) {
   if (excs == null || !excs.Any(e => e is IExpandable)) return excs;
   List<Exercise> res = new List<Exercise>();
   foreach (Exercise ex in excs)
     if (ex is IExpandable) res.AddRange(((IExpandable)ex).Expand()); else res.Add(ex);
   return res.ToArray();
 }
Пример #5
0
 public static Exercise expandHelper(Exercise by) {
   if (by == null || !(by is IExpandable)) return by;
   return ((IExpandable)by).Expand().SingleOrDefault();
 }