Class FeatureDescriptor
Represents a feature with name and type.
Namespace: SigStat.Common
Assembly: SigStat.Common.dll
Syntax
public class FeatureDescriptor : object
Constructors
| Improve this Doc View SourceFeatureDescriptor(String, String, Type)
Initializes a new instance of the FeatureDescriptor class, and adds it to the static descriptors.
Therefore, the key
parameter must be unique.
Declaration
protected FeatureDescriptor(string name, string key, Type featureType)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | |
System.String | key | |
Type | featureType |
Fields
| Improve this Doc View Sourcedescriptors
The static dictionary of all descriptors.
Declaration
protected static readonly Dictionary<string, FeatureDescriptor> descriptors
Field Value
Type | Description |
---|---|
Dictionary<System.String, FeatureDescriptor> |
Properties
| Improve this Doc View SourceFeatureType
Gets or sets the type of the feature.
Declaration
public Type FeatureType { get; set; }
Property Value
Type | Description |
---|---|
Type |
IsCollection
Gets whether the type of the feature is List.
Declaration
public bool IsCollection { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Key
Gets the unique key of the feature.
Declaration
public string Key { get; protected set; }
Property Value
Type | Description |
---|---|
System.String |
Name
Gets or sets a human readable name of the feature.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceGet(String)
Gets the FeatureDescriptor specified by key
.
Throws
Declaration
public static FeatureDescriptor Get(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
Returns
Type | Description |
---|---|
FeatureDescriptor |
Get<T>(String)
Gets the FeatureDescriptor<T> specified by key
.
If the key is not registered yet, a new FeatureDescriptor<T> is automatically created with the given key and type.
Declaration
public static FeatureDescriptor<T> Get<T>(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
Returns
Type | Description |
---|---|
FeatureDescriptor<T> |
Type Parameters
Name | Description |
---|---|
T |
GetAll()
Gets a dictionary of all registered feature descriptors
Declaration
public static Dictionary<string, FeatureDescriptor> GetAll()
Returns
Type | Description |
---|---|
Dictionary<System.String, FeatureDescriptor> |
IsRegistered(String)
Returns true, if there is a FeatureDescriptor registered with the given key
Declaration
public static bool IsRegistered(string featureKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | featureKey | The key to search for |
Returns
Type | Description |
---|---|
System.Boolean |
Register(String, Type)
Registers a new FeatureDescriptor with a given key. If the FeatureDescriptor is allready registered, this function will return a reference to the originally registered FeatureDescriptor. to the a
Declaration
public static FeatureDescriptor Register(string featureKey, Type type)
Parameters
Type | Name | Description |
---|---|---|
System.String | featureKey | The key for identifying the FeatureDescriptor |
Type | type | The type of the actual feature values represented by FeatureDescriptor |
Returns
Type | Description |
---|---|
FeatureDescriptor | A reference to the registered FeatureDescriptor instance |
ToString()
Returns a string represenatation of the FeatureDescriptor
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |