private static IEnumerable <SelectionEnum> getSelectionModes(IRhsEntity entity)
 {
     if (entity.IsSymbol())
     {
         yield return(SelectionEnum.All);
     }
     else if (entity.IsGroup())
     {
         RhsGroup group = entity.AsGroup();
         if (group.Mode != RhsGroup.ModeEnum.Set)
         {
             yield return(SelectionEnum.All);
         }
         if (group.Mode.In(RhsGroup.ModeEnum.Altogether, RhsGroup.ModeEnum.Set))
         {
             yield return(SelectionEnum.Individuals);
         }
         if (group.Repetition == RepetitionEnum.Option)
         {
             yield return(SelectionEnum.Skip);
         }
     }
     else
     {
         throw new NotImplementedException();
     }
 }
 internal RhsEntitySelector(IRhsEntity entity)
 {
     this.entity      = entity;
     this.modeCounter = CycleCollection.Create(getSelectionModes(entity));
     initIndexCounter();
     // funny thing, index counter depends on mode counter
     // but sub-selectors just depends on elements, not on mode or index (of this/parent selector)
     subSelectors = entity.Elements.Select(it => new RhsEntitySelector(it)).ToArray();
 }
Exemplo n.º 3
0
        internal RhsSymbol AsSingleSymbol()
        {
            IRhsEntity elem = elements.Single();

            if (elem.IsSymbol())
            {
                return(elem.AsSymbol());
            }
            else
            {
                return(elem.AsGroup().Elements.Single().AsSymbol());
            }
        }
Exemplo n.º 4
0
 public static RhsSymbol AsSymbol(this IRhsEntity __this__)
 {
     return((RhsSymbol)__this__);
 }
Exemplo n.º 5
0
 public static bool IsSymbol(this IRhsEntity __this__)
 {
     return(__this__ is RhsSymbol);
 }
Exemplo n.º 6
0
 public static bool IsGroup(this IRhsEntity __this__)
 {
     return(__this__ is RhsGroup);
 }
Exemplo n.º 7
0
 public static RhsGroup AsGroup(this IRhsEntity __this__)
 {
     return((RhsGroup)__this__);
 }