Skip to content

Commit c789a48

Browse files
committed
ahaha
1 parent a0d05e3 commit c789a48

12 files changed

Lines changed: 62 additions & 70 deletions

src/PolylineAlgorithm/Abstraction/AbstractPolylineDecoder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
//
55

66
using Microsoft.Extensions.Logging;
7-
using PolylineAlgorithm.Diagnostics;
87
using PolylineAlgorithm.Internal.Diagnostics;
98
using System.Runtime.CompilerServices;
109

src/PolylineAlgorithm/Abstraction/AbstractPolylineEncoder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ namespace PolylineAlgorithm.Abstraction;
77

88
using Microsoft.Extensions.Logging;
99
using PolylineAlgorithm;
10-
using PolylineAlgorithm.Diagnostics;
1110
using PolylineAlgorithm.Internal;
1211
using PolylineAlgorithm.Internal.Diagnostics;
1312
using System;

src/PolylineAlgorithm/Extensions/PolylineEncoderExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace PolylineAlgorithm.Extensions;
22

33
using PolylineAlgorithm.Abstraction;
4-
using PolylineAlgorithm.Diagnostics;
4+
using PolylineAlgorithm.Internal.Diagnostics;
55
using System;
66
using System.Collections.Generic;
77
using System.Diagnostics.CodeAnalysis;
@@ -14,7 +14,7 @@ namespace PolylineAlgorithm.Extensions;
1414
/// </summary>
1515
public static class PolylineEncoderExtensions {
1616
/// <summary>
17-
/// Encodes a collection of <see cref="Coordinate"/> instances into an encoded polyline.
17+
/// Encodes a collection of <see cref="TValue"/> instances into an encoded polyline.
1818
/// </summary>
1919
/// <param name="encoder">
2020
/// The <see cref="IPolylineEncoder{TValue, TPolyline}"/> instance used to perform the encoding operation.

src/PolylineAlgorithm/Diagnostics/ExceptionGuard.cs renamed to src/PolylineAlgorithm/Internal/Diagnostics/ExceptionGuard.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace PolylineAlgorithm.Diagnostics;
1+
namespace PolylineAlgorithm.Internal.Diagnostics;
22

33
using PolylineAlgorithm;
44
using PolylineAlgorithm.Properties;
@@ -218,7 +218,7 @@ public static void ThrowInvalidPolylineBlockTerminator() {
218218
/// resource strings. This class is public because messages are only used by the guard methods.
219219
/// </remarks>
220220
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Internal use only.")]
221-
public static class ExceptionMessage {
221+
internal static class ExceptionMessage {
222222
#if NET8_0_OR_GREATER
223223
private static readonly CompositeFormat StackAllocLimitMustBeEqualOrGreaterThanFormat = CompositeFormat.Parse(ExceptionMessageResource.StackAllocLimitMustBeEqualOrGreaterThanFormat);
224224
private static readonly CompositeFormat PolylineCannotBeShorterThanFormat = CompositeFormat.Parse(ExceptionMessageResource.PolylineCannotBeShorterThanFormat);

src/PolylineAlgorithm/Internal/Diagnostics/LogDebugExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace PolylineAlgorithm.Internal.Diagnostics;
99

1010
internal static partial class LogDebugExtensions {
1111
private const LogLevel LOG_LEVEL = LogLevel.Debug;
12-
private const int EVENT_ID_BASE = (int)LOG_LEVEL * 100;
12+
private const int EVENT_ID_BASE = (int)LOG_LEVEL * Defaults.Logging.LogLevelMultiplier;
1313

1414
[LoggerMessage(EVENT_ID_BASE + 1, LOG_LEVEL, "Operation {operationName} has started.")]
1515
internal static partial void LogOperationStartedDebug(this ILogger logger, string operationName);

src/PolylineAlgorithm/Internal/Diagnostics/LogWarningExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ internal static partial class LogWarningExtensions {
2727
/// Base value for event ids used by the <see cref="LoggerMessageAttribute"/> annotations.
2828
/// Computed as <c>(int)LOG_LEVEL * 100</c>.
2929
/// </summary>
30-
private const int EVENT_ID_BASE = (int)LOG_LEVEL * 100;
30+
private const int EVENT_ID_BASE = (int)LOG_LEVEL * Defaults.Logging.LogLevelMultiplier;
3131

3232
/// <summary>
3333
/// Logs a warning when a method argument is <c>null</c>.

src/PolylineAlgorithm/Internal/Pow10.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace PolylineAlgorithm.Internal;
1+
namespace PolylineAlgorithm.Internal;
22

33
using System;
44

@@ -13,7 +13,7 @@ internal static class Pow10 {
1313
/// <summary>
1414
/// Pre-computed powers of 10 from 10^0 to 10^9.
1515
/// </summary>
16-
private static readonly uint[] _pow10 = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 };
16+
private static readonly uint[] _pow10 = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000];
1717

1818
/// <summary>
1919
/// Returns the power of 10 for the specified precision level.

src/PolylineAlgorithm/PolylineEncoding.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55

66
namespace PolylineAlgorithm;
77

8-
using PolylineAlgorithm.Diagnostics;
98
using PolylineAlgorithm.Internal;
10-
9+
using PolylineAlgorithm.Internal.Diagnostics;
1110
using System;
1211
using System.Numerics;
1312
using System.Runtime.InteropServices;
@@ -79,7 +78,7 @@ public static int Normalize(double value, uint precision = 5) {
7978
/// This is the inverse of <see cref="Normalize"/>. The method divides <paramref name="value"/> by 10^<paramref name="precision"/>
8079
/// and returns a <see cref="double"/>. If <paramref name="precision"/> is zero the integer value is returned as a double unchanged.
8180
/// </para>
82-
/// <para>Arithmetic is performed in a <c>checked</c> context so that any overflow is surfaced as an <see cref="OverflowException"/>.</para>
81+
/// <para>Arithmetic is performed in a <see langword="checked"/> context so that any overflow is surfaced as an <see cref="OverflowException"/>.</para>
8382
/// </remarks>
8483
/// <param name="value">Integer normalized coordinate (typically produced by <see cref="Normalize"/>).</param>
8584
/// <param name="precision">Number of decimal places that were used when normalizing. Default is 5.</param>
@@ -114,14 +113,14 @@ public static double Denormalize(int value, uint precision = 5) {
114113
/// </para>
115114
/// <para>
116115
/// The <paramref name="position"/> argument is advanced to the character after the last character consumed for the value.
117-
/// If the buffer ends before a complete encoded value is available the method returns <c>false</c> and <paramref name="position"/>
116+
/// If the buffer ends before a complete encoded value is available the method returns <see langword="false"/> and <paramref name="position"/>
118117
/// will point to the buffer end.
119118
/// </para>
120119
/// </remarks>
121120
/// <param name="delta">Reference to the accumulator; the decoded value will be added to this parameter.</param>
122121
/// <param name="buffer">Read-only memory containing polyline-encoded characters.</param>
123122
/// <param name="position">Reference to the current index in <paramref name="buffer"/>; advanced as characters are read.</param>
124-
/// <returns><c>true</c> if a full value was decoded; <c>false</c> if the buffer ended before the value was complete.</returns>
123+
/// <returns><see langword="true"/> if a full value was decoded; <see langword="false"/> if the buffer ended before the value was complete.</returns>
125124
public static bool TryReadValue(ref int delta, ReadOnlyMemory<char> buffer, ref int position) {
126125
// Validate that the position is within the bounds of the buffer.
127126
if (position >= buffer.Length) {
@@ -164,14 +163,14 @@ public static bool TryReadValue(ref int delta, ReadOnlyMemory<char> buffer, ref
164163
/// </para>
165164
/// <para>
166165
/// Before writing the method checks that there is sufficient space in the destination span by calling
167-
/// <see cref="GetRequiredBufferSize(int)"/>. If there is not enough space the method returns <c>false</c> without modifying
166+
/// <see cref="GetRequiredBufferSize(int)"/>. If there is not enough space the method returns <see langword="false"/> without modifying
168167
/// the buffer or position.
169168
/// </para>
170169
/// </remarks>
171170
/// <param name="delta">The integer value to encode (typically a coordinate delta).</param>
172171
/// <param name="buffer">Destination character span to write the encoded characters into.</param>
173172
/// <param name="position">Reference to the current write index in <paramref name="buffer"/>; advanced as characters are written.</param>
174-
/// <returns><c>true</c> if the value was encoded and written; <c>false</c> if the buffer did not have sufficient space.</returns>
173+
/// <returns><see langword="true"/> if the value was encoded and written; <see langword="false"/> if the buffer did not have sufficient space.</returns>
175174
public static bool TryWriteValue(int delta, Span<char> buffer, ref int position) {
176175
// Validate that the position and required space for write is within the bounds of the buffer.
177176
if (buffer[position..].Length < GetRequiredBufferSize(delta)) {

src/PolylineAlgorithm/PolylineEncodingOptionsBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace PolylineAlgorithm;
77

88
using Microsoft.Extensions.Logging;
99
using Microsoft.Extensions.Logging.Abstractions;
10-
using PolylineAlgorithm.Diagnostics;
10+
using PolylineAlgorithm.Internal.Diagnostics;
1111

1212
/// <summary>
1313
/// Provides a builder for configuring options for polyline encoding operations.

tests/PolylineAlgorithm.Tests/Internal/Diagnostics/ExceptionGuardTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace PolylineAlgorithm.Tests.Internal.Diagnostics;
77

8-
using PolylineAlgorithm.Diagnostics;
8+
using PolylineAlgorithm.Internal.Diagnostics;
99
using System;
1010

1111
/// <summary>

0 commit comments

Comments
 (0)