예제 #1
0
        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));
        }
예제 #2
0
 public Expression Deduce(SearchParserContext context)
 {
     return(_rootNode.DeductInternal(context));
 }
예제 #3
0
 public Interpreter(SearchParserContext context)
 {
     _context = context;
 }