-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from aloisdg/dev
Feat: Allow the use of equality members. Close #2
- Loading branch information
Showing
17 changed files
with
576 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,60 @@ | ||
using System; | ||
using SharpResume.Dateable; | ||
|
||
namespace SharpResume.Model | ||
{ | ||
public class Education : ADateable | ||
public class Education : ADateable, IEquatable<Education> | ||
{ | ||
public string Institution { get; set; } | ||
public string Area { get; set; } | ||
public string StudyType { get; set; } | ||
public string Gpa { get; set; } | ||
public string[] Courses { get; set; } | ||
|
||
public bool Equals(Education other) | ||
{ | ||
if (ReferenceEquals(null, other)) return false; | ||
if (ReferenceEquals(this, other)) return true; | ||
return string.Equals(Institution, other.Institution) | ||
&& string.Equals(Area, other.Area) | ||
&& string.Equals(StudyType, other.StudyType) | ||
&& string.Equals(Gpa, other.Gpa) | ||
&& Equals(Courses, other.Courses) | ||
&& Start.Equals(other.Start) | ||
&& End.Equals(other.End); | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) return false; | ||
if (ReferenceEquals(this, obj)) return true; | ||
if (obj.GetType() != this.GetType()) return false; | ||
return Equals((Education) obj); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
unchecked | ||
{ | ||
var hashCode = (Institution != null ? Institution.GetHashCode() : 0); | ||
hashCode = (hashCode*397) ^ (Area != null ? Area.GetHashCode() : 0); | ||
hashCode = (hashCode*397) ^ (StudyType != null ? StudyType.GetHashCode() : 0); | ||
hashCode = (hashCode*397) ^ (Gpa != null ? Gpa.GetHashCode() : 0); | ||
hashCode = (hashCode*397) ^ (Courses != null ? Courses.GetHashCode() : 0); | ||
hashCode = (hashCode * 397) ^ Start.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ End.GetHashCode(); | ||
return hashCode; | ||
} | ||
} | ||
|
||
public static bool operator ==(Education left, Education right) | ||
{ | ||
return Equals(left, right); | ||
} | ||
|
||
public static bool operator !=(Education left, Education right) | ||
{ | ||
return !Equals(left, right); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,43 @@ | ||
using System; | ||
|
||
namespace SharpResume.Model | ||
{ | ||
public class Interest | ||
public class Interest : IEquatable<Interest> | ||
{ | ||
public string Name { get; set; } | ||
public string[] Keywords { get; set; } | ||
|
||
public bool Equals(Interest other) | ||
{ | ||
if (ReferenceEquals(null, other)) return false; | ||
if (ReferenceEquals(this, other)) return true; | ||
return string.Equals(Name, other.Name) && Equals(Keywords, other.Keywords); | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) return false; | ||
if (ReferenceEquals(this, obj)) return true; | ||
if (obj.GetType() != this.GetType()) return false; | ||
return Equals((Interest)obj); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
unchecked | ||
{ | ||
return ((Name != null ? Name.GetHashCode() : 0) * 397) ^ (Keywords != null ? Keywords.GetHashCode() : 0); | ||
} | ||
} | ||
|
||
public static bool operator ==(Interest left, Interest right) | ||
{ | ||
return Equals(left, right); | ||
} | ||
|
||
public static bool operator !=(Interest left, Interest right) | ||
{ | ||
return !Equals(left, right); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,43 @@ | ||
using System; | ||
|
||
namespace SharpResume.Model | ||
{ | ||
public class Language | ||
public class Language : IEquatable<Language> | ||
{ | ||
public string Name { get; set; } | ||
public string Fluency { get; set; } | ||
|
||
public bool Equals(Language other) | ||
{ | ||
if (ReferenceEquals(null, other)) return false; | ||
if (ReferenceEquals(this, other)) return true; | ||
return string.Equals(Name, other.Name) && string.Equals(Fluency, other.Fluency); | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) return false; | ||
if (ReferenceEquals(this, obj)) return true; | ||
if (obj.GetType() != this.GetType()) return false; | ||
return Equals((Language)obj); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
unchecked | ||
{ | ||
return ((Name != null ? Name.GetHashCode() : 0) * 397) ^ (Fluency != null ? Fluency.GetHashCode() : 0); | ||
} | ||
} | ||
|
||
public static bool operator ==(Language left, Language right) | ||
{ | ||
return Equals(left, right); | ||
} | ||
|
||
public static bool operator !=(Language left, Language right) | ||
{ | ||
return !Equals(left, right); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.