using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AutoDiff { /// /// Represents a constant-power function x^n, where n is constant. /// [Serializable] public class ConstPower : Term { /// /// Constructs a new instance of the class. /// /// The base of the power function /// The exponent of the power function public ConstPower(Term baseTerm, double exponent) { Base = baseTerm; Exponent = exponent; } /// /// Gets the base term of the power function /// public Term Base { get; private set; } /// /// Gets the exponent term of the power function. /// public double Exponent { get; private set; } /// /// Accepts a term visitor. /// /// The term visitor to accept. public override void Accept(ITermVisitor visitor) { visitor.Visit(this); } /// /// Accepts a term visitor with a generic result /// /// The type of the result from the visitor's function /// The visitor to accept /// /// The result from the visitor's visit function. /// public override TResult Accept(ITermVisitor visitor) { return visitor.Visit(this); } } }