Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 |
|
---|
6 | namespace AutoDiff
|
---|
7 | {
|
---|
8 | public class TermPower : Term
|
---|
9 | {
|
---|
10 | public TermPower(Term baseTerm, Term exponent)
|
---|
11 | {
|
---|
12 | Base = baseTerm;
|
---|
13 | Exponent = exponent;
|
---|
14 | }
|
---|
15 |
|
---|
16 | /// <summary>
|
---|
17 | /// Gets the base term of the power function
|
---|
18 | /// </summary>
|
---|
19 | public Term Base { get; private set; }
|
---|
20 |
|
---|
21 | /// <summary>
|
---|
22 | /// Gets the exponent term of the power function.
|
---|
23 | /// </summary>
|
---|
24 | public Term Exponent { get; private set; }
|
---|
25 |
|
---|
26 | /// <summary>
|
---|
27 | /// Accepts a term visitor.
|
---|
28 | /// </summary>
|
---|
29 | /// <param name="visitor">The term visitor to accept.</param>
|
---|
30 | public override void Accept(ITermVisitor visitor)
|
---|
31 | {
|
---|
32 | visitor.Visit(this);
|
---|
33 | }
|
---|
34 |
|
---|
35 | /// <summary>
|
---|
36 | /// Accepts a term visitor with a generic result
|
---|
37 | /// </summary>
|
---|
38 | /// <typeparam name="TResult">The type of the result from the visitor's function</typeparam>
|
---|
39 | /// <param name="visitor">The visitor to accept</param>
|
---|
40 | /// <returns>
|
---|
41 | /// The result from the visitor's visit function.
|
---|
42 | /// </returns>
|
---|
43 | public override TResult Accept<TResult>(ITermVisitor<TResult> visitor)
|
---|
44 | {
|
---|
45 | return visitor.Visit(this);
|
---|
46 | }
|
---|
47 | }
|
---|
48 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.