Exemple #1
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 public void Dispose()
 {
     this.Service.DisposeCalculationManager(this);
     this._formulas = new SimpleFormulaStorage();
     this._tmpFormulas.Clear();
     this.Graph.ClearNodes();
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dt.CalcEngine.CalcCalculationManager" /> class.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="source">The source.</param>
 /// <param name="storage">The storage.</param>
 internal CalcCalculationManager(CalcService service, ICalcSource source, ICalcStorage <CalcLocalIdentity, CalcExpression> storage = null)
 {
     this.Graph        = new CalcGraph(this);
     this.Evaluator    = new CalcEvaluator();
     this.Parser       = new CalcParser();
     this._formulas    = storage ?? new SimpleFormulaStorage();
     this._tmpFormulas = new Dictionary <CalcLocalIdentity, Tuple <CalcExpression, bool> >();
     this.Source       = source;
     this.Service      = service;
 }
Exemple #3
0
        /// <summary>
        /// Gets the calculation manager.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="formulaStorage">The formula storage.</param>
        /// <param name="autoCreate">if set to <see langword="true" /> [auto create].</param>
        /// <returns></returns>
        public CalcCalculationManager GetCalculationManager(ICalcSource source, ICalcStorage <CalcLocalIdentity, CalcExpression> formulaStorage = null, bool autoCreate = true)
        {
            CalcCalculationManager manager;

            if (object.ReferenceEquals(source, null))
            {
                throw new ArgumentNullException("source");
            }
            if ((!this._calcManagers.TryGetValue(source, out manager) || object.ReferenceEquals(manager, null)) && autoCreate)
            {
                this._calcManagers[source] = manager = new CalcCalculationManager(this, source, formulaStorage);
                manager.UpdateStorage();
            }
            return(manager);
        }
Exemple #4
0
        public static void Reorder(IFormulaOperatorSource mgr, ICalcStorage <CalcLocalIdentity, CalcExpression> calcStorage, int from, int to, int count, bool row, bool updateDependents = true, bool updateNames = true)
        {
            ChangingContext context = new ChangingContext();
            ReorderVisitor  visitor = new ReorderVisitor(from, to, count, row, false, null);

            GetChangingIds(mgr, row, context, visitor, updateDependents);
            if (updateDependents)
            {
                GetInvalidFormulas(mgr, context);
            }
            if (updateNames)
            {
                UpdataCustomnNames(mgr, visitor);
            }
            visitor.CurrentCalcSource = mgr.Source;
            UpdataInvalidFormula(mgr, context, visitor);
        }
Exemple #5
0
 public SpreadCalcAxialManager(Worksheet sheet, CalcCalculationManager manager, ICalcStorage <CalcLocalIdentity, CalcExpression> storage)
 {
     this.Sheet   = sheet;
     this.Manager = manager;
     this.Storage = storage;
 }