Skip to content

Commit 8aca013

Browse files
committed
修改部分代码
1 parent c27853c commit 8aca013

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

csharp/ToolGood.Algorithm2/Internals/CharUtil.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static char StandardChar(char c)
3232
return char.ToUpperInvariant(o);
3333
}
3434

35-
public static bool EqualsOnce(string left, string right)
35+
private static bool EqualsOnce(string left, string right)
3636
{
3737
if (left.Length != right.Length) return false;
3838
for (int i = 0; i < left.Length; i++) {

csharp/ToolGood.Algorithm2/Internals/MathVisitor.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,7 +1898,7 @@ public Operand VisitDATEDIF_fun(mathParser.DATEDIF_funContext context)
18981898
var endMyDate = (DateTime)secondValue.DateValue;
18991899
var t = thirdValue.TextValue.ToLower();
19001900

1901-
if (t == "y") {
1901+
if (CharUtil.Equals(t, "y")) {
19021902
#region y
19031903
bool b = false;
19041904
if (startMyDate.Month < endMyDate.Month) {
@@ -1912,7 +1912,7 @@ public Operand VisitDATEDIF_fun(mathParser.DATEDIF_funContext context)
19121912
return Operand.Create((endMyDate.Year - startMyDate.Year - 1));
19131913
}
19141914
#endregion
1915-
} else if (t == "m") {
1915+
} else if (CharUtil.Equals(t, "m")) {
19161916
#region m
19171917
bool b = false;
19181918
if (startMyDate.Day <= endMyDate.Day) b = true;
@@ -1922,9 +1922,9 @@ public Operand VisitDATEDIF_fun(mathParser.DATEDIF_funContext context)
19221922
return Operand.Create((endMyDate.Year * 12 + endMyDate.Month - startMyDate.Year * 12 - startMyDate.Month - 1));
19231923
}
19241924
#endregion
1925-
} else if (t == "d") {
1925+
} else if (CharUtil.Equals(t, "d")) {
19261926
return Operand.Create((endMyDate - startMyDate).Days);
1927-
} else if (t == "yd") {
1927+
} else if (CharUtil.Equals(t, "yd")) {
19281928
#region yd
19291929
var day = endMyDate.DayOfYear - startMyDate.DayOfYear;
19301930
if (endMyDate.Year > startMyDate.Year && day < 0) {
@@ -1933,7 +1933,7 @@ public Operand VisitDATEDIF_fun(mathParser.DATEDIF_funContext context)
19331933
}
19341934
return Operand.Create((day));
19351935
#endregion
1936-
} else if (t == "md") {
1936+
} else if (CharUtil.Equals(t, "md") ) {
19371937
#region md
19381938
var mo = endMyDate.Day - startMyDate.Day;
19391939
if (mo < 0) {
@@ -1948,7 +1948,7 @@ public Operand VisitDATEDIF_fun(mathParser.DATEDIF_funContext context)
19481948
}
19491949
return Operand.Create((mo));
19501950
#endregion
1951-
} else if (t == "ym") {
1951+
} else if (CharUtil.Equals(t, "ym")) {
19521952
#region ym
19531953
var mo = endMyDate.Month - startMyDate.Month;
19541954
if (endMyDate.Day < startMyDate.Day) mo = mo - 1;
@@ -3713,7 +3713,7 @@ public Operand VisitLOOKUP_fun(mathParser.LOOKUP_funContext context)
37133713
return Operand.Error("Function LOOKUP parameter 2 is null!");
37143714
}
37153715

3716-
var engine = new LookupAlgorithmEngine();
3716+
var engine = new AntlrLookupEngine();
37173717
if (engine.Parse(secondValue.TextValue) == false) {
37183718
return Operand.Error("Function LOOKUP parameter 2 Parse is error!");
37193719
}

csharp/ToolGood.Algorithm2/OperandType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// <summary>
44
/// 操作数类型
55
/// </summary>
6-
public enum OperandType
6+
public enum OperandType : byte
77
{
88
/// <summary>
99
/// NULL

0 commit comments

Comments
 (0)