Beispiel #1
0
        /// <summary>
        /// Initializes new instance of <see cref="Model"/>
        /// </summary>
        public Model()
        {
            Experiments           = new ExperimentCollection();
            Parameters            = new NamedModelEntityCollection <Parameter>();
            Criteria              = new NamedModelEntityCollection <Criterion>();
            FunctionalConstraints = new NamedModelEntityCollection <Constraint>();

            Properties = new PropertyCollection();
        }
Beispiel #2
0
        /// <summary>
        /// Creates a deep copy of <see cref="NamedModelEntityCollection{T}"/> instance
        /// </summary>
        /// <returns>Deep copy of self</returns>
        public virtual object Clone()
        {
            NamedModelEntityCollection <T> copy = new NamedModelEntityCollection <T>(Count);

            foreach (KeyValuePair <TId, T> item in this)
            {
                copy.Add(item.Key, (T)item.Value.Clone());
            }

            return(copy);
        }
        /// <summary>
        /// Checks if there already is an element with such <paramref name="variableIdentifier"/> in
        /// <paramref name="collection"/>
        /// </summary>
        /// <param name="collection">A collection to look for variable identifier in</param>
        /// <param name="variableIdentifier">Constraint variable identifier</param>
        /// <returns>True if a match is found</returns>
        private bool CheckVariableIdentifier <T>(NamedModelEntityCollection <T> collection, string variableIdentifier)
            where T : NamedModelEntity
        {
            if (collection == null)
            {
                throw new ArgumentNullException("collection");
            }

            if (string.IsNullOrEmpty(variableIdentifier))
            {
                throw new ArgumentNullException("variableIdentifier");
            }

            return((collection.FindByVariableIdentifier(variableIdentifier) == null) ? false : true);
        }