Skip to content

Commit

Permalink
#15 Adding .Net Core project.json. Starting to fiddle just a bit with…
Browse files Browse the repository at this point in the history
… GedcomDate
  • Loading branch information
lowenthal-jason committed Oct 9, 2016
1 parent 12dffba commit 2511461
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 17 deletions.
41 changes: 24 additions & 17 deletions GeneGenie.Gedcom/GedcomDate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace GeneGenie.Gedcom
/// </summary>
public class GedcomDate : GedcomRecord
{
// TODO: Organize this list of private class members a bit differently once I fully understand the usage of this class
private GedcomDateType dateType;
private GedcomDatePeriod datePeriod;

Expand All @@ -48,6 +49,7 @@ public class GedcomDate : GedcomRecord
/// </summary>
public GedcomDate()
{
// TODO: Why initialize the two date1/date2 strings but leave everything else?
date1 = string.Empty;
date2 = string.Empty;
}
Expand Down Expand Up @@ -136,8 +138,9 @@ public string Time
}

/// <summary>
/// Gets or sets the date, or the first date in a date range.
/// Gets or sets
/// </summary>
/// TODO: Doc
public string Date1
{
get
Expand All @@ -157,16 +160,18 @@ public string Date1
}

/// <summary>
/// Gets the DateTime, or the first DateTime in a date range.
/// </summary>
///
/// Gets </summary>
/// TODO: Doc
public DateTime? DateTime1
{
get { return dateTime1; }
}

/// <summary>
/// Gets or sets the second date in a date range.
/// </summary>
///
/// Gets or sets </summary>
/// TODO: Doc
public string Date2
{
get
Expand All @@ -186,8 +191,9 @@ public string Date2
}

/// <summary>
/// Gets the second DateTime in a date range.
/// Gets
/// </summary>
/// TODO: Doc
public DateTime? DateTime2
{
get { return dateTime2; }
Expand Down Expand Up @@ -288,12 +294,13 @@ public string Period
/// <summary>
/// Compare two dates to see if first is greater than the second.
/// </summary>
/// <param name="a">First date to compare.</param>
/// <param name="b">Second date to compare.</param>
/// <param name="firstDateToCompare" >First date to compare.</param>
/// <param name="secondDateToCompare">Second date to compare.</param>
/// <returns>bool</returns>
public static bool operator <(GedcomDate a, GedcomDate b)
public static bool operator <(GedcomDate firstDateToCompare, GedcomDate secondDateToCompare)
{
int ret = CompareByDate(a, b);

int ret = CompareByDate(firstDateToCompare, secondDateToCompare);

return ret < 0;
}
Expand Down Expand Up @@ -350,23 +357,23 @@ public string Period
/// <summary>
/// Compare two GEDCOM format dates.
/// </summary>
/// <param name="datea">First date to compare.</param>
/// <param name="dateb">Second date to compare.</param>
/// <param name="firstDateToCompare">First date to compare.</param>
/// <param name="secondDateToCompare">Second date to compare.</param>
/// <returns>0 if equal, -1 if datea less than dateb, else 1.</returns>
public static int CompareByDate(GedcomDate datea, GedcomDate dateb)
public static int CompareByDate(GedcomDate firstDateToCompare, GedcomDate secondDateToCompare)
{
int ret = CompareNullableDateTime(datea.DateTime1, dateb.DateTime1);
int ret = CompareNullableDateTime(firstDateToCompare.DateTime1, secondDateToCompare.DateTime1);

if (ret == 0)
{
ret = CompareNullableDateTime(datea.DateTime2, dateb.DateTime2);
ret = CompareNullableDateTime(firstDateToCompare.DateTime2, secondDateToCompare.DateTime2);

if (ret == 0)
{
ret = string.Compare(datea.Date1, dateb.Date1, true);
ret = string.Compare(firstDateToCompare.Date1, secondDateToCompare.Date1, true);
if (ret == 0)
{
ret = string.Compare(datea.Date2, dateb.Date2, true);
ret = string.Compare(firstDateToCompare.Date2, secondDateToCompare.Date2, true);
}
}
}
Expand Down
21 changes: 21 additions & 0 deletions GeneGenie.Gedcom/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {
"NodaTime": "2.0.0-alpha20160729"
},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
}
},
"imports": "dnxcore50"
}
}
}

0 comments on commit 2511461

Please sign in to comment.