private void ThrowIfVariableNotPartOfStore(IVariable variable)
 {
     if (!functions.Contains(variable))
     {
         throw new ArgumentOutOfRangeException(
                   "variable", "Function is not a part of the store, add it to the Functions first.");
     }
 }
Beispiel #2
0
        public virtual void SetVariableValues <T>(IVariable variable, IEnumerable <T> values,
                                                  params IVariableFilter[] filters)
        {
            if (!Functions.Contains(variable))
            {
                throw new ArgumentOutOfRangeException("function",
                                                      "Function is not a part of the store, add it to the Functions first.");
            }

            if (variable.IsIndependent)
            {
                SetIndependendFunctionValues(variable, filters, values);
            }
            else
            {
                SetDependendVariabeleValues(variable, filters, values);
            }

            CheckConsistency();
        }
 private void Functions_CollectionChanging(object sender, NotifyCollectionChangedEventArgs e)
 {
     switch (e.Action)
     {
     case NotifyCollectionChangedAction.Add:
         var function = (IFunction)e.Item;
         if (functions.Contains(function))
         {
             throw new ArgumentOutOfRangeException("Function already registered in the store");
         }
         break;
     }
 }
        public virtual IMultiDimensionalArray GetVariableValues(IVariable variable, params IVariableFilter[] filters)
        {
            //redirect to generic version
            if (!Functions.Contains(variable))
            {
                return(null); //cannot throw exception here TODO: why??
            }


            // simple function with one component
            if ((variable.Components.Count == 1) && (filters.Length == 0))
            {
                return(GetValues(variable.Components[0]));
            }

            return(CreateComponentArrayFromFilters(variable, filters));
        }
 public bool ContainsEdge(IBranch edge)
 {
     return edges.Contains(edge);
 }
 public bool ContainsVertex(INode node)
 {
     return vertices.Contains(node);
 }
Beispiel #7
0
 public bool ContainsVertex(INode vertex)
 {
     return(nodes.Contains(vertex));
 }
Beispiel #8
0
 public virtual bool ContainsEdge(IBranch edge)
 {
     return(branches.Contains(edge));
 }