Skip to content

Commit 11b9649

Browse files
author
linzhijun
committed
fix
1 parent 94a5365 commit 11b9649

File tree

3 files changed

+10
-22
lines changed

3 files changed

+10
-22
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,10 @@ public override Operand Calculate(AlgorithmEngine work)
487487
var args1 = func1.Calculate(work); if (args1.IsError) { return args1; }
488488
var args2 = func2.Calculate(work); if (args2.IsError) { return args2; }
489489

490-
if (args1.IsNull) {
491-
if (args2.IsNull) return args1;
490+
if (args1.Type == OperandType.NULL) {
491+
if (args2.Type == OperandType.NULL) return args1;
492492
return args2.ToText("Function '{0}' parameter {1} is error!", "&", 2);
493-
} else if (args2.IsNull) {
493+
} else if (args2.Type == OperandType.NULL) {
494494
return args1.ToText("Function '{0}' parameter {1} is error!", "&", 1);
495495
}
496496
if (args1.Type != OperandType.TEXT) { args1 = args1.ToText("Function '{0}' parameter {1} is error!", "&", 1); if (args1.IsError) { return args1; } }

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ public override Operand Calculate(AlgorithmEngine work)
110110
{
111111
var args1 = func1.Calculate(work);
112112
if (func2 != null) {
113-
if (args1.IsNull) { return func2.Calculate(work); }
113+
if (args1.Type == OperandType.NULL) { return func2.Calculate(work); }
114114
if (args1.Type == OperandType.TEXT && args1.TextValue == null) { return func2.Calculate(work); }
115115
return args1;
116116
}
117-
if (args1.IsNull) { return Operand.True; }
117+
if (args1.Type == OperandType.NULL) { return Operand.True; }
118118
if (args1.Type == OperandType.TEXT && args1.TextValue == null) { return Operand.True; }
119119
return Operand.False;
120120
}
@@ -134,11 +134,11 @@ public override Operand Calculate(AlgorithmEngine work)
134134
{
135135
var args1 = func1.Calculate(work);
136136
if (func2 != null) {
137-
if (args1.IsNull || args1.IsError) { return func2.Calculate(work); }
137+
if (args1.Type == OperandType.NULL || args1.IsError) { return func2.Calculate(work); }
138138
if (args1.Type == OperandType.TEXT && args1.TextValue == null) { return func2.Calculate(work); }
139139
return args1;
140140
}
141-
if (args1.IsNull || args1.IsError) { return Operand.True; }
141+
if (args1.Type == OperandType.NULL || args1.IsError) { return Operand.True; }
142142
if (args1.Type == OperandType.TEXT && args1.TextValue == null) { return Operand.True; }
143143
return Operand.False;
144144
}
@@ -252,7 +252,7 @@ public Function_ISNULLOREMPTY(FunctionBase func1) : base(func1)
252252
public override Operand Calculate(AlgorithmEngine work)
253253
{
254254
var args1 = func1.Calculate(work);
255-
if (args1.IsNull) { return Operand.True; }
255+
if (args1.Type == OperandType.NULL) { return Operand.True; }
256256
if (args1.Type != OperandType.TEXT) { args1 = args1.ToText("Function '{0}' parameter {1} is error!", "IsNullOrEmpty", 1); if (args1.IsError) { return args1; } }
257257
return Operand.Create(string.IsNullOrEmpty(args1.TextValue));
258258
}
@@ -271,7 +271,7 @@ public Function_ISNULLORWHITESPACE(FunctionBase func1) : base(func1)
271271
public override Operand Calculate(AlgorithmEngine work)
272272
{
273273
var args1 = func1.Calculate(work);
274-
if (args1.IsNull) { return Operand.True; }
274+
if (args1.Type == OperandType.NULL) { return Operand.True; }
275275
if (args1.Type != OperandType.TEXT) { args1 = args1.ToText("Function '{0}' parameter {1} is error!", "IsNullOrWhiteSpace", 1); if (args1.IsError) { return args1; } }
276276
return Operand.Create(string.IsNullOrWhiteSpace(args1.TextValue));
277277
}

csharp/ToolGood.Algorithm/Operand.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ public abstract class Operand
4545
/// </summary>
4646
public static readonly Operand Zero = Operand.Create(0);
4747

48-
/// <summary>
49-
/// 是否为空
50-
/// </summary>
51-
public virtual bool IsNull => false;
52-
5348
/// <summary>
5449
/// 是否出错
5550
/// </summary>
@@ -65,11 +60,6 @@ public abstract class Operand
6560
/// </summary>
6661
public abstract OperandType Type { get; }
6762

68-
/// <summary>
69-
/// 值
70-
/// </summary>
71-
public virtual object Value => throw new NotImplementedException();
72-
7363
/// <summary>
7464
/// 数字值
7565
/// </summary>
@@ -619,8 +609,6 @@ internal abstract class Operand<T> : Operand
619609
{
620610
protected T _value { get; private set; }
621611

622-
public override object Value => _value;
623-
624612
public Operand(T obj)
625613
{
626614
_value = obj;
@@ -879,7 +867,6 @@ public OperandError(string msg)
879867
internal sealed class OperandNull : Operand
880868
{
881869
public override OperandType Type => OperandType.NULL;
882-
public override bool IsNull => true;
883870
public override string ToString() { return "null"; }
884871
}
885872

@@ -974,5 +961,6 @@ public OperandKeyValue(KeyValue obj) : base(obj)
974961
}
975962

976963
public override OperandType Type => OperandType.ARRARYJSON;
964+
public KeyValue Value => _value;
977965
}
978966
}

0 commit comments

Comments
 (0)