Skip to content

Commit ad26175

Browse files
author
Petr Sramek
committed
refactored, added documentation
1 parent 9ad4388 commit ad26175

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

src/PolylineAlgorithm/Validation/CoordinateValidator.cs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,28 @@
44
//
55

66
namespace PolylineAlgorithm.Validation;
7-
/// <summary>
8-
/// Initializes an instance of coordinate validator.
9-
/// </summary>
10-
/// <remarks>
11-
/// Initializes an instance of coordinate validator.
12-
/// </remarks>
13-
/// <param name="latitudeRange">A latitude range.</param>
14-
/// <param name="longitudeRange">A longitude range.</param>
15-
public sealed class CoordinateValidator(CoordinateRange latitudeRange, CoordinateRange longitudeRange) : ICoordinateValidator {
16-
/// <summary>
17-
/// A latitude validation range.
18-
/// </summary>
19-
public CoordinateRange Latitude { get; } = latitudeRange;
207

8+
/// <inheritdoc cref="ICoordinateValidator" />
9+
public sealed class CoordinateValidator : ICoordinateValidator {
2110
/// <summary>
22-
/// A longitude validation range.
11+
/// Creates a new <see cref="CoordinateValidator"/> class that uses
12+
/// specified <paramref name="latitudeRange"/> and <paramref name="longitudeRange"/> to determine if <see cref="Coordinate"/> value is valid.
2313
/// </summary>
24-
public CoordinateRange Longitude { get; } = longitudeRange;
14+
/// <param name="latitudeRange"></param>
15+
/// <param name="longitudeRange"></param>
16+
public CoordinateValidator(CoordinateRange latitudeRange, CoordinateRange longitudeRange) {
17+
Latitude = latitudeRange;
18+
Longitude = longitudeRange;
19+
}
20+
21+
/// <inheritdoc/>
22+
public CoordinateRange Latitude { get; }
23+
24+
/// <inheritdoc/>
25+
public CoordinateRange Longitude { get; }
2526

26-
public bool IsValid(ref readonly Coordinate coordinate) {
27+
/// <inheritdoc/>
28+
public bool IsValid(Coordinate coordinate) {
2729
return
2830
Latitude.IsInRange(coordinate.Latitude)
2931
&& Longitude.IsInRange(coordinate.Longitude);

src/PolylineAlgorithm/Validation/ICoordinateValidator.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@ namespace PolylineAlgorithm.Validation;
88
using PolylineAlgorithm.Internal;
99

1010
/// <summary>
11-
/// Defines proprties and methods used for validating coordinates.
11+
/// Provides a mechanism for validating <see cref="Coordinate"/> structure and its values, Latitude and Longitude.
1212
/// </summary>
1313
public interface ICoordinateValidator {
1414
/// <summary>
15-
/// Represents latitude validation range
15+
/// Gets latitude validation range.
1616
/// </summary>
1717
CoordinateRange Latitude { get; }
1818

1919
/// <summary>
20-
/// Represents longitude validation range
20+
/// Gets longitude validation range.
2121
/// </summary>
2222
CoordinateRange Longitude { get; }
2323

2424
/// <summary>
25-
/// Validates coordinate.
25+
/// Returns a value indicating whether <see cref="Coordinate" /> is valid.
2626
/// </summary>
27-
/// <param name="coordinate"></param>
28-
/// <returns><see langword="true"/></returns>
29-
bool IsValid(ref readonly Coordinate coordinate);
27+
/// <param name="coordinate">The coordinate to be validated.</param>
28+
/// <returns><see langword="true"/> if <paramref name="coordinate"/> is valid; otherwise, <see langword="false"/>.</returns>
29+
bool IsValid(Coordinate coordinate);
3030

3131
/// <summary>
32-
/// Represents global coordinate validator instance.
32+
/// Represents default coordinate validator instance.
3333
/// </summary>
34-
internal static ICoordinateValidator Default { get; private set; } = new CoordinateValidator(Defaults.Coordinate.Range.Latitude, Defaults.Coordinate.Range.Longitude);
34+
internal static ICoordinateValidator Default { get; } = new CoordinateValidator(Defaults.Coordinate.Range.Latitude, Defaults.Coordinate.Range.Longitude);
3535
}

0 commit comments

Comments
 (0)