public void Add(DottedItemSet set)
        {

            Contract.Requires<ArgumentNullException>(set != null, "Dotted item set must be non-null.");
            Contract.Requires<ArgumentException>(!this.Contains(set), "Already contains specified dotted item set.");

            this.ItemSets.Add(set);

        }
        public Option<int> TryGetIndexFor(DottedItemSet set)
        {

            Contract.Requires<ArgumentNullException>(set != null, "Dotted item set must be non-null.");

            return 
                ItemSets
                    .Select((state, index) => new { StateIndex = index, ComparedToNext = state.CompareTo(set) })
                    .Where(pair => pair.ComparedToNext == 0)
                    .Select(pair => pair.StateIndex)
                    .Take(1)
                    .AsOption();

        }
 public int GetIndexFor(DottedItemSet set) => this.TryGetIndexFor(set).Single();
 public bool Contains(DottedItemSet set) => this.TryGetIndexFor(set).Any();