Skip to content

Commit 2988e1a

Browse files
Implement the Chemical Domain in the Semantics library, completing 10 quantities: ActivationEnergy, AmountOfSubstance, Concentration, DynamicViscosity, EnzymeActivity, MolarMass, PH, RateConstant, ReactionRate, and SurfaceTension. Introduce PhysicalConstants.cs for centralized management of physical constants, ensuring accuracy and maintainability. Update PhysicalDimensions and Units to incorporate new chemical dimensions and units. Achieve 376 passing tests, marking the Chemical domain as fully implemented in TODO_DOMAINS.md.
1 parent b1f0d38 commit 2988e1a

13 files changed

Lines changed: 3211 additions & 57 deletions

.cursor/rules/derived-cursor-rules.mdc

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ This file defines all project rules, coding standards, workflow guidelines, refe
2828
* The validation reference documentation should be comprehensive and accurate, including newer validation attributes.
2929
* Update the `README.md` and `docs/` to describe the whole library.
3030
* Create a `docs/complete-library-guide.md` file to provide a comprehensive overview of all features and components in the ktsu.Semantics library.
31+
* Before we continue implementing more domains, search the quantities, units, and dimensions for hard coded values that should be defined as physical constants and define them somewhere appropriate. Add this to the TODO document as part of the implementation guidelines.
32+
* Apply the constants in any appropriate calculations in the quantities units and dimensions, you may define derived constants as well and create unit tests comparing the constant derived values vs calculated derived values using the fundamental constants
33+
* **Management Rules for Physical Constants:**
34+
1. Use `PhysicalConstants.Generic` methods for type-safe access
35+
2. Add new constants to `PhysicalConstants.cs` before using them
36+
3. Refactor existing hard-coded values when implementing new domains
37+
4. Document constant sources (CODATA, NIST, ISO/IEC)
3138

3239
When adding XML documentation comments:
3340

@@ -144,7 +151,7 @@ When adding XML documentation comments:
144151
* `IsGuidAttribute` - Now marked as obsolete, encouraging users to use `System.Guid` instead of semantic string types, emphasizing type safety and efficiency
145152
* `IsIpAddressAttribute` - Now suggests using `System.Net.IPAddress` instead of semantic string types, focusing on the comprehensive network API
146153
* `IsDateTimeAttribute` - Now marked as obsolete, encouraging users to use `System.DateTime` instead of semantic string types, highlighting the broader benefits
147-
* `IsTimeSpanAttribute` - Now marked as obsolete, encouraging users to use `System.TimeSpan` instead of semantic string types, highlighting the broader benefits
154+
* `IsTimeSpanAttribute` - Now marked as obsolete, encouraging users to use `System.TimeSpanAttribute` instead of semantic string types, highlighting the broader benefits
148155
* `IsUriAttribute` - Now suggests using `System.Uri` instead of semantic string types, focusing on the comprehensive network API
149156
* `IsDecimalAttribute` - Now suggests using `System.DecimalAttribute` instead of semantic string types, focusing on the comprehensive mathematical API
150157
* `IsDoubleAttribute` - Now suggests using `System.DoubleAttribute` instead of semantic string types, focusing on the comprehensive mathematical API
@@ -249,6 +256,17 @@ When adding XML documentation comments:
249256
* Follow the existing code style and patterns.
250257
* Include XML documentation comments.
251258
* Implement mathematical relationships between related quantities.
259+
* Before we continue implementing more domains, search the quantities, units, and dimensions for hard coded values that should be defined as physical constants and define them somewhere appropriate. Add this to the TODO document as part of the implementation guidelines.
260+
* Apply the constants in any appropriate calculations in the quantities units and dimensions, you may define derived constants as well and create unit tests comparing the constant derived values vs calculated derived values using the fundamental constants
261+
* **Management Rules for Physical Constants:**
262+
1. Use `PhysicalConstants.Generic` methods for type-safe access
263+
2. Add new constants to `PhysicalConstants.cs` before using them
264+
3. Refactor existing hard-coded values when implementing new domains
265+
4. Document constant sources (CODATA, NIST, ISO/IEC)
266+
* When a file is missing the standard header, add the following to the top of the file:
267+
```csharp
268+
// Copyright (c) KTSU. All rights reserved.
269+
```
252270

253271
## DEBUGGING
254272

@@ -326,29 +344,4 @@ When adding XML documentation comments:
326344
* When encountering CS0200 errors, Property or indexer 'PhysicalQuantity<SoundIntensityLevel<T>, T>.Value' cannot be assigned to -- it is read only, make sure you are not trying to assign to a read-only property.
327345
* When encountering CA1062 errors, In externally visible method 'SoundPressureLevel<T> SoundPressureLevel<T>.FromSoundPressure(SoundPressure<T> soundPressure)', validate parameter 'soundPressure' is non-null before using it. If appropriate, throw an 'ArgumentNullException' when the argument is 'null' add a null check for the reference parameter.
328346
* When fixing CS0704 errors (Cannot do non-virtual member lookup in 'T' because it is a type parameter), add the appropriate generic constraints (e.g., `where T : struct, INumber<T>, IFloatingPoint<T>`).
329-
* When fixing CA1062 errors (In externally visible method X, validate parameter Y is non-null before using it), add `ArgumentNullException.ThrowIfNull(parameterName)` at the beginning of the method.
330-
* When a file is missing the standard header, add the following to the top of the file:
331-
```csharp
332-
// Copyright (c) KTSU. All rights reserved.
333-
```
334-
335-
## WORKFLOW & RELEASE RULES
336-
337-
(Workflow and release rules are documented here.)
338-
339-
* The main project `README.md` should mention the `examples` directory and its purpose.
340-
* Before releasing a version:
341-
* Fix all failing tests; a 100% pass rate is required.
342-
* Update the version from `1.0.0-pre.1` to `1.0.0` (or the appropriate version number).
343-
* Update `CHANGELOG.md` with proper release notes.
344-
* Perform final testing across different .NET versions.
345-
* Conduct performance testing (if applicable).
346-
* Conduct a security review of validation logic.
347-
* When adding new interfaces to the project, add tests to verify that the interfaces are properly implemented and that polymorphism works as expected. Consider adding the interface tests to the existing `SemanticPathTests.cs` file or creating a separate test file, depending on the existing test structure.
348-
* Determine if interfaces can implicitly cast to system strings so that they can be passed transparently where strings are normally used.
349-
* Split out the non-trivial types from files with multiple types in them
350-
* When calculating directory `Depth`, the value is the number of directory separators in the path.
351-
* For ease of use, use a single common namespace for all types in the library.
352-
* SemanticStringValidationExamples can just be built in semantic types where appropriate
353-
* The built in semantic string types should not need the string suffix.
354-
*
347+
* When fixing CA1062 errors (In externally visible method X, validate parameter Y is non-null before using it), add `ArgumentNullException.ThrowIfNull(parameterName

0 commit comments

Comments
 (0)