Skip to content

Commit 449ac9c

Browse files
author
Maslov
committed
Добавлены данные.
Добавлен сервис по импорту данных в IoC.
1 parent 8cb78e1 commit 449ac9c

File tree

13 files changed

+381
-4
lines changed

13 files changed

+381
-4
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Northrend.Alodi.Interfaces;
7+
8+
namespace Northrend.Alodi.Classes
9+
{
10+
public class AreaInformation : IAreaInformation
11+
{
12+
public decimal Distance { get; init; }
13+
14+
public NodeStatus Status { get; init; }
15+
16+
public AreaInformation(decimal distance, NodeStatus status)
17+
{
18+
Distance = distance;
19+
Status = status;
20+
}
21+
}
22+
}

Northrend.Alodi/Classes/Cell.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Northrend.Alodi.Interfaces;
7+
8+
namespace Northrend.Alodi.Classes
9+
{
10+
public class Cell : ICell
11+
{
12+
public decimal Longitude { get; init; }
13+
14+
public decimal Latitude { get; init; }
15+
16+
Dictionary<string, decimal> mIntegralVelocities = [];
17+
public Dictionary<string, decimal> IntegralVelocities => mIntegralVelocities;
18+
19+
public Cell(decimal longitude, decimal latitude)
20+
{
21+
Longitude = longitude;
22+
Latitude = latitude;
23+
}
24+
25+
public void AddIntegralVelocity(string date, decimal integralVelocity)
26+
=> mIntegralVelocities.Add(date, integralVelocity);
27+
}
28+
}

Northrend.Alodi/Classes/Factory.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using Northrend.Alodi.Interfaces;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Reflection.Metadata.Ecma335;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace Northrend.Alodi.Classes
10+
{
11+
public static class Factory
12+
{
13+
public static ICell CreateCell(decimal longitude, decimal latitude)
14+
=> new Cell(longitude, latitude);
15+
16+
public static IMap CreateMap(int x, int y)
17+
=> new Map(x, y);
18+
19+
public static INode CreateNode(ushort id, string name, decimal latitude, decimal longitude)
20+
=> new Node(id, name, latitude, longitude);
21+
22+
public static INodes CreateNodeMap()
23+
=> new NodesMap();
24+
}
25+
}

Northrend.Alodi/Classes/Map.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using Northrend.Alodi.Interfaces;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace Northrend.Alodi.Classes
9+
{
10+
public class Map : IMap
11+
{
12+
ICell[,] cells;
13+
14+
public ICell[,] Cells => cells;
15+
16+
public Map(int x, int y)
17+
{
18+
cells = new Cell[x, y];
19+
}
20+
21+
public void AddCell(int x, int y, ICell cell)
22+
=> cells[x, y] = cell;
23+
}
24+
}

Northrend.Alodi/Classes/Node.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using Northrend.Alodi.Interfaces;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using System.Xml.Linq;
8+
9+
namespace Northrend.Alodi.Classes
10+
{
11+
public class Node : INode
12+
{
13+
readonly Dictionary<string, IAreaInformation> mNextNodes = [];
14+
15+
public Dictionary<string, IAreaInformation> NextNodes => mNextNodes;
16+
17+
public ushort Id { get; init; }
18+
public string Name { get; init; }
19+
public decimal Longitude { get ; init; }
20+
public decimal Latitude { get; init; }
21+
22+
23+
public Node(ushort id, string name, decimal longitude, decimal latitude)
24+
{
25+
Id = id;
26+
Name = name;
27+
Longitude = longitude;
28+
Latitude = latitude;
29+
}
30+
31+
public void AddNextNode(string name, decimal distance, NodeStatus nodeStatus)
32+
=> mNextNodes.Add(name, new AreaInformation(distance, nodeStatus));
33+
}
34+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace Northrend.Alodi.Classes
8+
{
9+
public enum NodeStatus
10+
{
11+
Excluded = -1, //исключено из расчета
12+
ClearWater = 0, //чистая вода, движение по прямой
13+
RoutingWithoutIcebreaker = 1, //роутинг, ледокола нет
14+
RoutingWithIcebreaker = 2, //роутинг, возможен ледокол
15+
}
16+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using Northrend.Alodi.Interfaces;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace Northrend.Alodi.Classes
9+
{
10+
public class NodesMap : INodes
11+
{
12+
readonly List<INode> mCollection = [];
13+
public IEnumerable<INode> Collection => mCollection;
14+
15+
public void Add(INode node)
16+
=> mCollection.Add(node);
17+
}
18+
}
2.49 MB
Binary file not shown.
14.3 KB
Binary file not shown.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Northrend.Alodi.Classes;
2+
3+
namespace Northrend.Alodi.Interfaces
4+
{
5+
public interface IAreaInformation
6+
{
7+
decimal Distance { get; init; }
8+
NodeStatus Status { get; init; }
9+
}
10+
}

0 commit comments

Comments
 (0)