From d83dae5587c7b4e193ad7a08e7e2c1377e518dd1 Mon Sep 17 00:00:00 2001 From: atlimit8 Date: Sun, 5 Feb 2017 20:25:34 -0600 Subject: [PATCH] Rename BooleanExpression => ConditionExpression --- OpenRA.Game/FieldLoader.cs | 4 ++-- OpenRA.Game/OpenRA.Game.csproj | 2 +- .../{BooleanExpression.cs => ConditionExpression.cs} | 4 ++-- OpenRA.Mods.Common/Lint/LintExts.cs | 8 ++++---- OpenRA.Mods.Common/Traits/Conditions/ConditionalTrait.cs | 2 +- ...ooleanExpressionTest.cs => ConditionExpressionTest.cs} | 8 ++++---- OpenRA.Test/OpenRA.Test.csproj | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) rename OpenRA.Game/Support/{BooleanExpression.cs => ConditionExpression.cs} (99%) rename OpenRA.Test/OpenRA.Game/{BooleanExpressionTest.cs => ConditionExpressionTest.cs} (91%) diff --git a/OpenRA.Game/FieldLoader.cs b/OpenRA.Game/FieldLoader.cs index fad93c4462..6a725c02c0 100644 --- a/OpenRA.Game/FieldLoader.cs +++ b/OpenRA.Game/FieldLoader.cs @@ -398,13 +398,13 @@ namespace OpenRA return InvalidValueAction(value, fieldType, fieldName); } - else if (fieldType == typeof(BooleanExpression)) + else if (fieldType == typeof(ConditionExpression)) { if (value != null) { try { - return new BooleanExpression(value); + return new ConditionExpression(value); } catch (InvalidDataException e) { diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 54e5e3518d..30a49ca89d 100644 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -241,7 +241,7 @@ - + diff --git a/OpenRA.Game/Support/BooleanExpression.cs b/OpenRA.Game/Support/ConditionExpression.cs similarity index 99% rename from OpenRA.Game/Support/BooleanExpression.cs rename to OpenRA.Game/Support/ConditionExpression.cs index bdd4ca785c..984b5c4ee9 100644 --- a/OpenRA.Game/Support/BooleanExpression.cs +++ b/OpenRA.Game/Support/ConditionExpression.cs @@ -16,7 +16,7 @@ using System.Linq; namespace OpenRA.Support { - public class BooleanExpression + public class ConditionExpression { public readonly string Expression; readonly HashSet variables = new HashSet(); @@ -67,7 +67,7 @@ namespace OpenRA.Support class NotEqualsToken : BinaryOperationToken { public NotEqualsToken(int index) : base("!=", index) { } } class NotToken : UnaryOperationToken { public NotToken(int index) : base("!", index) { } } - public BooleanExpression(string expression) + public ConditionExpression(string expression) { Expression = expression; var openParens = 0; diff --git a/OpenRA.Mods.Common/Lint/LintExts.cs b/OpenRA.Mods.Common/Lint/LintExts.cs index 7267c7f539..a8b1ee57fa 100644 --- a/OpenRA.Mods.Common/Lint/LintExts.cs +++ b/OpenRA.Mods.Common/Lint/LintExts.cs @@ -29,9 +29,9 @@ namespace OpenRA.Mods.Common.Lint if (typeof(IEnumerable).IsAssignableFrom(type)) return fieldInfo.GetValue(ruleInfo) as IEnumerable; - if (type == typeof(BooleanExpression)) + if (type == typeof(ConditionExpression)) { - var expr = (BooleanExpression)fieldInfo.GetValue(ruleInfo); + var expr = (ConditionExpression)fieldInfo.GetValue(ruleInfo); return expr != null ? expr.Variables : Enumerable.Empty(); } @@ -48,9 +48,9 @@ namespace OpenRA.Mods.Common.Lint if (typeof(IEnumerable).IsAssignableFrom(type)) return (IEnumerable)propertyInfo.GetValue(ruleInfo); - if (type == typeof(BooleanExpression)) + if (type == typeof(ConditionExpression)) { - var expr = (BooleanExpression)propertyInfo.GetValue(ruleInfo); + var expr = (ConditionExpression)propertyInfo.GetValue(ruleInfo); return expr != null ? expr.Variables : Enumerable.Empty(); } diff --git a/OpenRA.Mods.Common/Traits/Conditions/ConditionalTrait.cs b/OpenRA.Mods.Common/Traits/Conditions/ConditionalTrait.cs index 7a848d3991..c2315f99b4 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/ConditionalTrait.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/ConditionalTrait.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits [ConsumedConditionReference] [Desc("Boolean expression defining the condition to enable this trait.")] - public readonly BooleanExpression RequiresCondition = null; + public readonly ConditionExpression RequiresCondition = null; public abstract object Create(ActorInitializer init); diff --git a/OpenRA.Test/OpenRA.Game/BooleanExpressionTest.cs b/OpenRA.Test/OpenRA.Game/ConditionExpressionTest.cs similarity index 91% rename from OpenRA.Test/OpenRA.Game/BooleanExpressionTest.cs rename to OpenRA.Test/OpenRA.Game/ConditionExpressionTest.cs index 25fb284f7b..c3063c07b2 100644 --- a/OpenRA.Test/OpenRA.Game/BooleanExpressionTest.cs +++ b/OpenRA.Test/OpenRA.Game/ConditionExpressionTest.cs @@ -19,7 +19,7 @@ using OpenRA.Support; namespace OpenRA.Test { [TestFixture] - public class BooleanExpressionTest + public class ConditionExpressionTest { IReadOnlyDictionary testValues = new ReadOnlyDictionary(new Dictionary() { @@ -29,17 +29,17 @@ namespace OpenRA.Test void AssertFalse(string expression) { - Assert.False(new BooleanExpression(expression).Evaluate(testValues), expression); + Assert.False(new ConditionExpression(expression).Evaluate(testValues), expression); } void AssertTrue(string expression) { - Assert.True(new BooleanExpression(expression).Evaluate(testValues), expression); + Assert.True(new ConditionExpression(expression).Evaluate(testValues), expression); } void AssertParseFailure(string expression) { - Assert.Throws(typeof(InvalidDataException), () => new BooleanExpression(expression).Evaluate(testValues), expression); + Assert.Throws(typeof(InvalidDataException), () => new ConditionExpression(expression).Evaluate(testValues), expression); } [TestCase(TestName = "AND operation")] diff --git a/OpenRA.Test/OpenRA.Test.csproj b/OpenRA.Test/OpenRA.Test.csproj index 4caa55258f..b9df93b6ab 100644 --- a/OpenRA.Test/OpenRA.Test.csproj +++ b/OpenRA.Test/OpenRA.Test.csproj @@ -55,7 +55,7 @@ - +