Skip to content

Commit b13a38f

Browse files
committed
fix
1 parent 879635a commit b13a38f

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

csharp/ToolGood.Algorithm.Fast/Internals/Functions/FunctionBase.cs

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public override Operand Calculate(AlgorithmEngine work)
241241
} else if (DateTime.TryParse(args1.TextValue, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dt)) {
242242
args1 = Operand.Create(new MyDate(dt));
243243
} else {
244-
return Operand.Error("Two types cannot be divided ");
244+
return Operand.Error("Two types cannot be modulo ");
245245
}
246246
}
247247
if (args2.Type == OperandType.TEXT) {
@@ -254,7 +254,7 @@ public override Operand Calculate(AlgorithmEngine work)
254254
} else if (DateTime.TryParse(args2.TextValue, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dt)) {
255255
args2 = Operand.Create(new MyDate(dt));
256256
} else {
257-
return Operand.Error("Two types cannot be divided");
257+
return Operand.Error("Two types cannot be modulo");
258258
}
259259
}
260260
if (args1.Type != OperandType.NUMBER) { args1 = args1.ToNumber("Function % parameter 1 is error!"); if (args1.IsError) { return args1; } }
@@ -358,7 +358,7 @@ public override Operand Calculate(AlgorithmEngine work)
358358
} else if (DateTime.TryParse(args1.TextValue, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dt)) {
359359
args1 = Operand.Create(new MyDate(dt));
360360
} else {
361-
return Operand.Error("Function '+' is error");
361+
return Operand.Error("Function '-' is error");
362362
}
363363
}
364364
if (args2.Type == OperandType.TEXT) {
@@ -371,7 +371,7 @@ public override Operand Calculate(AlgorithmEngine work)
371371
} else if (DateTime.TryParse(args2.TextValue, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dt)) {
372372
args2 = Operand.Create(new MyDate(dt));
373373
} else {
374-
return Operand.Error("Function '+' is error");
374+
return Operand.Error("Function '-' is error");
375375
}
376376
}
377377
if (args1.Type == OperandType.DATE) {
@@ -461,7 +461,7 @@ public override Operand Calculate(AlgorithmEngine work)
461461
} else if (args1.Type == OperandType.NULL) {
462462
return Operand.True;
463463
} else {
464-
return Operand.Error("Function compare is error.");
464+
return Operand.Error("Function '==' compare is error.");
465465
}
466466
} else if (args2.Type == OperandType.TEXT) {
467467
if (args1.Type == OperandType.BOOLEAN) {
@@ -475,13 +475,13 @@ public override Operand Calculate(AlgorithmEngine work)
475475
args1 = args1.ToText();
476476
return Operand.Create(args1.TextValue == args2.TextValue);
477477
} else {
478-
return Operand.Error("Function compare is error.");
478+
return Operand.Error("Function '==' compare is error.");
479479
}
480480
} else if (args1.Type == OperandType.JSON || args2.Type == OperandType.JSON
481481
|| args1.Type == OperandType.ARRARY || args2.Type == OperandType.ARRARY
482482
|| args1.Type == OperandType.ARRARYJSON || args2.Type == OperandType.ARRARYJSON
483483
) {
484-
return Operand.Error("Function compare is error.");
484+
return Operand.Error("Function '==' compare is error.");
485485
}
486486
if (args1.Type != OperandType.NUMBER) { args1 = args1.ToNumber("Function '==' parameter 1 is error!"); if (args1.IsError) { return args1; } }
487487
if (args2.Type != OperandType.NUMBER) { args2 = args2.ToNumber("Function '==' parameter 2 is error!"); if (args2.IsError) { return args2; } }
@@ -526,7 +526,7 @@ public override Operand Calculate(AlgorithmEngine work)
526526
} else if (args1.Type == OperandType.NULL) {
527527
return Operand.False;
528528
} else {
529-
return Operand.Error("Function compare is error.");
529+
return Operand.Error("Function '!=' compare is error.");
530530
}
531531
} else if (args2.Type == OperandType.TEXT) {
532532
if (args1.Type == OperandType.BOOLEAN) {
@@ -540,13 +540,13 @@ public override Operand Calculate(AlgorithmEngine work)
540540
args1 = args1.ToText();
541541
return Operand.Create(args1.TextValue != args2.TextValue);
542542
} else {
543-
return Operand.Error("Function compare is error.");
543+
return Operand.Error("Function '!=' compare is error.");
544544
}
545545
} else if (args1.Type == OperandType.JSON || args2.Type == OperandType.JSON
546546
|| args1.Type == OperandType.ARRARY || args2.Type == OperandType.ARRARY
547547
|| args1.Type == OperandType.ARRARYJSON || args2.Type == OperandType.ARRARYJSON
548548
) {
549-
return Operand.Error("Function compare is error.");
549+
return Operand.Error("Function '!=' compare is error.");
550550
}
551551
if (args1.Type != OperandType.NUMBER) { args1 = args1.ToNumber("Function '!=' parameter 1 is error!"); if (args1.IsError) { return args1; } }
552552
if (args2.Type != OperandType.NUMBER) { args2 = args2.ToNumber("Function '!=' parameter 2 is error!"); if (args2.IsError) { return args2; } }
@@ -593,7 +593,7 @@ public override Operand Calculate(AlgorithmEngine work)
593593
} else if (args1.Type == OperandType.NULL) {
594594
return Operand.True;
595595
} else {
596-
return Operand.Error("Function compare is error.");
596+
return Operand.Error("Function '>=' compare is error.");
597597
}
598598
} else if (args2.Type == OperandType.TEXT) {
599599
if (args1.Type == OperandType.BOOLEAN) {
@@ -609,16 +609,16 @@ public override Operand Calculate(AlgorithmEngine work)
609609
var r = string.CompareOrdinal(args1.TextValue, args2.TextValue);
610610
return r >= 0 ? Operand.True : Operand.False;
611611
} else {
612-
return Operand.Error("Function compare is error.");
612+
return Operand.Error("Function '>=' compare is error.");
613613
}
614614
} else if (args1.Type == OperandType.JSON || args2.Type == OperandType.JSON
615615
|| args1.Type == OperandType.ARRARY || args2.Type == OperandType.ARRARY
616616
|| args1.Type == OperandType.ARRARYJSON || args2.Type == OperandType.ARRARYJSON
617617
) {
618-
return Operand.Error("Function compare is error.");
618+
return Operand.Error("Function '>=' compare is error.");
619619
}
620-
if (args1.Type != OperandType.NUMBER) { args1 = args1.ToNumber("Function '!=' parameter 1 is error!"); if (args1.IsError) { return args1; } }
621-
if (args2.Type != OperandType.NUMBER) { args2 = args2.ToNumber("Function '!=' parameter 2 is error!"); if (args2.IsError) { return args2; } }
620+
if (args1.Type != OperandType.NUMBER) { args1 = args1.ToNumber("Function '>=' parameter 1 is error!"); if (args1.IsError) { return args1; } }
621+
if (args2.Type != OperandType.NUMBER) { args2 = args2.ToNumber("Function '>=' parameter 2 is error!"); if (args2.IsError) { return args2; } }
622622

