Exemple #1
0
 /// <summary>
 /// Gets the specified feature. This is the preferred way.
 /// </summary>
 /// <param name="featureDescriptor"></param>
 /// <returns>The casted feature object</returns>
 public T GetFeature <T>(FeatureDescriptor <T> featureDescriptor)
 {
     return((T)features[featureDescriptor.Key]);
 }
Exemple #2
0
 public bool HasFeature(FeatureDescriptor featureDescriptor)
 {
     return(features.ContainsKey(featureDescriptor.Key));
 }
Exemple #3
0
        /*public T GetFeature<T>()
         * {
         *  return (T)features[FeatureDescriptor.GetKey<T>()];
         * }*/

        /*public T GetFeature<T>(int index)
         * {
         *  return ((List<T>)features[FeatureDescriptor.GetKey<T>()])[index];
         * }*/

        /// <summary>
        /// Gets a collection of <see cref="FeatureDescriptor"/>s that are used in this signature.
        /// </summary>
        /// <returns>A collection of <see cref="FeatureDescriptor"/>s.</returns>
        public IEnumerable <FeatureDescriptor> GetFeatureDescriptors()
        {
            return(features.Keys.Select(k => FeatureDescriptor.GetDescriptor(k)));
        }
Exemple #4
0
        /*/// <summary>
         * /// Gets a list of <see cref="FeatureDescriptor"/>s of given type <typeparamref name="T"/> that are used in this signature.
         * /// </summary>
         * /// <returns>A list of <see cref="FeatureDescriptor"/>s.</returns>
         * public List<T> GetFeatures<T>()
         * {
         *  return (features.TryGetValue(FeatureDescriptor.GetKey<T>(), out var result)) ? result as List<T> : null;
         * }*/

        /*public void SetFeature<T>(T feature)
         * {
         *  features[FeatureDescriptor.GetKey(feature.GetType())] = feature;
         * }*/

        /*public void SetFeatures<T>(List<T> feature)
         * {
         *  features[FeatureDescriptor.GetKey<T>()] = feature;
         * }*/

        /// <summary>
        /// Sets the specified feature. This is the preferred way.
        /// </summary>
        /// <param name="featureDescriptor">The feature to put the new value in.</param>
        /// <param name="feature">The value to set.</param>
        public void SetFeature <T>(FeatureDescriptor featureDescriptor, T feature)
        {
            features[featureDescriptor.Key] = feature;
        }
Exemple #5
0
 /// <summary>
 /// Gets the specified feature. This is the preferred way.
 /// </summary>
 /// <param name="featureDescriptor"></param>
 /// <returns>The casted feature object</returns>
 public T GetFeature <T>(FeatureDescriptor featureDescriptor)
 {
     //TODO: try cast, catch log
     return((T)features[featureDescriptor.Key]);
 }