-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b51df3
commit 732ef3a
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
src/Bonsai.ML.LinearDynamicalSystems/Kinematics/KinematicsHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
|
||
namespace Bonsai.ML.LinearDynamicalSystems.Kinematics | ||
{ | ||
/// <summary> | ||
/// Helper class to get the names of the state components and kinematic components using reflection | ||
/// </summary> | ||
public static class KinematicsHelper | ||
{ | ||
/// <summary> | ||
/// Gets the names of the state components defined in the kinematic component class | ||
/// </summary> | ||
public static List<string> GetStateComponents() | ||
{ | ||
List<string> stateComponents = new List<string>(); | ||
|
||
foreach (PropertyInfo property in typeof(KinematicComponent).GetProperties()) | ||
{ | ||
if (property.PropertyType == typeof(StateComponent)) | ||
{ | ||
stateComponents.Add(property.Name); | ||
} | ||
} | ||
return stateComponents; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the names of the kinematic components defined in the kinematic state class | ||
/// </summary> | ||
public static List<string> GetKinematicComponents() | ||
{ | ||
List<string> kinematicComponents = new List<string>(); | ||
|
||
foreach (PropertyInfo property in typeof(KinematicState).GetProperties()) | ||
{ | ||
if (property.PropertyType == typeof(KinematicComponent)) | ||
{ | ||
kinematicComponents.Add(property.Name); | ||
} | ||
} | ||
return kinematicComponents; | ||
} | ||
} | ||
} | ||
|