From 9b091a0084b09d99aa96b4be69d8d8bfe55fdaa8 Mon Sep 17 00:00:00 2001 From: PopSlime Date: Thu, 27 Jul 2023 22:06:15 +0800 Subject: [PATCH] Rename constraint types to avoid ambiguity. --- Assets/Cryville/Crtr/Ruleset.cs | 18 +++++++++--------- Assets/Cryville/Crtr/RulesetInterpreter.cs | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Assets/Cryville/Crtr/Ruleset.cs b/Assets/Cryville/Crtr/Ruleset.cs index df9e952..7a35cce 100644 --- a/Assets/Cryville/Crtr/Ruleset.cs +++ b/Assets/Cryville/Crtr/Ruleset.cs @@ -146,7 +146,7 @@ namespace Cryville.Crtr { [ElementList] public PairList Elements = new PairList(); [PropertyList] - public PairList Properties = new PairList(); + public PairList Properties = new PairList(); public void Optimize(PdtEvaluatorBase etor) { foreach (var e in Properties) { etor.Optimize(e.Value); @@ -164,13 +164,13 @@ namespace Cryville.Crtr { foreach (var prop in Properties) { var name = prop.Key.Name; switch (prop.Key.Type) { - case PropertyType.Property: + case ConstraintType.Property: if (ev.PropSrcs.TryGetValue(name, out src)) etor.ContextSelfValue = src; etor.Evaluate(ev.PropOps[name], prop.Value); etor.ContextSelfValue = null; break; - case PropertyType.Variable: + case ConstraintType.Variable: _arbop.Name = name; etor.Evaluate(_arbop, prop.Value); break; @@ -187,22 +187,22 @@ namespace Cryville.Crtr { etor.ContextCascadeDiscard(); } } - public class PropertyKey { - public PropertyType Type { get; private set; } + public class ConstraintKey { + public ConstraintType Type { get; private set; } public int Name { get; private set; } - public PropertyKey(PropertyType type, string name) { + public ConstraintKey(ConstraintType type, string name) { Type = type; Name = IdentifierManager.Shared.Request(name); } public override string ToString() { switch (Type) { - case PropertyType.Property: return (string)IdentifierManager.Shared.Retrieve(Name); - case PropertyType.Variable: return string.Format("@var {0}", IdentifierManager.Shared.Retrieve(Name)); + case ConstraintType.Property: return (string)IdentifierManager.Shared.Retrieve(Name); + case ConstraintType.Variable: return string.Format("@var {0}", IdentifierManager.Shared.Retrieve(Name)); default: return string.Format("<{0}> {1}", Type, IdentifierManager.Shared.Retrieve(Name)); } } } - public enum PropertyType { + public enum ConstraintType { Property, Variable, } diff --git a/Assets/Cryville/Crtr/RulesetInterpreter.cs b/Assets/Cryville/Crtr/RulesetInterpreter.cs index ff7b764..1461f00 100644 --- a/Assets/Cryville/Crtr/RulesetInterpreter.cs +++ b/Assets/Cryville/Crtr/RulesetInterpreter.cs @@ -59,7 +59,7 @@ namespace Cryville.Crtr { break; case ';': case ':': - return new PropertyKey(a.Contains("var") ? PropertyType.Variable : PropertyType.Property, key); + return new ConstraintKey(a.Contains("var") ? ConstraintType.Variable : ConstraintType.Property, key); case '{': return new RulesetSelectors(s); case '}':