623623
return Operand.Create(args1.NumberValue >= args2.NumberValue);
624624
}
@@ -661,7 +661,7 @@ public override Operand Calculate(AlgorithmEngine work)
661661
} else if (args1.Type == OperandType.NULL) {
662662
return Operand.True;
663663
} else {
664-
return Operand.Error("Function compare is error.");
664+
return Operand.Error("Function '<=' compare is error.");
665665
}
666666
} else if (args2.Type == OperandType.TEXT) {
667667
if (args1.Type == OperandType.BOOLEAN) {
@@ -677,16 +677,16 @@ public override Operand Calculate(AlgorithmEngine work)
677677
var r = string.CompareOrdinal(args1.TextValue, args2.TextValue);
678678
return r <= 0 ? Operand.True : Operand.False;
679679
} else {
680-
return Operand.Error("Function compare is error.");
680+
return Operand.Error("Function '<=' compare is error.");
681681
}
682682
} else if (args1.Type == OperandType.JSON || args2.Type == OperandType.JSON
683683
|| args1.Type == OperandType.ARRARY || args2.Type == OperandType.ARRARY
684684
|| args1.Type == OperandType.ARRARYJSON || args2.Type == OperandType.ARRARYJSON
685685
) {
686-
return Operand.Error("Function compare is error.");
686+
return Operand.Error("Function '<=' compare is error.");
687687
}
688-
if (args1.Type != OperandType.NUMBER) { args1 = args1.ToNumber("Function '!=' parameter 1 is error!"); if (args1.IsError) { return args1; } }
689-
if (args2.Type != OperandType.NUMBER) { args2 = args2.ToNumber("Function '!=' parameter 2 is error!"); if (args2.IsError) { return args2; } }
688+
if (args1.Type != OperandType.NUMBER) { args1 = args1.ToNumber("Function '<=' parameter 1 is error!"); if (args1.IsError) { return args1; } }
689+
if (args2.Type != OperandType.NUMBER) { args2 = args2.ToNumber("Function '<=' parameter 2 is error!"); if (args2.IsError) { return args2; } }
690690

