public SearchService() { _parserContext = new SearchParserContext(); var rootMap = new PropertyMap(); rootMap.Add(new PropertyItem { Source = "街道", Target = "TownListViewModel", TargetType = typeof(TownListViewModel) }); rootMap.Add(new PropertyItem { Source = "镇", Target = "TownListViewModel", TargetType = typeof(TownListViewModel) }); rootMap.Add(new PropertyItem { Source = "安全单位", Target = "GroupListViewModel", TargetType = typeof(GroupListViewModel) }); rootMap.Add(new PropertyItem { Source = "单位", Target = "GroupListViewModel", TargetType = typeof(GroupListViewModel) }); rootMap.Add(new PropertyItem { Source = "公司", Target = "GroupListViewModel", TargetType = typeof(GroupListViewModel) }); rootMap.Add(new PropertyItem { Source = "村", Target = "GroupListViewModel", TargetType = typeof(GroupListViewModel) }); rootMap.Add(new PropertyItem { Source = "驾驶员", Target = "DriverListViewModel", TargetType = typeof(DriverListViewModel) }); rootMap.Add(new PropertyItem { Source = "司机", Target = "DriverListViewModel", TargetType = typeof(DriverListViewModel) }); rootMap.Add(new PropertyItem { Source = "车辆", Target = "VehicleListViewModel", TargetType = typeof(VehicleListViewModel) }); rootMap.Add(new PropertyItem { Source = "车", Target = "VehicleListViewModel", TargetType = typeof(VehicleListViewModel) }); _parserContext.Properties[""] = rootMap; _parserContext.Properties["TownListViewModel"] = ParsePropertyOfType(typeof(TownListViewModel)); _parserContext.Properties["GroupViewModel"] = ParsePropertyOfType(typeof(GroupViewModel)); _parserContext.Properties["DriverListViewModel"] = ParsePropertyOfType(typeof(DriverListViewModel)); _parserContext.Properties["VehicleListViewModel"] = ParsePropertyOfType(typeof(VehicleListViewModel)); }
public Expression Deduce(SearchParserContext context) { return(_rootNode.DeductInternal(context)); }
public Interpreter(SearchParserContext context) { _context = context; }