public static IWidget GetWidget(string label, IValue value, bool readOnly, Action <IValue> valueChangedHandler) { var renderer = new QLWidgetFactory(label, readOnly, valueChangedHandler); value.Accept(renderer); return(renderer._result); }
public bool Unify(IValue lhs, IValue rhs) { bool success = lhs.Accept(new ValueUnifier(rhs, this)); if (!success) { Release(); } return(success); }
/// <summary> /// プレースホルダに値を適用する /// </summary> /// <param name="placeHolders"></param> /// <remarks></remarks> public void Place(Dictionary <string, string> placeHolders) { if (_placedHolders == null) { _placedHolders = new Dictionary <string, INode>(); } // プレースホルダノード単体の場合はReplacePlaceHoldersで置き換えられない if (this.IsPlaceHolderOnly) { var placeHolderName = ((PlaceHolderExpr)_value).LabelName; if (placeHolders.ContainsKey(placeHolderName)) { try { _value = MiniSqlParserAST.CreateExpr(placeHolders[placeHolderName]); // 適用したプレースホルダを記録する if (!_placedHolders.ContainsKey(placeHolderName)) { _placedHolders.Add(placeHolderName, _value); } return; } catch (SqlSyntaxErrorsException ex) {; throw new CannotBuildASTException("Type of placeholder value is mismatched", ex); } } } // プレースホルダに値を適用する var visitor = new ReplacePlaceHolders(placeHolders); _value.Accept(visitor); // 適用したプレースホルダを記録する foreach (var placedHolder in visitor.PlacedHolders) { if (!_placedHolders.ContainsKey(placedHolder.Key)) { _placedHolders.Add(placedHolder.Key, placedHolder.Value); } } }
public bool Visit(IConcreteValue lhsConcreteValue) { return(rhsValue.Accept(new LhsConcreteValueUnifier(lhsConcreteValue, boundVariables))); }
/// <summary> /// Convenience method. /// </summary> public string Print(IValue value) { return(value.Accept(this)); }