예제 #1
0
        public void SortDiamond()
        {
            var a = new C1Builder(this.Session).Build();
            var b = new C1Builder(this.Session).Build();
            var c = new C1Builder(this.Session).Build();
            var d = new C1Builder(this.Session).Build();

            a.AddDependency(b);
            a.AddDependency(c);

            b.AddDependency(d);
            c.AddDependency(d);

            var derivation = new Derivation(this.Session, new DerivationConfig {
                ThrowExceptionOnCycleDetected = true
            });

            var sequence = new List <IObject>();

            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.Equal(d, sequence[0]);
            Assert.Equal(a, sequence[3]);

            Assert.Equal(1, a.DerivationCount);
            Assert.Equal(1, b.DerivationCount);
            Assert.Equal(1, c.DerivationCount);
            Assert.Equal(1, d.DerivationCount);
        }
예제 #2
0
        public void CreateCyclicDependencyDuringDerive()
        {
            var left = new LeftBuilder(this.Session).Build();

            left.CreateMiddle = true;

            var errorThrown = false;

            var derivation = new Derivation(this.Session, new DerivationConfig {
                ThrowExceptionOnCycleDetected = true
            });

            try
            {
                derivation.Derive();
            }
            catch (Exception)
            {
                errorThrown = true;
            }

            Assert.True(errorThrown);

            Assert.Equal(1, left.DerivationCount);
            Assert.Equal(0, left.Middle.DerivationCount);
        }
 public BiquarticHermiteSpline(SurfaceDimension uDimension,
     SurfaceDimension vDimension, KnotsGenerator knotsGenerator,
     Derivation derivation = Derivation.Zero)
     : base(uDimension, vDimension,
         new BiquarticKnotsGenerator(knotsGenerator), derivation)
 {
 }
예제 #4
0
        public void Sort()
        {
            var x = new C1Builder(this.Session).Build();
            var y = new C1Builder(this.Session).Build();
            var z = new C1Builder(this.Session).Build();

            x.AddDependency(y);
            y.AddDependency(z);

            var derivation = new Derivation(this.Session, new DerivationConfig {
                ThrowExceptionOnCycleDetected = true
            });

            var sequence = new List <IObject>();

            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.Equal(z, sequence[0]);
            Assert.Equal(y, sequence[1]);
            Assert.Equal(x, sequence[2]);

            Assert.Equal(1, x.DerivationCount);
            Assert.Equal(1, y.DerivationCount);
            Assert.Equal(1, z.DerivationCount);
        }
예제 #5
0
        public void NoCyclicDependencyDuringSyncExisting()
        {
            var syncRoot = new SyncRootBuilder(this.Session).Build();

            this.Session.Derive();
            this.Session.Commit();

            var errorThrown = false;

            syncRoot.SyncDepth1.SyncDepth2.Value = 1;

            var derivation = new Derivation(this.Session, new DerivationConfig {
                ThrowExceptionOnCycleDetected = true
            });

            try
            {
                derivation.Derive();
            }
            catch (Exception)
            {
                errorThrown = true;
            }

            Assert.False(errorThrown);

            Assert.Equal(2, syncRoot.DerivationCount);
            Assert.Equal(2, syncRoot.SyncDepth1.DerivationCount);
            Assert.Equal(2, syncRoot.SyncDepth1.SyncDepth2.DerivationCount);
        }
 public BiquarticHermiteSpline(SurfaceDimension uDimension,
     SurfaceDimension vDimension,
     InterpolativeMathFunction interpolativeMathFunction,
     Derivation derivation = Derivation.Zero)
     : this(uDimension, vDimension,
         new DirectKnotsGenerator(interpolativeMathFunction), derivation)
 {
 }
 public BiquarticHermiteSpline(SurfaceDimension uDimension,
     SurfaceDimension vDimension, MathExpression mathExpression,
     Derivation derivation = Derivation.Zero)
     : this(uDimension, vDimension,
         InterpolativeMathFunction.FromExpression(mathExpression),
         derivation)
 {
 }
예제 #8
0
 protected Spline(SurfaceDimension uDimension,
     SurfaceDimension vDimension,
     InterpolativeMathFunction interpolativeMathFunction,
     Derivation derivation = Derivation.Zero)
     : this(uDimension, vDimension,
         new DirectKnotsGenerator(interpolativeMathFunction), derivation)
 {
 }
예제 #9
0
 public static void AppsOnDeriveRevenues(ISession session)
 {
     var derivation = new Derivation(session);
     foreach (CustomerRelationship customerRelationship in session.Extent<CustomerRelationship>())
     {
         customerRelationship.AppsOnDeriveRevenue(derivation);
     }
 }
