public (double y, int n) GaussForward(double x, double eps, System.Collections.Generic.ICollection <string> finiteDifferenceOrder = null)
        {
            int c = N / 2 - 1;

            double result      = Y[c];
            double reach       = double.PositiveInfinity;
            double t           = (x - X[c]) / h;
            double accumulateT = 1;
            double nFact       = 1;// also could be in array

            int i = 1;

            while (i < n && System.Math.Abs(reach - result) > eps)
            {
                int num = i / 2;
                if (i % 2 == 0)
                {
                    num = -num;
                    --c;
                }

                accumulateT *= t + num;
                nFact       *= i;

                reach   = result;
                result += accumulateT / nFact * deltaY[i][c];

                finiteDifferenceOrder?.Add($"Δ{i}y{c}");

                ++i;
            }

            return(y : result, n : i);
        }
Пример #2
0
 public static void CollectionAddRange <E>(System.Collections.Generic.ICollection <E> c, System.Collections.Generic.ICollection <E> items)
 {
     foreach (E i in items)
     {
         c.Add(i);
     }
 }
        // METHODS
        public (double y, int n) NewtonForward(double x, double eps, System.Collections.Generic.ICollection <string> finiteDifferenceOrder = null)
        {
            double result = Y[0];
            double reach  = double.PositiveInfinity;

            double t           = (x - X[0]) / h;
            double accumulateT = 1;
            double nFact       = 1;// also could be in array

            int i = 1;

            while (i < n && System.Math.Abs(reach - result) > eps)
            {
                accumulateT *= t - i + 1;
                nFact       *= i;

                reach   = result;
                result += accumulateT / nFact * deltaY[i][0];

                finiteDifferenceOrder?.Add($"Δ{i}y{0}");

                ++i;
            }

            return(y : result, n : i);
        }
Пример #4
0
        Add <T>(System.Collections.Generic.ICollection <T> list, T value)
        {
            // Imitate the return value in the Java method.
            var wasAdded = !list.Contains(value);

            list.Add(value);
            return(wasAdded);
        }
Пример #5
0
 protected override void GenerateWmiObjects(MockCustomProviderData configurationObject,
                                            System.Collections.Generic.ICollection <ConfigurationSetting> wmiSettings)
 {
     wmiSettings.Add(
         new MockCustomProviderSetting(configurationObject.Name,
                                       configurationObject.TypeName,
                                       CustomDataWmiMapperHelper.GenerateAttributesArray(configurationObject.Attributes)));
 }
Пример #6
0
 AddAll <T>
     (System.Collections.Generic.ICollection <T> toList,
     System.Collections.Generic.ICollection <T> fromList)
 {
     foreach (T item in fromList)
     {
         toList.Add(item);
     }
 }
Пример #7
0
        private static void GetStyleInsertionsForCapturedStyle(ColorCode.Parsing.Scope scope
                                                               , System.Collections.Generic.ICollection <ColorCode.Common.TextInsertion> styleInsertions)
        {
            styleInsertions.Add(new ColorCode.Common.TextInsertion {
                Index = scope.Index,
                Scope = scope
            });


            foreach (ColorCode.Parsing.Scope childScope in scope.Children)
            {
                GetStyleInsertionsForCapturedStyle(childScope, styleInsertions);
            }

            styleInsertions.Add(new ColorCode.Common.TextInsertion {
                Index = scope.Index + scope.Length,
                Text  = "</span>"
            });
        }