691691
return Operand.Create(args1.NumberValue <= args2.NumberValue);
692692
}
@@ -730,7 +730,7 @@ public override Operand Calculate(AlgorithmEngine work)
730730
} else if (args1.Type == OperandType.NULL) {
731731
return Operand.True;
732732
} else {
733-
return Operand.Error("Function compare is error.");
733+
return Operand.Error("Function '>' compare is error.");
734734
}
735735
} else if (args2.Type == OperandType.TEXT) {
736736
if (args1.Type == OperandType.BOOLEAN) {
@@ -746,16 +746,16 @@ public override Operand Calculate(AlgorithmEngine work)
746746
var r = string.CompareOrdinal(args1.TextValue, args2.TextValue);
747747
return r > 0 ? Operand.True : Operand.False;
748748
} else {
749-
return Operand.Error("Function compare is error.");
749+
return Operand.Error("Function '>' compare is error.");
750750
}
751751
} else if (args1.Type == OperandType.JSON || args2.Type == OperandType.JSON
752752
|| args1.Type == OperandType.ARRARY || args2.Type == OperandType.ARRARY
753753
|| args1.Type == OperandType.ARRARYJSON || args2.Type == OperandType.ARRARYJSON
754754
) {
755-
return Operand.Error("Function compare is error.");
755+
return Operand.Error("Function '>' compare is error.");
756756
}
757-
if (args1.Type != OperandType.NUMBER) { args1 = args1.ToNumber("Function '!=' parameter 1 is error!"); if (args1.IsError) { return args1; } }
758-
if (args2.Type != OperandType.NUMBER) { args2 = args2.ToNumber("Function '!=' parameter 2 is error!"); if (args2.IsError) { return args2; } }
757+
if (args1.Type != OperandType.NUMBER) { args1 = args1.ToNumber("Function '>' parameter 1 is error!"); if (args1.IsError) { return args1; } }
758+
if (args2.Type != OperandType.NUMBER) { args2 = args2.ToNumber("Function '>' parameter 2 is error!"); if (args2.IsError) { return args2; } }
759759

760760
return Operand.Create(args1.NumberValue > args2.NumberValue);
761761
}
@@ -798,7 +798,7 @@ public override Operand Calculate(AlgorithmEngine work)
798798
} else if (args1.Type == OperandType.NULL) {
799799
return Operand.True;
800800
} else {
801-
return Operand.Error("Function compare is error.");
801+
return Operand.Error("Function '<' compare is error.");
802802
}
803803
} else if (args2.Type == OperandType.TEXT) {
804804
if (args1.Type == OperandType.BOOLEAN) {
@@ -814,16 +814,16 @@ public override Operand Calculate(AlgorithmEngine work)
814814
var r = string.CompareOrdinal(args1.TextValue, args2.TextValue);
815815
return r < 0 ? Operand.True : Operand.False;
816816
} else {
817-
return Operand.Error("Function compare is error.");
817+
return Operand.Error("Function '<' compare is error.");
818818
}
819819
} else if (args1.Type == OperandType.JSON || args2.Type == OperandType.JSON
820820
|| args1.Type == OperandType.ARRARY || args2.Type == OperandType.ARRARY
821821
|| args1.Type == OperandType.ARRARYJSON || args2.Type == OperandType.ARRARYJSON
822822
) {
823-
return Operand.Error("Function compare is error.");
823+
return Operand.Error("Function '<' compare is error.");
824824
}
825-
if (args1.Type != OperandType.NUMBER) { args1 = args1.ToNumber("Function '!=' parameter 1 is error!"); if (args1.IsError) { return args1; } }
826-
if (args2.Type != OperandType.NUMBER) { args2 = args2.ToNumber("Function '!=' parameter 2 is error!"); if (args2.IsError) { return args2; } }
825+
if (args1.Type != OperandType.NUMBER) { args1 = args1.ToNumber("Function '<' parameter 1 is error!"); if (args1.IsError) { return args1; } }
826+
if (args2.Type != OperandType.NUMBER) { args2 = args2.ToNumber("Function '<' parameter 2 is error!"); if (args2.IsError) { return args2; } }
827827

828828
return Operand.Create(args1.NumberValue < args2.NumberValue);
829829
}
@@ -937,7 +937,7 @@ public override Operand Calculate(AlgorithmEngine work)
937937
var index = 1;
938938
bool b = false;
939939
foreach (var item in funcs) {
940-
var a = item.Calculate(work).ToBoolean($"Function AND parameter {index++} is error!");
940+
var a = item.Calculate(work).ToBoolean($"Function OR parameter {index++} is error!");
941941
if (a.IsError) { return a; }
942942
if (a.BooleanValue) b = true;
943943
}

0 commit comments

Comments
 (0)