/// <summary>
 /// Copy (clone) all my entries into the given destination.
 /// </summary>
 public void CopyTo(IJunctionWithStateSet destination)
 {
     foreach (var x in impl)
     {
         ((SetImpl2)destination).Add(x.Clone());
     }
 }
 /// <summary>
 /// Default ctor
 /// </summary>
 public JunctionWithStateSetEditorForm(IModule module, IJunctionWithStateSet junctions)
 {
     this.junctions = junctions;
     InitializeComponent();
     if (module != null)
     {
         foreach (var sensor in module.Junctions.Where(x => !junctions.Contains(x)).OrderBy(x => x.Description, NameWithNumbersComparer.Instance))
         {
             lbAll.Items.Add(sensor);
         }
         foreach (var junction in junctions.OrderBy(x => x.Description, NameWithNumbersComparer.Instance))
         {
             var stateItem = junction.Accept(Default <StateItemBuilder> .Instance, null);
             lbSet.Items.Add(stateItem);
         }
         if (lbAll.Items.Count > 0)
         {
             lbAll.SelectedIndex = 0;
         }
         if (lbSet.Items.Count > 0)
         {
             lbSet.SelectedIndex = 0;
         }
     }
     UpdateComponents();
 }
 /// <summary>
 /// Add this junction with state to the given set.
 /// </summary>
 public abstract void AddTo(IJunctionWithStateSet junctionWithStateSet);
 /// <summary>
 /// Add this junction with state to the given set.
 /// </summary>
 public override void AddTo(IJunctionWithStateSet junctionWithStateSet)
 {
     junctionWithStateSet.Add((ITurnTable)Junction, Position);
 }
 /// <summary>
 /// Add this junction with state to the given set.
 /// </summary>
 public override void AddTo(IJunctionWithStateSet junctionWithStateSet)
 {
     junctionWithStateSet.Add((ISwitch)Junction, Direction);
 }
 /// <summary>
 /// Add this junction with state to the given set.
 /// </summary>
 public override void AddTo(IJunctionWithStateSet junctionWithStateSet)
 {
     junctionWithStateSet.Add((IPassiveJunction)Junction);
 }