Пример #8
0
        public T[] Rent(int size, System.Threading.Thread access)
        {
            int id = (access ?? System.Threading.Thread.CurrentThread).ManagedThreadId;

            //idea was to allow for the lease to initally be seperated from the pool and then be integrated in at a later time depending on emure

            //int emure = 1;

            //if (Occupancy >= Whole)
            //{
            //    if (m_Capacity >= 0 && Slots >= Capacity) return NullArray;

            //    //id <<= Slots;

            //    //emure = -1;
            //}

            //Ensure the capacity of pool with respect to the thread
            EnsureCapacity(id);

            Lease lease = new Lease(this, id, /*emure * */ size, Get(id, size));

            //Track the reference
            m_Leases.Add(lease);

            //Return the allocated array
            return(lease.Lessee);

            //If Lease is a reference type...

            ////Ensure the allocation takes places
            //using (System.Threading.ThreadLocal<Lease> leaseAllocation = new System.Threading.ThreadLocal<Lease>())
            //{
            //    //A reference to a lease reference
            //    Lease lease;

            //    //Allocate the lease instance while it was not created previously
            //    do leaseAllocation.Value = lease = new Lease(this, id, /*emure * */size, Get(id, size));
            //    while (leaseAllocation.IsValueCreated.Equals(false));

            //    //After the instance is allocated the members must also be allocated
            //    using (System.Threading.ThreadLocal<T[]> arrayAllocation = new System.Threading.ThreadLocal<T[]>())
            //    {
            //        //Create a reference to the array while it was not created previously
            //        do arrayAllocation.Value = lease.Lessee;
            //        while (arrayAllocation.IsValueCreated.Equals(false));

            //        //Track the reference
            //        m_Leases.Add(lease);

            //        //Return the allocated array
            //        return lease.Lessee;
            //    }
            //}
        }
        static StackObject *Add_3(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @item = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Collections.Generic.ICollection <System.Int32> instance_of_this_method = (System.Collections.Generic.ICollection <System.Int32>) typeof(System.Collections.Generic.ICollection <System.Int32>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Add(@item);

            return(__ret);
        }
        protected sealed override void OnStart(System.String[] args)
        {
            var section = Configuration.FileCopyMonitorSection.GetSection();

            if (null == section)
            {
                return;
            }
            var monitors = section.Monitors.OfType <Configuration.MonitorElement>();

            if ((null == monitors) || !monitors.Any())
            {
                return;
            }
            System.String name;
            System.String entry;
            foreach (var m in monitors)
            {
                try {
                    myProcess.Add(new Process(m, myLog));
                } catch (System.Exception e) {
                    myLog(System.String.Format("Exception: {0}\r\n{1}\r\nStack Trace follows:\r\n{2}", e.GetType().Name, e.Message, e.StackTrace));
                    this.Stop();
                    throw;
                }
#if TRACE
                name = m.Name;
                foreach (var path in m.Paths.OfType <Configuration.PathElement>())
                {
                    foreach (var filter in path.Filters.OfType <Configuration.FilterElement>())
                    {
                        entry = System.String.Format("Monitoring {0} : {1}\\{2}", name, path.Path, filter.Filter);
                        myLog(entry);
                    }
                }
#endif
            }
            System.Threading.Tasks.Parallel.ForEach(myProcess.AsParallel(), x => x.Start());
#if TRACE
            entry = "All monitors activated";
            myLog(entry);
#endif
        }
Пример #11
0
        /// <summary>
        /// Isolate elements with the same categories that the selected elements belong to
        /// using PickOne or WindowSelect.
        /// </summary>
        public void Isolate()
        {
            //m_document.Selection.Elements.Clear();
            System.Collections.Generic.ICollection <Reference> elements = null;
            switch (m_isolateMode)
            {
            case IsolateMode.PickOne:
                // One more element will be added to modscope
                // if user really selects an element which differs from the elements in
                // modscope before user's pick one operation.
                elements.Add(m_document.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element));
                break;

            case IsolateMode.WindowSelect:
                // Elements will be added to modscope if possilbe.
                elements = m_document.Selection.PickObjects(Autodesk.Revit.UI.Selection.ObjectType.Element);
                break;

            default:
                break;
            }

            // ElementSet elements = m_document.Selection.Elements;

            // hide all categories elements
            foreach (Category cat in m_document.Document.Settings.Categories)
            {
                SetVisibility(false, cat.Name);
            }

            // set the visibility for the selection elements
            foreach (Reference reference in elements)
            {
                Category cat = m_document.Document.GetElement(reference).Category;
                if (null != cat && !string.IsNullOrEmpty(cat.Name))
                {
                    SetVisibility(true, cat.Name);
                }
            }
        }
 partial void Aggregate(System.Collections.Generic.ICollection <System.Windows.Input.ICommand> commands)
 {
     commands.Add(Hello);
 }
Пример #13
0
 public override void AddChildren(System.Collections.Generic.ICollection <UIElement> childrenOut)
 {
     base.AddChildren(childrenOut);
     childrenOut.Add(_headerLabel);
 }
Пример #14
0
 protected override void AddAttributesToRender(System.Collections.Generic.IDictionary <HtmlTextWriterAttribute, string> attributes, System.Collections.Generic.ICollection <string> cssClasses)
 {
     base.AddAttributesToRender(attributes, cssClasses);
     cssClasses.Add("ecl-sortcolumnchooser");
 }
Пример #15
0
 void IObjectAccessible.Add(object instance)
 {
     _Collection.Add((T)instance);
 }
Пример #16
0
 public bool Add(T e)
 {
     collection.Add(e);
     return(true);
 }
Пример #17
0
 /// <summary>
 /// Creates a new instance of <see cref="StaticVisitor"/>
 /// </summary>
 /// <param name="collection">The collection to which visit stacks will be added. Use an ordered collection to preserve order of visit</param>
 public StaticVisitor(System.Collections.Generic.ICollection <System.Collections.Generic.Stack <TypeVisit> > visits)
 {
     Action        = x => visits.Add(x.Clone());
     configuration = new StaticVisitorConfiguration();
 }
Пример #18
0
 /// <summary>
 /// Creates a new instance of <see cref="StaticVisitor"/>
 /// </summary>
 /// <param name="collection">The collection to which visit stacks will be added. Use an ordered collection to preserve order of visit</param>
 /// <param name="configuration">The custom configuration which defines the visitor behaviour</param>
 public StaticVisitor(System.Collections.Generic.ICollection <System.Collections.Generic.Stack <TypeVisit> > visits, StaticVisitorConfiguration configuration)
 {
     Action             = x => visits.Add(x.Clone());
     this.configuration = configuration;
 }