public PositioningProcessor(AssetIconsCompiledStyle compiledStyleDefinition, AssetIconsStyle style) { widthProvider = new StaticValueProvider(new MathValue(1.0f, true)); heightProvider = new StaticValueProvider(new MathValue(1.0f, true)); var horizontalContext = new MathContextBuilder() .WithTerm("width", widthProvider) .WithTerm("height", heightProvider) .ImplicitlyReferences(widthProvider) .Build(); var verticalContext = new MathContextBuilder() .WithTerm("width", widthProvider) .WithTerm("height", heightProvider) .ImplicitlyReferences(heightProvider) .Build(); compiledWidth = CompiledExpression.Compile(style.Width, horizontalContext); compiledHeight = CompiledExpression.Compile(style.Height, verticalContext); compiledX = CompiledExpression.Compile(style.X, horizontalContext); compiledY = CompiledExpression.Compile(style.Y, verticalContext); compiledDisplay = CompiledExpression.Compile(style.Display, horizontalContext); styleAnchoring = compiledStyleDefinition.Anchor; }
public void ImportValues() { var context = new MathContextBuilder() .WithTerm("Width", new StaticValueProvider(10)) .Build(); string syntax = "10 * Width"; var intermediateExpression = SimpleMathExpression.Compile(syntax, context); }
public void LogicOnTerms() { var contextA = new MathContextBuilder() .WithTerm("Level", new StaticValueProvider(15)) .Build(); TestExpression(true, SimpleMathExpression.Compile("2 < Level", contextA)); TestExpression(true, SimpleMathExpression.Compile("15 == Level", contextA)); TestExpression(true, SimpleMathExpression.Compile("16 > Level", contextA)); }
public void ImportTerms() { var contextA = new MathContextBuilder() .WithTerm("Width", 15) .WithTerm("Height", 10) .Build(); TestExpression(100, SimpleMathExpression.Compile("10 * Height", contextA)); TestExpression(25, SimpleMathExpression.Compile("width + Height", contextA)); TestExpression(25, SimpleMathExpression.Compile("wiDth + heiGHt", contextA)); TestExpression(20, SimpleMathExpression.Compile("Height * 2", contextA)); TestExpression(23, SimpleMathExpression.Compile("3 + Height * 2", contextA)); }