コード例 #1
0
 /// <summary>
 ///     Returns the map to which the specified property key is mapped, or
 ///     an empty map if this properties contains no mapping for the property key.
 ///     Note that the empty map is not mapped to the property key.
 /// </summary>
 /// <param name="property">
 ///     the property key whose associated map is to be returned
 /// </param>
 /// <returns>
 ///     the map to which the specified property key is mapped, or
 ///     an empty map if this properties contains no mapping for the property key
 /// </returns>
 /// <seealso cref= # putMapEntry( PropertyMapKey, Object, Object
 /// )
 /// </seealso>
 public virtual IDictionary <TK, TV> Get <TK, TV>(PropertyMapKey <TK, TV> property)
 {
     if (Contains(property))
     {
         return((IDictionary <TK, TV>)properties[property.Name]);
     }
     return(new Dictionary <TK, TV>());
 }
コード例 #2
0
        /// <summary>
        ///     Insert the value to the map to which the specified property key is mapped. If
        ///     this properties contains no mapping for the property key, the value insert to
        ///     a new map witch is associate the the specified property key.
        /// </summary>
        /// @param
        /// <K>
        ///     the type of keys maintained by the map </param>
        ///     @param
        ///     <V>
        ///         the type of mapped values </param>
        ///         <param name="property">
        ///             the property key whose associated list is to be added
        ///         </param>
        ///         <param name="value">
        ///             the value to be appended to list
        ///         </param>
        public virtual void PutMapEntry <TK, TV>(PropertyMapKey <TK, TV> property, TK key, TV value)
        {
            var map = Get(property);

            if (!property.AllowsOverwrite && map.ContainsKey(key))
            {
                throw new ProcessEngineException("Cannot overwrite property key " + key + ". Key already exists");
            }

            map[key] = value;

            if (!Contains(property))
            {
                Set(property, map);
            }
        }
コード例 #3
0
 /// <summary>
 ///     Returns <code>true</code> if this properties contains a mapping for the specified property key.
 /// </summary>
 /// <param name="property">
 ///     the property key whose presence is to be tested
 /// </param>
 /// <returns> <code>true</code> if this properties contains a mapping for the specified property key </returns>
 public virtual bool Contains <TK, TV>(PropertyMapKey <TK, TV> property)
 {
     return(properties.ContainsKey(property.Name));
 }
コード例 #4
0
 /// <summary>
 ///     Associates the specified map with the specified property key. If the properties previously contained a mapping for
 ///     the property key, the old
 ///     value is replaced by the specified map.
 /// </summary>
 /// @param
 /// <K>
 ///     the type of keys maintained by the map </param>
 ///     @param
 ///     <V>
 ///         the type of mapped values </param>
 ///         <param name="property">
 ///             the property key with which the specified map is to be associated
 ///         </param>
 ///         <param name="value">
 ///             the map to be associated with the specified property key
 ///         </param>
 public virtual void Set <TK, TV>(PropertyMapKey <TK, TV> property, IDictionary <TK, TV> value)
 {
     properties[property.Name] = value;
 }