Exemplo n.º 1
0
 /// <summary>
 /// Gets the model mapped to the given domain.
 /// </summary>
 /// <param name="domain">The domain object which keys to the desired model..</param>
 /// <returns>The <see cref="Model.IMaxentModel"/> corresponding to the given domain.</returns>
 public IMaxentModel GetModel(IModelDomain domain)
 {
     IMaxentModel result = null;
     _lock.EnterReadLock();
     bool mapContainsKey = _map.ContainsKey(domain);
     if (mapContainsKey)
     {
         result = _map[domain];
     }
     _lock.ExitReadLock();
     if (!mapContainsKey)
     {
         throw new KeyNotFoundException(String.Format("No model has been created for domain: {0}", domain));
     }
     return result;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the model mapped to the given domain.
        /// </summary>
        /// <param name="domain">The domain object which keys to the desired model..</param>
        /// <returns>The <see cref="Model.IMaxentModel"/> corresponding to the given domain.</returns>
        public IMaxentModel GetModel(IModelDomain domain)
        {
            IMaxentModel result = null;

            _lock.EnterReadLock();
            bool mapContainsKey = _map.ContainsKey(domain);

            if (mapContainsKey)
            {
                result = _map[domain];
            }
            _lock.ExitReadLock();
            if (!mapContainsKey)
            {
                throw new KeyNotFoundException(String.Format("No model has been created for domain: {0}", domain));
            }
            return(result);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Removes the mapping for this <see cref="MaxEnt.IModelDomain"/> key from the map if present.
 /// </summary>
 /// <param name="domain">The key whose mapping is to be removed from the map.</param>
 public void RemoveDomain(IModelDomain domain)
 {
     _lock.EnterWriteLock();
     _map.Remove(domain);
     _lock.ExitWriteLock();
 }
Exemplo n.º 4
0
 /// <summary>
 /// Sets the model for the given domain.
 /// </summary>
 /// <param name="domain">The <see cref="MaxEnt.IModelDomain"/> object which keys to the model.</param>
 /// <param name="model">The <see cref="Model.IMaxentModel"/> trained for the domain.</param>
 public void SetModelForDomain(IModelDomain domain, IMaxentModel model)
 {
     _lock.EnterWriteLock();
     _map.Add(domain, model);
     _lock.ExitWriteLock();
 }
Exemplo n.º 5
0
 /// <summary>
 /// Sets the model for the given domain.
 /// </summary>
 /// <param name="domain">The <see cref="MaxEnt.IModelDomain"/> object which keys to the model.</param>
 /// <param name="model">The <see cref="Model.IMaxentModel"/> trained for the domain.</param>
 public void SetModelForDomain(IModelDomain domain, IMaxentModel model)
 {
     _lock.EnterWriteLock();
     _map.Add(domain, model);
     _lock.ExitWriteLock();
 }
Exemplo n.º 6
0
 /// <summary>
 /// Removes the mapping for this <see cref="MaxEnt.IModelDomain"/> key from the map if present.
 /// </summary>
 /// <param name="domain">The key whose mapping is to be removed from the map.</param>
 public void RemoveDomain(IModelDomain domain)
 {
     _lock.EnterWriteLock();
     _map.Remove(domain);
     _lock.ExitWriteLock();
 }