Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2915-AbsoluteSymbol/HeuristicLab.ExtLibs/HeuristicLab.AutoDiff/1.0/AutoDiff-1.0/Constant.cs @ 16446

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

#1960 added HL wrapper plugin for AutoDiff

File size: 1.5 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Diagnostics;
6
7namespace 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.