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