Free cookie consent management tool by TermsFeed Policy Generator

source: branches/RemoveBackwardsCompatibility/HeuristicLab.ExtLibs/HeuristicLab.AutoDiff/1.0/AutoDiff-1.0/ConstPower.cs @ 18242

Last change on this file since 18242 was 8703, checked in by gkronber, 12 years ago

#1960 added HL wrapper plugin for AutoDiff

File size: 1.8 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5
6namespace AutoDiff
7{
8    /// <summary>
9    /// Represents a constant-power function x^n, where n is constant.
10    /// </summary>
11    [Serializable]
12    public class ConstPower : Term
13    {
14        /// <summary>
15        /// Constructs a new instance of the <see cref="ConstPower"/> class.
16        /// </summary>
17        /// <param name="baseTerm">The base of the power function</param>
18        /// <param name="exponent">The exponent of the power function</param>
19        public ConstPower(Term baseTerm, double exponent)
20        {
21            Base = baseTerm;
22            Exponent = exponent;
23        }
24
25        /// <summary>
26        /// Gets the base term of the power function
27        /// </summary>
28        public Term Base { get; private set; }
29
30        /// <summary>
31        /// Gets the exponent term of the power function.
32        /// </summary>
33        public double Exponent { get; private set; }
34
35        /// <summary>
36        /// Accepts a term visitor.
37        /// </summary>
38        /// <param name="visitor">The term visitor to accept.</param>
39        public override void Accept(ITermVisitor visitor)
40        {
41            visitor.Visit(this);
42        }
43
44        /// <summary>
45        /// Accepts a term visitor with a generic result
46        /// </summary>
47        /// <typeparam name="TResult">The type of the result from the visitor's function</typeparam>
48        /// <param name="visitor">The visitor to accept</param>
49        /// <returns>
50        /// The result from the visitor's visit function.
51        /// </returns>
52        public override TResult Accept<TResult>(ITermVisitor<TResult> visitor)
53        {
54            return visitor.Visit(this);
55        }
56    }
57}
Note: See TracBrowser for help on using the repository browser.