Skip to content

Commit 66081d7

Browse files
committed
rename parameters
1 parent 6a2416a commit 66081d7

File tree

4 files changed

+48
-30
lines changed

4 files changed

+48
-30
lines changed

src/SimpleStateMachine.StructuralSearch/Operator/Logical/BinaryOperation.cs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,29 @@ internal class BinaryOperation(ILogicalOperation left, LogicalBinaryOperator typ
88
: ILogicalOperation
99
{
1010
public bool IsApplicableForPlaceholder(string placeholderName)
11-
=> left.IsApplicableForPlaceholder(placeholderName) || right.IsApplicableForPlaceholder(placeholderName);
11+
{
12+
return left.IsApplicableForPlaceholder(placeholderName) || right.IsApplicableForPlaceholder(placeholderName);
13+
}
1214

1315
public bool Execute(ref IParsingContext context)
1416
{
15-
var left1 = left.Execute(ref context);
16-
var right1 = right.Execute(ref context);
17+
var leftResult = left.Execute(ref context);
18+
var rightResult = right.Execute(ref context);
1719

1820
return type switch
1921
{
20-
LogicalBinaryOperator.And => left1 && right1,
21-
LogicalBinaryOperator.Or => left1 || right1,
22-
LogicalBinaryOperator.NAND => !(left1 && right1),
23-
LogicalBinaryOperator.NOR => !(left1 || right1),
24-
LogicalBinaryOperator.XOR => left1 ^ right1,
25-
LogicalBinaryOperator.XNOR => left1 == right1,
22+
LogicalBinaryOperator.And => leftResult && rightResult,
23+
LogicalBinaryOperator.Or => leftResult || rightResult,
24+
LogicalBinaryOperator.NAND => !(leftResult && rightResult),
25+
LogicalBinaryOperator.NOR => !(leftResult || rightResult),
26+
LogicalBinaryOperator.XOR => leftResult ^ rightResult,
27+
LogicalBinaryOperator.XNOR => leftResult == rightResult,
2628
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
2729
};
2830
}
2931

3032
public override string ToString()
31-
=> $"{left}{Constant.Space}{type}{Constant.Space}{right}";
33+
{
34+
return $"{left}{Constant.Space}{type}{Constant.Space}{right}";
35+
}
3236
}

src/SimpleStateMachine.StructuralSearch/Operator/Logical/InOperation.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,28 @@ namespace SimpleStateMachine.StructuralSearch.Operator.Logical;
88
internal class InOperation(IParameter parameter, List<IParameter> arguments) : ILogicalOperation
99
{
1010
public bool IsApplicableForPlaceholder(string placeholderName)
11-
=> parameter.IsApplicableForPlaceholder(placeholderName) || arguments.Any(a => a.IsApplicableForPlaceholder(placeholderName));
11+
{
12+
return parameter.IsApplicableForPlaceholder(placeholderName) ||
13+
arguments.Any(a => a.IsApplicableForPlaceholder(placeholderName));
14+
}
1215

1316
public bool Execute(ref IParsingContext context)
1417
{
15-
var parameter1 = parameter.GetValue(ref context);
18+
var parameterValue = parameter.GetValue(ref context);
1619

1720
foreach (var argument in arguments)
1821
{
1922
var value = argument.GetValue(ref context);
2023

21-
if (Equals(parameter1, value))
24+
if (Equals(parameterValue, value))
2225
return true;
2326
}
2427

2528
return false;
2629
}
2730

2831
public override string ToString()
29-
=> $"{parameter}{Constant.Space}{Constant.In}{Constant.Space}{string.Join(Constant.Comma, arguments)}";
32+
{
33+
return $"{parameter}{Constant.Space}{Constant.In}{Constant.Space}{string.Join(Constant.Comma, arguments)}";
34+
}
3035
}

src/SimpleStateMachine.StructuralSearch/Operator/Logical/StringCompareOperation.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,27 @@ internal class StringCompareOperation(IParameter left, StringCompareOperator @op
1010
: ILogicalOperation
1111
{
1212
public bool IsApplicableForPlaceholder(string placeholderName)
13-
=> left.IsApplicableForPlaceholder(placeholderName) || right.IsApplicableForPlaceholder(placeholderName);
13+
{
14+
return left.IsApplicableForPlaceholder(placeholderName) || right.IsApplicableForPlaceholder(placeholderName);
15+
}
1416

1517
public bool Execute(ref IParsingContext context)
1618
{
17-
var left1 = left.GetValue(ref context);
18-
var right1 = right.GetValue(ref context);
19+
var leftResult = left.GetValue(ref context);
20+
var rightResult = right.GetValue(ref context);
1921

2022
return @operator switch
2123
{
22-
StringCompareOperator.Equals => left1.Equals(right1),
23-
StringCompareOperator.Contains => left1.Contains(right1),
24-
StringCompareOperator.StartsWith => left1.StartsWith(right1),
25-
StringCompareOperator.EndsWith => left1.EndsWith(right1),
24+
StringCompareOperator.Equals => leftResult.Equals(rightResult),
25+
StringCompareOperator.Contains => leftResult.Contains(rightResult),
26+
StringCompareOperator.StartsWith => leftResult.StartsWith(rightResult),
27+
StringCompareOperator.EndsWith => leftResult.EndsWith(rightResult),
2628
_ => throw new ArgumentOutOfRangeException(nameof(@operator).FormatPrivateVar(), @operator, null)
2729
};
2830
}
2931

3032
public override string ToString()
31-
=> $"{left}{Constant.Space}{@operator}{Constant.Space}{right}";
33+
{
34+
return $"{left}{Constant.Space}{@operator}{Constant.Space}{right}";
35+
}
3236
}

src/SimpleStateMachine.StructuralSearch/Operator/String/StringUnaryParameter.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,27 @@ namespace SimpleStateMachine.StructuralSearch.Operator.String;
99
internal class StringUnaryParameter(IParameter parameter, StringUnaryOperator type) : IParameter
1010
{
1111
public bool IsApplicableForPlaceholder(string placeholderName)
12-
=> parameter.IsApplicableForPlaceholder(placeholderName);
12+
{
13+
return parameter.IsApplicableForPlaceholder(placeholderName);
14+
}
1315

1416
public string GetValue(ref IParsingContext context)
1517
{
16-
var parameter1 = parameter.GetValue(ref context);
18+
var parameterValue = parameter.GetValue(ref context);
19+
1720
return type switch
1821
{
19-
StringUnaryOperator.Trim => parameter1.Trim(),
20-
StringUnaryOperator.TrimEnd => parameter1.TrimEnd(),
21-
StringUnaryOperator.TrimStart => parameter1.TrimStart(),
22-
StringUnaryOperator.ToUpper => parameter1.ToUpper(),
23-
StringUnaryOperator.ToLower => parameter1.ToLower(),
22+
StringUnaryOperator.Trim => parameterValue.Trim(),
23+
StringUnaryOperator.TrimEnd => parameterValue.TrimEnd(),
24+
StringUnaryOperator.TrimStart => parameterValue.TrimStart(),
25+
StringUnaryOperator.ToUpper => parameterValue.ToUpper(),
26+
StringUnaryOperator.ToLower => parameterValue.ToLower(),
2427
_ => throw new ArgumentOutOfRangeException(nameof(type).FormatPrivateVar(), type, null)
2528
};
2629
}
2730

2831
public override string ToString()
29-
=> $"{parameter}{Constant.Dote}{type}";
32+
{
33+
return $"{parameter}{Constant.Dote}{type}";
34+
}
3035
}

0 commit comments

Comments
 (0)