示例#1
0
 public HumanWorkProvider(HumanAvatar user, WorkAgent workAgent,
     WorkflowProvider workflow, IDecompositionService<WorkItem> decompService,
     GoalService goalService)
 {
     _user = user;
     _workflow = workflow;
     WorkAgent = workAgent;
     _decompService = decompService;
     _goalService = goalService;
     _workitemGoals = new Dictionary<WorkItem, List<Goal>>();
     _completedGoals = new Dictionary<WorkItem, List<Goal>>();
 }
示例#2
0
        public static HumanWorkProvider MapWorkProviderFromNPC(BotAvatar npc, HumanAvatar human, 
            GoalService goalService, IDecompositionService<WorkItem> decompService)
        {
            HumanWorkProvider worker = new HumanWorkProvider
                (human, npc.WorkProvider.GetWorkAgent(), npc.WorkProvider.GetWorkflowProvider(),
                decompService, goalService);

            // Any currently processing tasks, remove
            npc.WorkProvider.GetWorkAgent().processing.Clear();

            // Now add all the tasks that had been started to the worker
            foreach (var workItem in npc.WorkProvider.GetWorkAgent().started)
            {
                worker.AddWork(workItem);
            }

            return worker;
        }
示例#3
0
        public Simulation()
        {
            _worldStateService = new WorldStateService();
            _workItemDecomp = new SimpleWorkItemDecomposition();
            _goalService = new GoalService(_worldStateService);

            // Set up database classes
            _databaseProvider = new MySql.Data.MySqlClient.MySqlClientFactory();
            _stateDataAccess = new WorldStateDataAccess(_databaseProvider);
            _knowledgeDataAccess = new WorldKnowledgeDataAccess(_databaseProvider);

            _worldStateRepos = new WorldStateRepository(_stateDataAccess);
            _accessRecordRepos = new AccessRecordRepository(_stateDataAccess);
            _assetServiceRepos = new AssetServiceRoutineRepository(_stateDataAccess);
            _methodRepository = new MethodRepository(_knowledgeDataAccess);

            _activityMethodService = new ActivityMethodService(_methodRepository);

            // Set up service invocation classes
            _serviceRoutineService = new ServiceRoutineService(_worldStateService, _assetServiceRepos);
            _abortHandler = new AbortHandler();
            _serviceRoutineService.AddServiceInvocationHandler(_abortHandler);
        }