@@ -261,20 +261,20 @@ public override void ToString(StringBuilder stringBuilder, bool addBrackets)
261261
262262 }
263263
264- internal class Function_TIME : Function_N
264+ internal class Function_TIME : Function_3
265265 {
266- public Function_TIME ( FunctionBase [ ] funcs ) : base ( funcs )
266+ public Function_TIME ( FunctionBase func1 , FunctionBase func2 , FunctionBase func3 ) : base ( func1 , func2 , func3 )
267267 {
268268 }
269269
270270 public override Operand Calculate ( AlgorithmEngine work )
271271 {
272- var args1 = funcs [ 0 ] . Calculate ( work ) ; if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '{0}' parameter {1} is error!" , "Time" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
273- var args2 = funcs [ 1 ] . Calculate ( work ) ; if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '{0}' parameter {1} is error!" , "Time" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
272+ var args1 = func1 . Calculate ( work ) ; if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '{0}' parameter {1} is error!" , "Time" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
273+ var args2 = func2 . Calculate ( work ) ; if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '{0}' parameter {1} is error!" , "Time" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
274274
275275 MyDate d ;
276- if ( funcs . Length == 3 ) {
277- var args3 = funcs [ 2 ] . Calculate ( work ) ; if ( args3 . Type != OperandType . NUMBER ) { args3 = args3 . ToNumber ( "Function '{0}' parameter {1} is error!" , "Time" , 3 ) ; if ( args3 . IsError ) { return args3 ; } }
276+ if ( func3 != null ) {
277+ var args3 = func3 . Calculate ( work ) ; if ( args3 . Type != OperandType . NUMBER ) { args3 = args3 . ToNumber ( "Function '{0}' parameter {1} is error!" , "Time" , 3 ) ; if ( args3 . IsError ) { return args3 ; } }
278278 d = new MyDate ( 0 , 0 , 0 , args1 . IntValue , args2 . IntValue , args3 . IntValue ) ;
279279 } else {
280280 d = new MyDate ( 0 , 0 , 0 , args1 . IntValue , args2 . IntValue , 0 ) ;
@@ -438,20 +438,19 @@ public override void ToString(StringBuilder stringBuilder, bool addBrackets)
438438 }
439439 }
440440
441- internal class Function_WEEKDAY : Function_N
441+ internal class Function_WEEKDAY : Function_2
442442 {
443- public Function_WEEKDAY ( FunctionBase [ ] funcs ) : base ( funcs )
443+ public Function_WEEKDAY ( FunctionBase func1 , FunctionBase func2 ) : base ( func1 , func2 )
444444 {
445445 }
446446
447447 public override Operand Calculate ( AlgorithmEngine work )
448448 {
449- var exprs = funcs ;
450- var args1 = exprs [ 0 ] . Calculate ( work ) ; if ( args1 . Type != OperandType . DATE ) { args1 = args1 . ToMyDate ( "Function '{0}' parameter {1} is error!" , "WeekDay" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
449+ var args1 = func1 . Calculate ( work ) ; if ( args1 . Type != OperandType . DATE ) { args1 = args1 . ToMyDate ( "Function '{0}' parameter {1} is error!" , "WeekDay" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
451450
452451 var type = 1 ;
453- if ( exprs . Length == 2 ) {
454- var args2 = exprs [ 1 ] . Calculate ( work ) ; if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '{0}' parameter {1} is error!" , "WeekDay" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
452+ if ( func2 != null ) {
453+ var args2 = func2 . Calculate ( work ) ; if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '{0}' parameter {1} is error!" , "WeekDay" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
455454 type = args2 . IntValue ;
456455 }
457456
0 commit comments