Skip to content

Commit

Permalink
Moves some classes and methods into better namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
liamlaverty committed Apr 23, 2024
1 parent 0385a72 commit 4b01297
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using EtiveMor.OpenImoCiiCalculator.Core.Models.Enums;
using EtiveMor.OpenImoCiiCalculator.Core.Models.Dto;
using EtiveMor.OpenImoCiiCalculator.Core.Models.Enums;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace EtiveMor.OpenImoCiiCalculator.Core.Models.Dto
{
/// <summary>
/// A request object to hold metadata about the annual consumption of a ship
/// </summary>
public class AnnaulConsumption
{
/// <summary>
/// The year this consumption measures
/// </summary>
public int TargetYear { get; set; }

/// <summary>
/// The total fuel consumption in the given year
/// </summary>
public IEnumerable<FuelTypeConsumption> FuelConsumption { get; set; }

Check warning on line 16 in EtiveMor.OpenImoCiiCalculator/EtiveMor.OpenImoCiiCalculator.Core/Models/Dto/AnnaulConsumption.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'FuelConsumption' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 16 in EtiveMor.OpenImoCiiCalculator/EtiveMor.OpenImoCiiCalculator.Core/Models/Dto/AnnaulConsumption.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'FuelConsumption' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}

}
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
using EtiveMor.OpenImoCiiCalculator.Core.Models.Enums;
using EtiveMor.OpenImoCiiCalculator.Core.Models.MeasurementModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EtiveMor.OpenImoCiiCalculator.Core.Models
namespace EtiveMor.OpenImoCiiCalculator.Core.Models.Dto
{
public class CalculationResult
{

public CalculationResult(IEnumerable<ResultYear> results)
{
Results = results;

}

/// <summary>
/// Contains a collection of CII Ratings for each year
/// between 2019 and 2030
/// </summary>
public IEnumerable<ResultYear> Results { get; set; }


}


Expand All @@ -49,7 +42,7 @@ public class ResultYear
/// if false, the CII rating, and all other values are measured
/// </summary>
public bool IsEstimatedYear { get { return !IsMeasuredYear; } }

/// <summary>
/// The year this result references
/// </summary>
Expand Down Expand Up @@ -86,7 +79,9 @@ public class ResultYear
/// <summary>
/// This is the ratio of Attained:Required CII
/// </summary>
public double AttainedRequiredRatio { get
public double AttainedRequiredRatio
{
get
{
return AttainedCii / RequiredCii;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using EtiveMor.OpenImoCiiCalculator.Core.Models.Enums;

namespace EtiveMor.OpenImoCiiCalculator.Core.Models.Dto
{
/// <summary>
/// A request object to hold metadata about the fuel consumption of a ship
/// </summary>
public class FuelTypeConsumption
{
/// <summary>
/// The type of fuel consumed by the ship
/// </summary>
public TypeOfFuel FuelType { get; set; }

/// <summary>
/// The amount of fuel consumed by the ship in the given year (in grams)
/// </summary>
public double FuelConsumption { get; set; }
}

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using EtiveMor.OpenImoCiiCalculator.Core.Models;
using EtiveMor.OpenImoCiiCalculator.Core.Models.ShipModels;
using EtiveMor.OpenImoCiiCalculator.Core.Models.Dto;
using EtiveMor.OpenImoCiiCalculator.Core.Models.Enums;
using EtiveMor.OpenImoCiiCalculator.Core.Models.MeasurementModels;
using EtiveMor.OpenImoCiiCalculator.Core.Models.ShipModels;
using EtiveMor.OpenImoCiiCalculator.Core.Services;
using EtiveMor.OpenImoCiiCalculator.Core.Services.Impl;
using System.Security.Cryptography.X509Certificates;
using Microsoft.VisualBasic.FileIO;

namespace EtiveMor.OpenImoCiiCalculator.Core
{
Expand Down Expand Up @@ -172,17 +170,5 @@ private ImoCiiRating GetImoCiiRatingFromVectors(ShipDdVectorBoundaries boundarie
}

}

public class AnnaulConsumption
{
public int TargetYear { get; set; }
public IEnumerable<FuelTypeConsumption> FuelConsumption { get; set; }
}

public class FuelTypeConsumption
{
public TypeOfFuel FuelType { get; set; }
public double FuelConsumption { get; set; }
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using EtiveMor.OpenImoCiiCalculator.Core;
using EtiveMor.OpenImoCiiCalculator.Core.Models.Dto;
using EtiveMor.OpenImoCiiCalculator.Core.Models.Enums;
using EtiveMor.OpenImoCiiCalculator.Core.Services.Impl;
using Newtonsoft.Json;
using System.Net.Http.Headers;

namespace EtiveMor.OpenImoCiiCalculator.DemoConsoleApp
{
Expand Down

0 comments on commit 4b01297

Please sign in to comment.