Exemplo n.º 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); }
Exemplo n.º 2
0
 void AssignOwners(Exercise ex, Exercise owner) {
   ex.Owner = owner; ex.Expand();
   foreach (Exercise subex in ex.SubExercises) AssignOwners(subex, ex);
 }
Exemplo n.º 3
0
 protected static IEnumerable<Exercise> getSubExcs(Exercise[] excs) { return excs == null ? Enumerable.Empty<Exercise>() : excs; }
Exemplo n.º 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();
 }
Exemplo n.º 5
0
 public static Exercise expandHelper(Exercise by) {
   if (by == null || !(by is IExpandable)) return by;
   return ((IExpandable)by).Expand().SingleOrDefault();
 }