internal Tools(Inferrer <ClueSource, ClueConstant> inferrer, params ClueId[] clues) { _inferrer = inferrer; _clues = clues.ToArray(); _vars = new Vars(inferrer._constraintFundeps); _generator = new SymbolGenerator(); _ruleScope = _generator.CreateScope(); _userScopes = (from _ in clues select _generator.CreateScope()).ToArray(); PreconditionsSatisfied = false; Error = null; }
// OPTIMIZATION: Use heap. // We use a sortedset instead of a queue because lower clue IDs can't depend on greater clue IDs // This handily avoids Painter's Algorithm issues *and* deduplicates IDs! Magic. public Inferrer(FunctionalDependencies fundeps) { _clueIdGen = new SymbolGenerator(); _constraintFundeps = fundeps; _clueKind = new Dictionary <ClueId, atom>(); _clueSource = new Dictionary <ClueId, ClueSource>(); _clueConstant = new Dictionary <ClueId, ClueConstant>(); _clueDependsOn = new Dictionary <ClueId, ClueId[]>(); _cluesDependingOn = new Dictionary <ClueId, HashSet <ClueId> >(); _clueBestKnownType = new Dictionary <ClueId, free <type> >(); _clueErrors = new Dictionary <ClueId, List <InferenceError> >(); _cluesToUpdate = new SortedSet <ClueId>(new ClueIdComparer()); _rules = new List <InferenceRule <ClueConstant> >(); }
internal Scope(SymbolGenerator generator) { _generator = generator; _alreadyAssignedCount = new Dictionary <atom, int>(); _alreadyAssignedAbs = new Dictionary <atom, int>(); }