예제 #10
0
        public ActionResult DeleteConfirmed(int id)
        {
            Derivation derivation = db.Derivation.Find(id);

            db.Derivation.Remove(derivation);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #11
0
        public void AppsShip(SalesOrderShip method)
        {
            var derivation = new Derivation(this.Strategy.Session);

            if (this.CanShip)
            {
                this.AppsShipThis(derivation);
            }
        }
예제 #12
0
 protected Spline(SurfaceDimension uDimension,
     SurfaceDimension vDimension,
     MathExpression mathExpression,
     Derivation derivation = Derivation.Zero)
     : this(uDimension, vDimension,
         InterpolativeMathFunction.FromExpression(mathExpression),
         derivation)
 {
     Name = mathExpression.Expression;
 }
예제 #13
0
        protected void Derive(params IObject[] objects)
        {
            var derivation = new Derivation(this.Session, objects);
            var validation = derivation.Derive();

            if (validation.HasErrors)
            {
                throw new Exception("Derivation Error");
            }
        }
예제 #14
0
        public void AppsInvoice(CustomerShipmentInvoice method)
        {
            var derivation = new Derivation(this.Strategy.Session);

            if (this.CustomerShipmentState.Equals(new CustomerShipmentStates(this.Strategy.Session).Shipped) &&
                Equals(this.Store.BillingProcess, new BillingProcesses(this.strategy.Session).BillingForShipmentItems))
            {
                this.AppsInvoiceThis(derivation);
            }
        }
예제 #15
0
 public MathFunctionSurface(SurfaceDimension uDimension,
     SurfaceDimension vDimension,
     MathExpression mathExpression,
     Derivation derivation = Derivation.Zero)
     : this(
         uDimension, vDimension, mathExpression.Interpret(), derivation
         )
 {
     Name = mathExpression.Expression;
 }
        public static void Derive(this ISession session, bool throwExceptionOnError)
        {
            var derivation = new Derivation(session);
            var validation = derivation.Derive();

            if (throwExceptionOnError && validation.HasErrors)
            {
                throw new DerivationException(validation);
            }
        }
예제 #17
0
 public KeyPathInformation(Derivation derivation, DerivationSchemeTrackedSource derivationStrategy, DerivationFeature feature, KeyPath keyPath, NBXplorerNetwork network)
 {
     ScriptPubKey       = derivation.ScriptPubKey;
     Redeem             = derivation.Redeem;
     TrackedSource      = derivationStrategy;
     DerivationStrategy = derivationStrategy.DerivationStrategy;
     Feature            = feature;
     KeyPath            = keyPath;
     Address            = network.CreateAddress(derivationStrategy.DerivationStrategy, keyPath, ScriptPubKey);
 }
예제 #18
0
        public void AppsInvoice(SalesOrderInvoice method)
        {
            var derivation = new Derivation(this.Strategy.Session);

            this.AppsDeriveCanInvoice(derivation);

            if (this.CanInvoice)
            {
                this.AppsInvoiceThis(derivation);
            }
        }
예제 #19
0
 public override void CleanUpRemovedAttribute(Attribute a)
 {
     // Delete all derivations, which uses this attribute
     for (int i = Derivations.Count - 1; i >= 0; i--)
     {
         Derivation d = Derivations[i];
         if (Regex.IsMatch(d.Expr, $@"\b{a.Name}\b"))
         {
             RemoveDerivation(d);
         }
     }
 }
예제 #20
0
 public override void DeletionAttribute(Graph g, Attribute a, ColumnMetaChange change)
 {
     // Delete all derivations, which uses this attribute
     for (int i = Derivations.Count - 1; i >= 0; i--)
     {
         Derivation d = Derivations[i];
         if (Regex.IsMatch(d.Expr, $@"\b{a.Name}\b"))
         {
             RemoveDerivation(d);
         }
     }
 }
예제 #21
0
 protected Spline(SurfaceDimension uDimension,
     SurfaceDimension vDimension,
     KnotsGenerator knotsGenerator,
     Derivation derivation = Derivation.Zero)
 {
     KnotsGenerator = knotsGenerator;
     UDimension = uDimension;
     VDimension = vDimension;
     Derivation = derivation;
     Segments =
         CreateMesh(knotsGenerator.GenerateKnots(uDimension, vDimension));
 }
예제 #22
0
        static void Main(string[] args)
        {
            #region UserInputs
            try
            {
                #region Leitura do JSON
                DerivationInput input = new DerivationInput();

                using (StreamReader r = new StreamReader("config//userInput.json"))
                {
                    string json = r.ReadToEnd();
                    input = JsonConvert.DeserializeObject <DerivationInput>(json);
                }

                if (input == null)
                {
                    throw new Exception("Erro ao tentar ler arquivo .json");
                }
                #endregion

                #region Validações
                if (!Validator.ValidateUserInput(input.InitialWord, input.Variables.ToArray(), input.rulesBfA, input.rulesAfA, input.Steps.ToArray()))
                {
                    throw new Exception("Não é possível gerar palavras com dados inválidos inseridos pelo usuários.");
                }

                if (!Validator.ValidateGramma(input.rulesBfA, input.rulesAfA, input.InitialWord))
                {
                    throw new Exception("Não é possível gerar palavras com dados inválidos.");
                }
                ;

                #endregion

                Derivation derivation = new Derivation(input.rulesBfA, input.rulesAfA, input.Steps.ToArray(),
                                                       input.Variables.ToArray(), input.InitialWord);

                string derivate = DerivateProcess(derivation);
                Console.WriteLine(string.Format("Derivação: {0}", derivate));

                List <int> steps = GetStepsByWord(derivation, derivate);
                Console.WriteLine(string.Format("Passos para gerar a palavra {0}: {1}", derivate, string.Join(",", steps)));

                derivation.Steps = steps;
                Console.WriteLine(string.Format("Palavra gerada através dos passos gerados acima: {0}", DerivateProcess(derivation)));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            #endregion
        }
예제 #23
0
        public void AppsCreateSalesInvoice(PurchaseInvoiceCreateSalesInvoice method)
        {
            var derivation = new Derivation(this.Strategy.Session);

            var salesInvoice = new SalesInvoiceBuilder(this.Strategy.Session)
                               .WithPurchaseInvoice(this)
                               .WithBilledFrom(this.BilledTo)
                               .WithBilledFromContactPerson(this.BilledToContactPerson)
                               .WithBillToCustomer(this.BillToEndCustomer)
                               .WithBillToContactMechanism(this.BillToEndCustomerContactMechanism)
                               .WithBillToContactPerson(this.BillToEndCustomerContactPerson)
                               .WithShipToCustomer(this.ShipToEndCustomer)
                               .WithShipToAddress(this.ShipToEndCustomerAddress)
                               .WithShipToContactPerson(this.ShipToEndCustomerContactPerson)
                               .WithDescription(this.Description)
                               .WithInvoiceDate(DateTime.UtcNow)
                               .WithSalesInvoiceType(new SalesInvoiceTypes(this.Strategy.Session).SalesInvoice)
                               .WithVatRegime(this.VatRegime)
                               .WithDiscountAdjustment(this.DiscountAdjustment)
                               .WithSurchargeAdjustment(this.SurchargeAdjustment)
                               .WithShippingAndHandlingCharge(this.ShippingAndHandlingCharge)
                               .WithFee(this.Fee)
                               .WithCustomerReference(this.CustomerReference)
                               .WithPaymentMethod(this.BillToCustomerPaymentMethod)
                               .WithComment(this.Comment)
                               .WithInternalComment(this.InternalComment)
                               .Build();

            foreach (PurchaseInvoiceItem purchaseInvoiceItem in this.PurchaseInvoiceItems)
            {
                var invoiceItem = new SalesInvoiceItemBuilder(this.Strategy.Session)
                                  .WithInvoiceItemType(purchaseInvoiceItem.InvoiceItemType)
                                  .WithActualUnitPrice(purchaseInvoiceItem.ActualUnitPrice)
                                  .WithProduct(purchaseInvoiceItem.Product)
                                  .WithQuantity(purchaseInvoiceItem.Quantity)
                                  .WithComment(purchaseInvoiceItem.Comment)
                                  .WithInternalComment(purchaseInvoiceItem.InternalComment)
                                  .Build();

                salesInvoice.AddSalesInvoiceItem(invoiceItem);
            }

            var internalOrganisation = (InternalOrganisation)salesInvoice.BilledFrom;

            if (!internalOrganisation.ActiveCustomers.Contains(salesInvoice.BillToCustomer))
            {
                new CustomerRelationshipBuilder(this.strategy.Session)
                .WithCustomer(salesInvoice.BillToCustomer)
                .WithInternalOrganisation(internalOrganisation)
                .Build();
            }
        }
예제 #24
0
        public void GrammarDerivationTest() //tests derivation computation in combination with parsing (grammar and derivation)
        {
            String             sg = "S->S S S | x | A | ab |   A -> A A | S | a | ";
            ContextFreeGrammar g  = GrammarParser <char> .Parse(f1, sg);

            var der1 = DerivationParser <char> .Parse(f1, "S \n A \n A A \n A \n A A \n A S \n A \n S \n S S S \n S a b S \n x a b S \n x a b S S S \n x a b x S S \n x a b x x S \n x a b x x x");

            Assert.IsTrue(Derivation.comparator.Equals(der1[0], new GrammarSymbol[] { g.StartSymbol })); //check start
            for (int i = 1; i < der1.Count; i++)
            {
                Assert.IsTrue(Derivation.isValidDerivationStep(g.GetProductions(), der1[i - 1], der1[i])); //check step
            }
        }
예제 #25
0
 public ActionResult Edit([Bind(Include = "DerivationID,Description,MotorID,FuelID,Mnemonic_Bodystyle")] Derivation derivation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(derivation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Mnemonic_Bodystyle = new SelectList(db.CarBuild, "Mnemonic_Bodystyle", "Mnemonic_Vehicle", derivation.Mnemonic_Bodystyle);
     ViewBag.FuelID             = new SelectList(db.Fuel, "FuelID", "Name", derivation.FuelID);
     ViewBag.MotorID            = new SelectList(db.Motor, "MotorID", "Name", derivation.MotorID);
     return(View(derivation));
 }
예제 #26
0
        private void MatchingDerivation()
        {
            using (var session = this.database.CreateSession())
            {
                // TODO: Trigger a derivation

                var derivationLog = new DerivationLog();
                var derivation    = new Derivation(session, derivationLog);
                var validation    = derivation.Derive();

                var list = derivationLog.List;
                //derivationLog.List.RemoveAll(v => !v.StartsWith("Dependency"));
            }
        }
예제 #27
0
        // GET: Derivations/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Derivation derivation = db.Derivation.Find(id);

            if (derivation == null)
            {
                return(HttpNotFound());
            }
            return(View(derivation));
        }
예제 #28
0
        public void MarkAsModified()
        {
            var first = new C1Builder(this.Session).Build();

            this.Session.Commit();

            Assert.Equal(0, first.DerivationCount);

            var derivation = new Derivation(this.Session);

            derivation.MarkAsModified(first);
            derivation.Derive();

            Assert.Equal(1, first.DerivationCount);
        }
예제 #29
0
        public MathFunctionSurface(SurfaceDimension uDimension,
            SurfaceDimension vDimension,
            MathFunction function, Derivation derivation = Derivation.Zero)
        {
            Derivation = derivation;
            if (derivation != Derivation.Zero)
            {
                var interpolativeFunction =
                    new InterpolativeMathFunction(function);
                switch (Derivation)
                {
                    case Derivation.X:
                        function = interpolativeFunction.Dx;
                        break;
                    case Derivation.Y:
                        function = interpolativeFunction.Dy;
                        break;
                    case Derivation.XY:
                        function = interpolativeFunction.Dxy;
                        break;
                    case Derivation.SecondXY:

                        function =
                            new InterpolativeMathFunction(
                                interpolativeFunction.Dxy).Dxy;
                        break;
                }
            }

            UDimension = uDimension;
            VDimension = vDimension;
            var uCount_min_1 = uDimension.KnotCount - 1;
                //surface.UKnotsCount-1;
            var vCount_min_1 = vDimension.KnotCount - 1;
                //surface.VKnotsCount-1;

            var segments = new List<ISurface>(uCount_min_1*vCount_min_1);

            for (var i = 0; i < uCount_min_1; i++)
            {
                for (var j = 0; j < vCount_min_1; j++)
                {
                    var segment = CreateSegment(i, j, function);
                    segments.Add(segment);
                }
            }
            Segments = segments;
        }
예제 #30
0
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>
        /// A new object that is a copy of this instance.
        /// </returns>
        public object Clone()
        {
            var p = new Parse(Text, Span, Type, Probability, Head)
            {
                Label = Label
            };

            p.parts.AddRange(parts);

            if (Derivation != null)
            {
                p.Derivation = new StringBuilder(Derivation.ToString());
            }

            return(p);
        }
예제 #31
0
        private void AddEmployee()
        {
            using (var session = this.database.CreateSession())
            {
                var acme = new Organisations(session).FindBy(M.Organisation.Name, "Acme");
                var jude = new People(session).FindBy(M.Person.FirstName, "Jude");

                acme.AddEmployee(jude);

                var derivationLog = new DerivationLog();
                var derivation    = new Derivation(session, derivationLog);
                var validation    = derivation.Derive();

                var list = derivationLog.List;
                //derivationLog.List.RemoveAll(v => !v.StartsWith("Dependency"));
            }
        }
예제 #32
0
        // GET: Derivations/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Derivation derivation = db.Derivation.Find(id);

            if (derivation == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Mnemonic_Bodystyle = new SelectList(db.CarBuild, "Mnemonic_Bodystyle", "Mnemonic_Vehicle", derivation.Mnemonic_Bodystyle);
            ViewBag.FuelID             = new SelectList(db.Fuel, "FuelID", "Name", derivation.FuelID);
            ViewBag.MotorID            = new SelectList(db.Motor, "MotorID", "Name", derivation.MotorID);
            return(View(derivation));
        }
예제 #33
0
        public void Execute()
        {
            this.logger.Info("Update People");
            var objects = new People(this.session).Extent();

            var derivation    = new Derivation(this.session, objects);
            var derivationLog = derivation.Derive();

            if (derivationLog.HasErrors)
            {
                this.session.Rollback();
            }
            else
            {
                this.session.Commit();
            }
        }
예제 #34
0
        public void GrammarDerivationTest1() // basics
        {
            String             sg = "S->aSb|aaSbb|";
            ContextFreeGrammar g1 = GrammarParser <char> .Parse(f1, sg);

            Assert.IsTrue(Derivation.findAllDerivations(g1.GetProductions(), new GrammarSymbol[] { g1.StartSymbol }).Count == 3);

            Assert.IsTrue(Derivation.isValidDerivationStep(g1.GetProductions(),
                                                           new GrammarSymbol[] { g1.StartSymbol },
                                                           new GrammarSymbol[] { new Exprinal <char>('a', "a"), g1.StartSymbol, new Exprinal <char>('b', "b") }));
            Assert.IsTrue(Derivation.isValidDerivationStep(g1.GetProductions(),
                                                           new GrammarSymbol[] { g1.StartSymbol },
                                                           new GrammarSymbol[] { new Exprinal <char>('a', "a"), new Exprinal <char>('a', "a"), g1.StartSymbol, new Exprinal <char>('b', "b"), new Exprinal <char>('b', "b") }));
            Assert.IsTrue(Derivation.isValidDerivationStep(g1.GetProductions(),
                                                           new GrammarSymbol[] { g1.StartSymbol },
                                                           new GrammarSymbol[] {}));

            Assert.IsFalse(Derivation.isValidDerivationStep(g1.GetProductions(),
                                                            new GrammarSymbol[] { g1.StartSymbol },
                                                            new GrammarSymbol[] { g1.StartSymbol }));
        }
        public void Sort()
        {
            var x = new C1Builder(this.Session).Build();
            var y = new C1Builder(this.Session).Build();
            var z = new C1Builder(this.Session).Build();

            x.AddDependency(y);
            y.AddDependency(z);

            var derivation = new Derivation(this.Session);

            var sequence = new List <IObject>();

            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.AreEqual(z, sequence[0]);
            Assert.AreEqual(y, sequence[1]);
            Assert.AreEqual(x, sequence[2]);
        }
예제 #36
0
        /// <summary>
        /// Remove a derivation
        /// </summary>
        /// <param name="d">Derivation</param>
        public void RemoveDerivation(Derivation d)
        {
            Derivations.Remove(d);
            Logger.Warn($"Removed derivation {d.Expr}");

            if (d.OutputRef == null)
            {
                foreach (IDTSInput100 input in ComponentRef.InputCollection)
                {
                    foreach (IDTSInputColumn100 column in input.InputColumnCollection)
                    {
                        if (column.ID == d.OutputColumnRef.ID)
                        {
                            input.InputColumnCollection.RemoveObjectByID(column.ID);
                            return;
                        }
                    }
                }

                return;
            }

            d.OutputRef.OutputColumnCollection.RemoveObjectByID(d.Output.Id);

            List <Edge> outputEdges = OutgoingEdges();

            // If no output edges exist, then nothing more is necessary
            if (outputEdges.Count == 0)
            {
                return;
            }

            // Remove attribute from output edge
            outputEdges[0].Attributes.Remove(d.Output);

            // Can't do this, since derived column requires exactly 2 outputs
            //if(d.OutputRef.OutputColumnCollection.Count == 0)
            //    ComponentRef.OutputCollection.RemoveObjectByID(d.OutputRef.ID);
        }
        public void SortDiamond()
        {
            var a = new C1Builder(this.Session).Build();
            var b = new C1Builder(this.Session).Build();
            var c = new C1Builder(this.Session).Build();
            var d = new C1Builder(this.Session).Build();

            a.AddDependency(b);
            a.AddDependency(c);

            b.AddDependency(d);
            c.AddDependency(d);

            var derivation = new Derivation(this.Session);

            var sequence = new List <IObject>();

            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.AreEqual(d, sequence[0]);
            Assert.AreEqual(a, sequence[3]);
        }
예제 #38
0
        public void Dependency()
        {
            var left   = new LeftBuilder(this.Session).Build();
            var middle = new MiddleBuilder(this.Session).Build();
            var right  = new RightBuilder(this.Session).Build();

            left.Middle  = middle;
            middle.Right = right;

            var derivation = new Derivation(this.Session, new DerivationConfig {
                ThrowExceptionOnCycleDetected = true
            });

            derivation.Derive();
            this.Session.Commit();

            Assert.Equal(1, left.DerivationCount);
            Assert.Equal(1, middle.DerivationCount);
            Assert.Equal(1, right.DerivationCount);

            left.Counter   += 1;
            middle.Counter += 1;
            right.Counter  += 1;

            derivation = new Derivation(this.Session, new DerivationConfig {
                ThrowExceptionOnCycleDetected = true
            });
            derivation.Derive();
            this.Session.Commit();

            Assert.Equal(2, left.DerivationCount);
            Assert.Equal(2, middle.DerivationCount);
            Assert.Equal(2, right.DerivationCount);

            middle.Counter += 1;
            left.Counter   += 1;
            right.Counter  += 1;

            derivation = new Derivation(this.Session, new DerivationConfig {
                ThrowExceptionOnCycleDetected = true
            });
            derivation.Derive();
            this.Session.Commit();

            Assert.Equal(3, left.DerivationCount);
            Assert.Equal(3, middle.DerivationCount);
            Assert.Equal(3, right.DerivationCount);

            right.Counter  += 1;
            middle.Counter += 1;
            left.Counter   += 1;

            derivation = new Derivation(this.Session, new DerivationConfig {
                ThrowExceptionOnCycleDetected = true
            });
            derivation.Derive();
            this.Session.Commit();

            Assert.Equal(4, left.DerivationCount);
            Assert.Equal(4, middle.DerivationCount);
            Assert.Equal(4, right.DerivationCount);

            right.Counter  += 1;
            left.Counter   += 1;
            middle.Counter += 1;

            derivation = new Derivation(this.Session, new DerivationConfig {
                ThrowExceptionOnCycleDetected = true
            });
            derivation.Derive();
            this.Session.Commit();

            Assert.Equal(5, left.DerivationCount);
            Assert.Equal(5, middle.DerivationCount);
            Assert.Equal(5, right.DerivationCount);

            left.Counter   += 1;
            middle.Counter += 1;

            derivation = new Derivation(this.Session, new DerivationConfig {
                ThrowExceptionOnCycleDetected = true
            });
            derivation.Derive();
            this.Session.Commit();

            Assert.Equal(6, left.DerivationCount);
            Assert.Equal(6, middle.DerivationCount);
            Assert.Equal(6, right.DerivationCount);

            middle.Counter += 1;
            left.Counter   += 1;

            derivation = new Derivation(this.Session, new DerivationConfig {
                ThrowExceptionOnCycleDetected = true
            });
            derivation.Derive();
            this.Session.Commit();

            Assert.Equal(7, left.DerivationCount);
            Assert.Equal(7, middle.DerivationCount);
            Assert.Equal(7, right.DerivationCount);

            right.Counter  += 1;
            middle.Counter += 1;

            derivation = new Derivation(this.Session, new DerivationConfig {
                ThrowExceptionOnCycleDetected = true
            });
            derivation.Derive();
            this.Session.Commit();

            Assert.Equal(8, left.DerivationCount);
            Assert.Equal(8, middle.DerivationCount);
            Assert.Equal(8, right.DerivationCount);

            middle.Counter += 1;
            right.Counter  += 1;

            derivation = new Derivation(this.Session, new DerivationConfig {
                ThrowExceptionOnCycleDetected = true
            });
            derivation.Derive();
            this.Session.Commit();

            Assert.Equal(9, left.DerivationCount);
            Assert.Equal(9, middle.DerivationCount);
            Assert.Equal(9, right.DerivationCount);

            middle.Counter += 1;

            derivation = new Derivation(this.Session, new DerivationConfig {
                ThrowExceptionOnCycleDetected = true
            });
            derivation.Derive();
            this.Session.Commit();

            Assert.Equal(10, left.DerivationCount);
            Assert.Equal(10, middle.DerivationCount);
            Assert.Equal(10, right.DerivationCount);
        }
예제 #39
0
파일: Singleton.cs 프로젝트: Allors/apps
        public void AppsOnDeriveRevenues()
        {
            PartyPackageRevenues.AppsOnDeriveRevenues(this.Strategy.Session);
            this.Strategy.Session.Commit();

            PartyProductCategoryRevenues.AppsOnDeriveRevenues(this.Strategy.Session);
            this.Strategy.Session.Commit();

            PartyProductRevenues.AppsOnDeriveRevenues(this.Strategy.Session);
            this.Strategy.Session.Commit();

            PartyRevenues.AppsOnDeriveRevenues(this.Strategy.Session);
            this.Strategy.Session.Commit();

            var derivation = new Derivation(this.Strategy.Session);

            foreach (PartyPackageRevenue revenue in this.Strategy.Session.Extent<PartyPackageRevenue>())
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (PartyProductCategoryRevenue revenue in this.Strategy.Session.Extent<PartyProductCategoryRevenue>())
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (PartyProductRevenue revenue in this.Strategy.Session.Extent<PartyProductRevenue>())
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (PartyRevenue revenue in this.Strategy.Session.Extent<PartyRevenue>())
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            CustomerRelationships.AppsOnDeriveRevenues(this.Strategy.Session);
            this.Strategy.Session.Commit();

            Parties.AppsOnDeriveRevenues(this.Strategy.Session);
            this.Strategy.Session.Commit();

            InternalOrganisationRevenues.AppsOnDeriveRevenues(this.Strategy.Session);
            this.Strategy.Session.Commit();
            PackageRevenues.AppsOnDeriveRevenues(this.Strategy.Session);
            this.Strategy.Session.Commit();
            ProductCategoryRevenues.AppsOnDeriveRevenues(this.Strategy.Session);
            this.Strategy.Session.Commit();
            ProductRevenues.AppsOnDeriveRevenues(this.Strategy.Session);
            this.Strategy.Session.Commit();
            SalesRepPartyProductCategoryRevenues.AppsOnDeriveRevenues(this.Strategy.Session);
            this.Strategy.Session.Commit();
            SalesRepPartyRevenues.AppsOnDeriveRevenues(this.Strategy.Session);
            this.Strategy.Session.Commit();
            SalesRepProductCategoryRevenues.AppsOnDeriveRevenues(this.Strategy.Session);
            this.Strategy.Session.Commit();
            SalesRepRevenues.AppsOnDeriveRevenues(this.Strategy.Session);
            this.Strategy.Session.Commit();
            StoreRevenues.AppsOnDeriveRevenues(this.Strategy.Session);
            this.Strategy.Session.Commit();
            SalesChannelRevenues.AppsOnDeriveRevenues(this.Strategy.Session);
            this.Strategy.Session.Commit();

            foreach (InternalOrganisationRevenue revenue in this.Strategy.Session.Extent<InternalOrganisationRevenue>())
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (PackageRevenue revenue in this.Strategy.Session.Extent<PackageRevenue>())
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (ProductCategoryRevenue revenue in this.Strategy.Session.Extent<ProductCategoryRevenue>())
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (ProductRevenue revenue in this.Strategy.Session.Extent<ProductRevenue>())
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (SalesRepPartyProductCategoryRevenue revenue in this.Strategy.Session.Extent<SalesRepPartyProductCategoryRevenue>())
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (SalesRepPartyRevenue revenue in this.Strategy.Session.Extent<SalesRepPartyRevenue>())
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (SalesRepProductCategoryRevenue revenue in this.Strategy.Session.Extent<SalesRepProductCategoryRevenue>())
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (SalesRepRevenue revenue in this.Strategy.Session.Extent<SalesRepRevenue>())
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (StoreRevenue revenue in this.Strategy.Session.Extent<StoreRevenue>())
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (SalesChannelRevenue revenue in this.Strategy.Session.Extent<SalesChannelRevenue>())
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            SalesRepRelationships.DeriveCommissions(this.Strategy.Session);
            this.Strategy.Session.Commit();
            Persons.AppsOnDeriveCommissions(this.Strategy.Session);
            this.Strategy.Session.Commit();

            this.AppsOnDeriveHistories();
        }
using System;
using System.Collections.Generic;
using HermiteInterpolation.MathFunctions;
using HermiteInterpolation.Numerics;

using HermiteInterpolation.Primitives;
using HermiteInterpolation.SplineKnots;
using MathNet.Numerics.LinearAlgebra;
using Microsoft.Xna.Framework;

namespace HermiteInterpolation.Shapes.SplineInterpolation
{
    public class BicubicHermiteSurface :Spline
    {

        public BicubicHermiteSurface(SurfaceDimension uDimension, SurfaceDimension vDimension, MathExpression mathExpression, Derivation derivation = Derivation.Zero) : base(uDimension, vDimension, mathExpression, derivation)
        {
        }

        public BicubicHermiteSurface(SurfaceDimension uDimension, SurfaceDimension vDimension, InterpolativeMathFunction interpolativeMathFunction, Derivation derivation = Derivation.Zero) : base(uDimension, vDimension, interpolativeMathFunction, derivation)
        {
        }

        public BicubicHermiteSurface(SurfaceDimension uDimension, SurfaceDimension vDimension, KnotsGenerator knotsGenerator, Derivation derivation = Derivation.Zero) : base(uDimension, vDimension, knotsGenerator, derivation)
        {
        }

        protected delegate Vector<double> BasisVector(double t, double t0, double t1);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="uIdx"></param>
        /// <param name="vIdx"></param>
        /// <param name="knots"></param>
        /// <returns></returns>
        protected override ISurface CreateSegment(int uIdx, int vIdx, KnotMatrix knots)
        {
            
            var u0 = knots[uIdx,vIdx].X;
            var u1 = knots[uIdx+1,vIdx].X;
            var v0 = knots[uIdx,vIdx].Y;
            var v1 = knots[uIdx,vIdx+1].Y;
            var meshDensity = Constants.MeshDensity;
            var uKnotsDistance = Math.Abs(u1-u0);           
            var xCount = Math.Ceiling(uKnotsDistance/meshDensity);       
            var yKnotDistance =  Math.Abs(v1 - v0);
            var yCount = Math.Ceiling(yKnotDistance / meshDensity);          
            var verticesCount = (int)((++xCount) * (++yCount));

            var segmentMeshVertices = new VertexPositionNormalColor[verticesCount];
            var basisCalculator = new BicubicBasis(knots,Derivation);//BasisFactory.CreateBasis(Surface.Type);
            
            var phi = basisCalculator.Matrix(uIdx, vIdx);
            var k = 0;
            var x = (float) u0 ;
            for (var i = 0; i < xCount; i++,x += meshDensity)
            {
                x = x < u1 ? x : (float)u1;
                var lambda1 = basisCalculator.Vector(x, u0, u1);
                var basis = phi.LeftMultiply(lambda1);       
                var y = (float) v0;
                for (var j = 0; j < yCount; j++,y += meshDensity)
                {
                    y = y < v1 ? y : (float)v1;
                    var lambda2 = basisCalculator.Vector(y, v0, v1);
                    var zv = basis.PointwiseMultiply(lambda2);
                    var z = (float) zv.Sum();
                    z = MathHelper.Clamp(z, -Constants.MaxSceneZDifference, Constants.MaxSceneZDifference);   
                    segmentMeshVertices[k++] = new VertexPositionNormalColor(new Vector3(x, y, z), DefaultNormal,
                        DefaultColor);
                  
                }
               
            }
           
            return new SimpleSurface(segmentMeshVertices, (int)xCount, (int)yCount);
          
        }
    }
}
예제 #41
0
 public PrecedenceGroup(Derivation derivation, params Production[] productions)
 {
     _productions = productions;
     _derivation = derivation;
 }
예제 #42
0
 private void MexicanHatDemo(Scene scene, Derivation derivation)
 {
     if (scene == null) return;
     var mathExpression = MathExpression.CreateDefault("sin(sqrt(x^2+y^2))", "x", "y");
     //var aproximationFunction = InterpolativeMathFunction.FromExpression("x^4+y^4", "x", "y");
     var shape = new BiquarticHermiteSpline(new SurfaceDimension(-3, 3, 7), new SurfaceDimension(-3, 3, 7),
         //var shape = HermiteSurfaceFactoryHolder.CreateBiquartic(-3, 1, 7, -3, 1, 7,
         mathExpression, derivation);
     shape.ColoredByShades(_colorWheel.Next);
     scene.Add(shape);
 }
using System;
using HermiteInterpolation.MathFunctions;
using HermiteInterpolation.Numerics;

using HermiteInterpolation.SplineKnots;
using HermiteInterpolation.Utils;

namespace HermiteInterpolation.Shapes.SplineInterpolation
{
    public class BiquarticHermiteSurface : BicubicHermiteSurface
    {
        private class BiquarticKnotsGenerator : KnotsGenerator
        {
            private readonly KnotsGenerator _baseGenerator;

            public BiquarticKnotsGenerator(KnotsGenerator baseGenerator)
                : base(baseGenerator.Function)
            {
                _baseGenerator = baseGenerator;
            }

            public override KnotMatrix GenerateKnots(SurfaceDimension uDimension, SurfaceDimension vDimension)
            {
                var afvOld = _baseGenerator.GenerateKnots(uDimension/2, vDimension/2);
                
                var uCountNew = uDimension.KnotCount;
                var vCountNew = vDimension.KnotCount;
                var afvNew = new KnotMatrix(uCountNew, vCountNew);

                FillNewKnots(afvNew, afvOld);

                return afvNew;
            }
      
            private void FillNewKnots(KnotMatrix newKnots,
                KnotMatrix oldKnots)
            {
                // z, dx, dy, dxy initialization
                OriginalKnots(newKnots, oldKnots);
                // z, dx, deltay, deltaxy
                VerticalKnots(newKnots);
                // z, Dx, dy, Dxy
                HorizontalKnots(newKnots);
                // z, Dx, deltay, deltaxy
                InnerKnots(newKnots);
            }

            private void InnerKnots(KnotMatrix newKnots)
            {
                for (int i = 1; i < newKnots.Rows; i += 2)
                {
                    for (int j = 1; j < newKnots.Columns; j += 2)
                    {
                        var u0v0 = newKnots[i - 1,j - 1];
                        var u1v0 = newKnots[i,j - 1];
                        var u2v0 = newKnots[i + 1,j - 1];

                        var u0v1 = newKnots[i - 1,j];
                        var u1v1 = new Knot();
                        var u2v1 = newKnots[i + 1,j];

                        var u0v2 = newKnots[i - 1,j + 1];
                        var u1v2 = newKnots[i,j + 1];
                        var u2v2 = newKnots[i + 1,j + 1];

                        var hx = Math.Abs(u2v0.X - u0v0.X) / 2;
                        var hx4 = hx * 4;
                        var hy = Math.Abs(u0v2.Y - u0v0.Y) / 2;
                        var hy4 = hy * 4;
                        var x = u0v1.X + hx;
                        var y = u1v0.Y + hy;

                        u1v1.X = x;
                        u1v1.Y = y;
                        u1v1.Z = Function.Z(x, y);
                        u1v1.Dx = -(3 * (u0v1.Z - u2v1.Z) + hx * (u0v1.Dx + u2v1.Dx)) /
                                 hx4;
                        u1v1.Dy = -(3 * (u1v0.Z - u1v2.Z) + hx * (u1v0.Dx + u1v2.Dx)) /
                                  hy4;
                        u1v1.Dxy = (u0v0.Dxy + u2v0.Dxy + u0v2.Dxy + u2v2.Dxy +
                                    (3 *
                                     ((u0v0.Dy - u2v0.Dy + u0v2.Dy - u2v2.Dy) / hx +
                                      (u0v0.Dx + u2v0.Dx - u0v2.Dx - u2v2.Dx) / hy +
                                      (3 * (u0v0.Z - u2v0.Z - u0v2.Z + u2v2.Z)) / (hx * hy)))) /
                                   16;
                        newKnots[i,j] = u1v1;
                    }
                }
            }

            private void HorizontalKnots(KnotMatrix newKnots)
            {
                for (int i = 1; i < newKnots.Rows; i += 2)
                {
                    for (int j = 0; j < newKnots.Columns; j += 2)
                    {

                        var u0 = newKnots[i - 1,j];
                        var u1 = new Knot();
                        // finished
                        var u2 = newKnots[i + 1,j];

                        var hx = Math.Abs(u2.X - u0.X) / 2;
                        var hx4 = hx * 4;
                        var x = u0.X + hx;
                        var y = u0.Y;

                        u1.X = x;
                        u1.Y = y;
                        u1.Z = Function.Z(x, y);

                        u1.Dy = Function.Dy(x, y);
                        u1.Dx = -(3 * (u0.Z - u2.Z) + hx * (u0.Dx + u2.Dx)) /
                                hx4;
                        u1.Dxy = -(3 * (u0.Dy - u2.Dy) + hx * (u0.Dxy + u2.Dxy)) /
                                 hx4;
                        // finished
                        newKnots[i,j] = u1;
                    }
                }
            }

            private void VerticalKnots(KnotMatrix newKnots)
            {

                for (int i = 0; i < newKnots.Rows; i += 2)
                {
                    for (int j = 1; j < newKnots.Columns; j += 2)
                    {

                        var v0 = newKnots[i,j - 1];
                        var v1 = new Knot();
                        // finished
                        var v2 = newKnots[i,j + 1];

                        var hy = Math.Abs(v2.Y - v0.Y) / 2;
                        var hy4 = hy * 4;
                        var x = v0.X;
                        var y = v0.Y + hy;

                        v1.X = x;
                        v1.Y = y;
                        v1.Z = Function.Z(x, y);
                        v1.Dx = Function.Dx(x, y);
                        v1.Dy = -(3 * (v0.Z - v2.Z) + hy * (v0.Dy + v2.Dy)) /
                                hy4;
                        v1.Dxy = -(3 * (v0.Dx - v2.Dx) + hy * (v0.Dxy + v2.Dxy)) /
                                 hy4;
                        // finished
                        newKnots[i,j] = v1;
                    }
                }
            }

            private static void OriginalKnots(KnotMatrix newKnots, KnotMatrix oldKnots)
            {
                for (var i = 0; i < oldKnots.Rows; i++)
                {
                    for (var j = 0; j < oldKnots.Columns; j++)
                    {
                        newKnots[2 * i,2 * j] = oldKnots[i,j];
                    }
                }
            }
        }


        public BiquarticHermiteSurface(SurfaceDimension uDimension, SurfaceDimension vDimension, MathExpression mathExpression, Derivation derivation = Derivation.Zero) : this(uDimension, vDimension, InterpolativeMathFunction.FromExpression(mathExpression), derivation)
        {
        }

        public BiquarticHermiteSurface(SurfaceDimension uDimension, SurfaceDimension vDimension, InterpolativeMathFunction interpolativeMathFunction, Derivation derivation = Derivation.Zero) : this(uDimension, vDimension, new  DirectKnotsGenerator(interpolativeMathFunction), derivation)
        {
        }

        public BiquarticHermiteSurface(SurfaceDimension uDimension, SurfaceDimension vDimension, KnotsGenerator knotsGenerator, Derivation derivation = Derivation.Zero) : base(uDimension, vDimension, new BiquarticKnotsGenerator(knotsGenerator), derivation)
        {
        }
    }
}
예제 #44
0
 public BiquarticBasis(KnotMatrix knots, Derivation derivation)
     : base(knots, derivation)
 {
 }
예제 #45
0
        public override string ToString(FormatType format, object supplement = null)
        {
            switch (format)
            {
            case FormatType.Brief:
                return($"{Id}.{Word} [{Abbreviation}]");

            case FormatType.Detail:
                return($"{Id}.{Word} [{Abbreviation}]{Pinyin?.BeIfNotWhiteSpace($"\n拼音:{Pinyin}")}{Explanation?.BeIfNotWhiteSpace($"\n解释:{Explanation}")}{Derivation?.BeIfNotWhiteSpace($"\n来源:{Derivation}")}{Example?.BeIfNotWhiteSpace($"\n例子:{Example}")}");
            }
            return(null);
        }
예제 #46
0
파일: Singleton.cs 프로젝트: Allors/apps
        public void AppsOnDeriveHistories()
        {
            PartyPackageRevenueHistories.AppsOnDeriveHistory(this.Strategy.Session);
            this.Strategy.Session.Commit();

            PartyProductCategoryRevenueHistories.AppsOnDeriveHistory(this.Strategy.Session);
            this.Strategy.Session.Commit();

            PartyProductRevenueHistories.AppsOnDeriveHistory(this.Strategy.Session);
            this.Strategy.Session.Commit();

            PartyRevenueHistories.AppsOnDeriveHistory(this.Strategy.Session);
            this.Strategy.Session.Commit();

            var derivation = new Derivation(this.Strategy.Session);

            var revenues = this.Strategy.Session.Extent<PartyPackageRevenueHistory>();
            foreach (PartyPackageRevenueHistory revenue in revenues)
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (PartyProductCategoryRevenueHistory revenue in this.Strategy.Session.Extent<PartyProductCategoryRevenueHistory>())
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (PartyProductRevenueHistory revenue in this.Strategy.Session.Extent<PartyProductRevenueHistory>())
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (PartyRevenueHistory revenue in this.Strategy.Session.Extent<PartyRevenueHistory>())
            {
                revenue.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            InternalOrganisationRevenueHistories.AppsOnDeriveHistory(this.Strategy.Session);
            this.Strategy.Session.Commit();
            PackageRevenueHistories.AppsOnDeriveHistory(this.Strategy.Session);
            this.Strategy.Session.Commit();
            ProductCategoryRevenueHistories.AppsOnDeriveHistory(this.Strategy.Session);
            this.Strategy.Session.Commit();
            ProductRevenueHistories.AppsOnDeriveHistory(this.Strategy.Session);
            this.Strategy.Session.Commit();
            SalesChannelRevenueHistories.AppsOnDeriveHistory(this.Strategy.Session);
            this.Strategy.Session.Commit();
            SalesRepRevenueHistories.AppsOnDeriveHistory(this.Strategy.Session);
            this.Strategy.Session.Commit();
            StoreRevenueHistories.AppsOnDeriveHistory(this.Strategy.Session);
            this.Strategy.Session.Commit();

            foreach (InternalOrganisationRevenueHistory revenueHistory in this.Strategy.Session.Extent<InternalOrganisationRevenueHistory>())
            {
                revenueHistory.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (PackageRevenueHistory revenueHistory in this.Strategy.Session.Extent<PackageRevenueHistory>())
            {
                revenueHistory.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (ProductCategoryRevenueHistory revenueHistory in this.Strategy.Session.Extent<ProductCategoryRevenueHistory>())
            {
                revenueHistory.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (ProductRevenueHistory revenueHistory in this.Strategy.Session.Extent<ProductRevenueHistory>())
            {
                revenueHistory.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (SalesChannelRevenueHistory revenueHistory in this.Strategy.Session.Extent<SalesChannelRevenueHistory>())
            {
                revenueHistory.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (SalesRepRevenueHistory revenueHistory in this.Strategy.Session.Extent<SalesRepRevenueHistory>())
            {
                revenueHistory.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();

            foreach (StoreRevenueHistory revenueHistory in this.Strategy.Session.Extent<StoreRevenueHistory>())
            {
                revenueHistory.OnDerive(x => x.WithDerivation(derivation));
            }

            this.Strategy.Session.Commit();
        }