public PuzzleLibraryEntry Create(Puzzle puzzle, string author) { var uid = nextUID++; Debug.Assert(!ContainsEntryWithUID(uid)); var newEntry = new PuzzleLibraryEntry(uid, puzzle, author); entries.Add(newEntry); return(newEntry); }
public void Add(PuzzleLibraryEntry libraryEntry) { if (libraryEntry == null) { throw new ArgumentNullException(nameof(libraryEntry)); } else if (ContainsEntryWithUID(libraryEntry.UID)) { throw new ArgumentException(); } else { this.entries.Add(libraryEntry); nextUID = Math.Max(nextUID, libraryEntry.UID + 1); } }
public int CompareTo(PuzzleLibraryEntry other) { return(this.UID.CompareTo(other.UID)); }
public bool Equals(PuzzleLibraryEntry that) { return(this.UID == that.UID); }