PageRenderTime 45ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/MalApi/MyAnimeListEntry.cs

https://bitbucket.org/LHCGreg/mal-api
C# | 69 lines | 47 code | 7 blank | 15 comment | 3 complexity | d6cbeca84883888b699638afe1750782 MD5 | raw file
Possible License(s): Apache-2.0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace MalApi
  6. {
  7. public class MyAnimeListEntry : IEquatable<MyAnimeListEntry>
  8. {
  9. public decimal? Score { get; private set; }
  10. public CompletionStatus Status { get; private set; }
  11. public int NumEpisodesWatched { get; private set; }
  12. public UncertainDate MyStartDate { get; private set; }
  13. public UncertainDate MyFinishDate { get; private set; }
  14. public DateTime MyLastUpdate { get; private set; }
  15. public MalAnimeInfoFromUserLookup AnimeInfo { get; private set; }
  16. public ICollection<string> Tags { get; private set; }
  17. public MyAnimeListEntry(decimal? score, CompletionStatus status, int numEpisodesWatched, UncertainDate myStartDate,
  18. UncertainDate myFinishDate, DateTime myLastUpdate, MalAnimeInfoFromUserLookup animeInfo, ICollection<string> tags)
  19. {
  20. Score = score;
  21. Status = status;
  22. NumEpisodesWatched = numEpisodesWatched;
  23. MyStartDate = myStartDate;
  24. MyFinishDate = myFinishDate;
  25. MyLastUpdate = myLastUpdate;
  26. AnimeInfo = animeInfo;
  27. Tags = tags;
  28. }
  29. public bool Equals(MyAnimeListEntry other)
  30. {
  31. if (other == null) return false;
  32. return this.AnimeInfo.AnimeId == other.AnimeInfo.AnimeId;
  33. }
  34. public override bool Equals(object obj)
  35. {
  36. return Equals(obj as MyAnimeListEntry);
  37. }
  38. public override int GetHashCode()
  39. {
  40. return AnimeInfo.AnimeId.GetHashCode();
  41. }
  42. public override string ToString()
  43. {
  44. return AnimeInfo.Title;
  45. }
  46. }
  47. }
  48. /*
  49. Copyright 2011 Greg Najda
  50. Licensed under the Apache License, Version 2.0 (the "License");
  51. you may not use this file except in compliance with the License.
  52. You may obtain a copy of the License at
  53. http://www.apache.org/licenses/LICENSE-2.0
  54. Unless required by applicable law or agreed to in writing, software
  55. distributed under the License is distributed on an "AS IS" BASIS,
  56. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  57. See the License for the specific language governing permissions and
  58. limitations under the License.
  59. */