diff --git a/Source/Expressive/Context.cs b/Source/Expressive/Context.cs index 61f4638..261d53d 100644 --- a/Source/Expressive/Context.cs +++ b/Source/Expressive/Context.cs @@ -50,6 +50,16 @@ public class Context internal char DecimalSeparator { get; } + /// + /// Gets the currently registered functions described by . + /// + public IEnumerable RegisteredFunctions => this.registeredFunctions.Values.OfType(); + + /// + /// Gets the currently registered operators described by . + /// + public IEnumerable RegisteredOperators => this.registeredFunctions.Values.OfType(); + internal IEnumerable FunctionNames => this.registeredFunctions.Keys.OrderByDescending(k => k.Length); internal IEnumerable OperatorNames => this.registeredOperators.Keys.OrderByDescending(k => k.Length); diff --git a/Source/Expressive/Expression.cs b/Source/Expressive/Expression.cs index 6a25b99..9a9d30d 100644 --- a/Source/Expressive/Expression.cs +++ b/Source/Expressive/Expression.cs @@ -59,6 +59,16 @@ public IReadOnlyCollection ReferencedVariables } } + /// + /// Gets the currently registered functions described by . + /// + public IEnumerable RegisteredFunctions => this.context.RegisteredFunctions; + + /// + /// Gets the currently registered operators described by . + /// + public IEnumerable RegisteredOperators => this.context.RegisteredOperators; + #endregion #region Constructors diff --git a/Source/Expressive/Functions/IFunction.cs b/Source/Expressive/Functions/IFunction.cs index 091ea35..844da1e 100644 --- a/Source/Expressive/Functions/IFunction.cs +++ b/Source/Expressive/Functions/IFunction.cs @@ -6,7 +6,7 @@ namespace Expressive.Functions /// /// Interface definition for a Function that can be evaluated. /// - public interface IFunction + public interface IFunction : IFunctionMetadata { /// /// Gets or sets the Variables and their values to be used in evaluating an . @@ -15,11 +15,6 @@ public interface IFunction IDictionary Variables { get; set; } #pragma warning restore CA2227 // Collection properties should be read only - /// - /// Gets the name of the Function. - /// - string Name { get; } - /// /// Forces the Function to evaluate itself using the supplied parameters. /// diff --git a/Source/Expressive/Functions/IFunctionMetadata.cs b/Source/Expressive/Functions/IFunctionMetadata.cs new file mode 100644 index 0000000..d7964ed --- /dev/null +++ b/Source/Expressive/Functions/IFunctionMetadata.cs @@ -0,0 +1,13 @@ +namespace Expressive.Functions +{ + /// + /// Interface definition for an s metadata. + /// + public interface IFunctionMetadata + { + /// + /// Gets the name of the Function. + /// + string Name { get; } + } +} diff --git a/Source/Expressive/Operators/IOperator.cs b/Source/Expressive/Operators/IOperator.cs index a2bbc83..e6c2036 100644 --- a/Source/Expressive/Operators/IOperator.cs +++ b/Source/Expressive/Operators/IOperator.cs @@ -6,13 +6,8 @@ namespace Expressive.Operators /// /// Definition for all Operators (i.e. +, -, etc.) that are available in Expressive. /// - public interface IOperator + public interface IOperator : IOperatorMetadata { - /// - /// Gets the list of tags that can be used to identify this IOperator. - /// - IEnumerable Tags { get; } - /// /// Builds the operator in to an ready for evaluation. /// diff --git a/Source/Expressive/Operators/IOperatorMetadata.cs b/Source/Expressive/Operators/IOperatorMetadata.cs new file mode 100644 index 0000000..b336739 --- /dev/null +++ b/Source/Expressive/Operators/IOperatorMetadata.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; + +namespace Expressive.Operators +{ + /// + /// Interface definition for an s metadata. + /// + public interface IOperatorMetadata + { + /// + /// Gets the list of tags that can be used to identify this IOperator. + /// + IEnumerable Tags { get; } + } +} \ No newline at end of file