File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
ToolGood.Algorithm.Test/AlgorithmEngine Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Text ;
5+
6+ namespace ToolGood . Algorithm . Test
7+ {
8+ //定义圆柱信息
9+ public class Cylinder : AlgorithmEngine
10+ {
11+ private int _radius ;
12+ private int _height ;
13+ public Cylinder ( int radius , int height )
14+ {
15+ _radius = radius ;
16+ _height = height ;
17+ }
18+
19+ protected override Operand GetParameter ( Operand curOpd )
20+ {
21+ if ( curOpd . Parameter == "[半径]" ) {
22+ return new Operand ( OperandType . NUMBER , _radius ) ;
23+ }
24+ if ( curOpd . Parameter == "[直径]" ) {
25+ return new Operand ( OperandType . NUMBER , _radius * 2 ) ;
26+ }
27+ if ( curOpd . Parameter == "[高]" ) {
28+ return new Operand ( OperandType . NUMBER , _height ) ;
29+ }
30+ return base . GetParameter ( curOpd ) ;
31+ }
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments