コード例 #1
0
    // The recursive higher-order observation method as described in the thesis.
    // It has a height limiter to specify the desired max order of observation.
    public void UpdateToM(Subject s, Beliefs b, HashSet <Location> fov, int height)
    {
        if (height == 0 || b.Sees.Agents.Count == 0)
        {
            return;
        }

        foreach (KeyValuePair <char, Subject> kvp in b.Sees.Agents)
        {
            HashSet <Location> intersectFov = FOV.GetSharedFov(kvp.Value, s);

            VisionPercept vp = Sight.Perceive(kvp.Key, intersectFov);
            AudioPercept  ap = Hearing.Perceive(kvp.Key, kvp.Value.Location);

            if (!b.ToM.ContainsKey(kvp.Key))
            {
                b.ToM.Add(kvp.Key, new Beliefs());
            }

            b.ToM[kvp.Key].Update(vp);
            b.ToM[kvp.Key].Update(ap);

            UpdateToM(kvp.Value, b.ToM[kvp.Key], intersectFov, height - 1);
        }
    }
コード例 #2
0
        private static List <LinkedParticipantDto> GetLinkedParticipantDtos(Hearing hearing)
        {
            var hearingParticipants = hearing.Participants.Where(x => x.LinkedParticipants.Any()).ToList();

            var linkedParticipantDtos = new List <LinkedParticipantDto>();

            foreach (var hearingParticipant in hearingParticipants)
            {
                var participantEmail = hearingParticipant.Person.ContactEmail;
                var participantLink  = hearingParticipant.GetLinkedParticipants()
                                       .FirstOrDefault(x => x.ParticipantId == hearingParticipant.Id);
                if (participantLink != null)
                {
                    var linkedParticipant = hearing.Participants.SingleOrDefault(x => x.Id == participantLink.LinkedId);

                    var linkedParticipantDto = new LinkedParticipantDto
                                               (
                        participantEmail,
                        linkedParticipant?.Person.ContactEmail,
                        participantLink.Type
                                               );

                    linkedParticipantDtos.Add(linkedParticipantDto);
                }
            }

            return(linkedParticipantDtos);
        }
コード例 #3
0
        public HearingIsReadyForVideoIntegrationEvent(Hearing hearing)
        {
            Hearing = HearingDtoMapper.MapToDto(hearing);
            var hearingParticipants = hearing.GetParticipants();

            Participants = hearingParticipants.Select(ParticipantDtoMapper.MapToDto).ToList();
        }
コード例 #4
0
        private async Task PublishUpdateHearingParticipantsEvent(Hearing hearing, List <ExistingParticipantDetails> existingParticipants, List <NewParticipant> newParticipants,
                                                                 List <Guid> removedParticipantIds, List <LinkedParticipantDto> linkedParticipants)
        {
            var eventNewParticipants = hearing.GetParticipants()
                                       .Where(x => newParticipants.Any(y => y.Person.Username == x.Person.Username)).ToList();

            var eventExistingParticipants = hearing.GetParticipants()
                                            .Where(x => existingParticipants.Any(y => y.ParticipantId == x.Id)).ToList();

            var eventLinkedParticipants = new List <Infrastructure.Services.Dtos.LinkedParticipantDto>();

            foreach (var linkedParticipant in linkedParticipants)
            {
                var primaryLinkedParticipant   = hearing.GetParticipants().SingleOrDefault(x => x.Person.ContactEmail == linkedParticipant.ParticipantContactEmail);
                var secondaryLinkedParticipant = hearing.GetParticipants().SingleOrDefault(x => x.Person.ContactEmail == linkedParticipant.LinkedParticipantContactEmail);

                eventLinkedParticipants.Add(new Infrastructure.Services.Dtos.LinkedParticipantDto
                {
                    LinkedId      = secondaryLinkedParticipant.Id,
                    ParticipantId = primaryLinkedParticipant.Id,
                    Type          = linkedParticipant.Type
                });
            }

            var hearingParticipantsUpdatedIntegrationEvent = new HearingParticipantsUpdatedIntegrationEvent(hearing.Id, eventExistingParticipants, eventNewParticipants,
                                                                                                            removedParticipantIds, eventLinkedParticipants);
            await _eventPublisher.PublishAsync(hearingParticipantsUpdatedIntegrationEvent);
        }
コード例 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,CaseID,CurrentDate,NextDate")] Hearing hearing)
        {
            if (id != hearing.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hearing);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HearingExists(hearing.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CaseID"] = new SelectList(_context.Cases, "ID", "ID", hearing.CaseID);
            return(View(hearing));
        }
コード例 #6
0
        private static PersonSuitabilityAnswerResponse BuildResponse(Hearing hearing, string username)
        {
            PersonSuitabilityAnswerResponse personSuitabilityAnswer = null;

            if (hearing.Participants != null)
            {
                var participant = hearing.Participants.FirstOrDefault(p => p.Person.Username.ToLower() == username.Trim().ToLower());
                if (participant != null)
                {
                    var answers = participant.Questionnaire != null ? participant.Questionnaire.SuitabilityAnswers : new List <SuitabilityAnswer>();
                    var suitabilityAnswerToResponseMapper = new SuitabilityAnswerToResponseMapper();
                    personSuitabilityAnswer = new PersonSuitabilityAnswerResponse
                    {
                        HearingId                = hearing.Id,
                        ParticipantId            = participant.Id,
                        UpdatedAt                = participant.Questionnaire?.UpdatedDate ?? DateTime.MinValue,
                        ScheduledAt              = hearing.ScheduledDateTime,
                        Answers                  = suitabilityAnswerToResponseMapper.MapToResponses(answers),
                        QuestionnaireNotRequired = hearing.QuestionnaireNotRequired
                    };
                }
            }

            return(personSuitabilityAnswer);
        }
コード例 #7
0
 void Awake()
 {
     predator      = GameObject.Find("Predator");
     agent         = predator.GetComponent <UnityEngine.AI.NavMeshAgent>();
     character     = predator.GetComponent <ThirdPersonCharacter>();
     visionScript  = predator.GetComponent <Vision>();
     hearingScript = predator.GetComponent <Hearing>();
 }
コード例 #8
0
        public ActionResult DeleteConfirmed(int id)
        {
            Hearing hearing = db.Hearings.Find(id);

            db.Hearings.Remove(hearing);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #9
0
        /// <summary>
        /// Map an existing hearing to a CreateVideoHearingCommand for the purpose of multi-booking days
        /// </summary>
        /// <param name="hearing">Original hearing</param>
        /// <param name="newDate">New hearing date</param>
        /// <param name="randomGenerator">generator for unique sips</param>
        /// <param name="sipAddressStem">sip address stem</param>
        /// <param name="totalDays">Total number of days of multi-booking hearing</param>
        /// <param name="hearingDay">Day number of multi-booking hearing</param>
        /// <returns>command to create a new video hearing</returns>
        public static CreateVideoHearingCommand CloneToCommand(Hearing hearing, DateTime newDate,
                                                               IRandomGenerator randomGenerator, string sipAddressStem, int totalDays, int hearingDay)
        {
            var reps = hearing.GetParticipants().Where(x => x.HearingRole.UserRole.IsRepresentative)
                       .Cast <Representative>().ToList();
            var nonReps      = hearing.GetParticipants().Where(x => !x.HearingRole.UserRole.IsRepresentative).ToList();
            var participants = new List <NewParticipant>();

            participants.AddRange(reps.Select(r => new NewParticipant
            {
                Person      = r.Person,
                Representee = r.Representee,
                CaseRole    = r.CaseRole,
                DisplayName = r.DisplayName,
                HearingRole = r.HearingRole
            }));
            participants.AddRange(nonReps.Select(r => new NewParticipant
            {
                Person      = r.Person,
                CaseRole    = r.CaseRole,
                DisplayName = r.DisplayName,
                HearingRole = r.HearingRole
            }));

            var cases = hearing.GetCases().Select(c => new Case(c.Number, $"{c.Name} Day {hearingDay} of {totalDays}")
            {
                IsLeadCase = c.IsLeadCase
            }).ToList();

            var newEndpoints = hearing.GetEndpoints().Select(x =>
            {
                var sip = randomGenerator.GetWeakDeterministic(DateTime.UtcNow.Ticks, 1, 10);
                var pin = randomGenerator.GetWeakDeterministic(DateTime.UtcNow.Ticks, 1, 4);
                return(new NewEndpoint
                {
                    Pin = pin,
                    Sip = $"{sip}{sipAddressStem}",
                    DisplayName = x.DisplayName,
                    DefenceAdvocateUsername = x.DefenceAdvocate?.Person?.Username
                });
            }).ToList();

            var linkedParticipantDtos = GetLinkedParticipantDtos(hearing);

            var duration = 480;
            var command  = new CreateVideoHearingCommand(hearing.CaseType, hearing.HearingType, newDate,
                                                         duration, hearing.HearingVenue, participants, cases, true,
                                                         hearing.AudioRecordingRequired, newEndpoints, linkedParticipantDtos)
            {
                HearingRoomName  = hearing.HearingRoomName,
                OtherInformation = hearing.OtherInformation,
                CreatedBy        = hearing.CreatedBy,
                SourceId         = hearing.Id
            };

            return(command);
        }
コード例 #10
0
 //gets scripts
 void Start()
 {
     data    = GetComponent <TankData>();
     motor   = GetComponent <TankMotor>();
     tf      = GetComponent <Transform>();
     shoot   = GetComponent <Shoot>();
     fov     = GetComponent <FOV>();
     hearing = GetComponent <Hearing>();
 }
コード例 #11
0
 private static HearingDetailsResponse MapDetails(Hearing hearing)
 {
     return(new HearingDetailsResponse
     {
         CaseName = hearing.CaseName,
         CaseNumber = hearing.CaseNumber,
         CaseType = hearing.CaseType,
         HearingType = hearing.HearingType,
         ScheduledDateTime = hearing.ScheduledDateTime
     });
 }
コード例 #12
0
 public ActionResult Edit([Bind(Include = "ID,CaseID,CurrentDate,NextDate")] Hearing hearing)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hearing).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CaseID = new SelectList(db.Cases, "ID", "Name", hearing.CaseID);
     return(View(hearing));
 }
コード例 #13
0
        public ActionResult Create([Bind(Include = "ID,CaseID,CurrentDate,NextDate")] Hearing hearing)
        {
            if (ModelState.IsValid)
            {
                db.Hearings.Add(hearing);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CaseID = new SelectList(db.Cases, "ID", "Name", hearing.CaseID);
            return(View(hearing));
        }
コード例 #14
0
ファイル: EnemyAI.cs プロジェクト: TobiasMOReilly/Ealu
 // Use this for initialization
 void Start()
 {
     fOV                   = GetComponent <FieldOfView>();
     anim                  = GetComponent <Animator>();
     scan                  = GetComponent <Scan>();
     distract              = GetComponent <Distractable>();
     hearing               = GetComponent <Hearing>();
     scanCompleteString    = "ScanComplete";
     playerLostString      = "PlayerLost";
     playerSpottedString   = "PlayerSpotted";
     enemyDistractedString = "Distracted";
 }
コード例 #15
0
    /// <summary>
    /// Инициализация
    /// </summary>
    protected override void Initialize()
    {
        base.Initialize();
        rigid.gravityScale = 0f;
        rigid.isKinematic  = true;

        hitBox.AttackEventHandler += HandleAttackProcess;
        Transform indicators = transform.FindChild("Indicators");

        hearing = indicators.GetComponentInChildren <Hearing>();
        hearing.hearingEventHandler += HandleHearingEvent;
    }
コード例 #16
0
        public async Task <IActionResult> Create([Bind("ID,CaseID,CurrentDate,NextDate")] Hearing hearing)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hearing);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CaseID"] = new SelectList(_context.Cases, "ID", "ID", hearing.CaseID);
            return(View(hearing));
        }
        public static HearingsByUsernameForDeletionResponse MapToDeletionResponse(Hearing hearing)
        {
            var leadCase = hearing.GetCases().FirstOrDefault(x => x.IsLeadCase) ?? hearing.GetCases().FirstOrDefault();

            return(new HearingsByUsernameForDeletionResponse
            {
                HearingId = hearing.Id,
                CaseName = leadCase?.Name,
                CaseNumber = leadCase?.Number,
                ScheduledDateTime = hearing.ScheduledDateTime,
                Venue = hearing.HearingVenueName
            });
        }
コード例 #18
0
        // GET: Hearings/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Hearing hearing = db.Hearings.Find(id);

            if (hearing == null)
            {
                return(HttpNotFound());
            }
            return(View(hearing));
        }
コード例 #19
0
        // GET: Hearings/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Hearing hearing = db.Hearings.Find(id);

            if (hearing == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CaseID = new SelectList(db.Cases, "ID", "Name", hearing.CaseID);
            return(View(hearing));
        }
コード例 #20
0
    public virtual void Start()
    {
        // set spawn position to the position they were placed in at runtime
        spawnPosition = transform.position;

        targetPosition = spawnPosition;

        // Link the controller to this pawn
        controller = GetComponent <Controller>();

        // set senses to the gameObject
        sight      = GetComponent <LineOfSight>();
        hearing    = GetComponent <Hearing>();
        noiseMaker = GetComponent <NoiseMaker>();
        hitbox     = GetComponent <Hitbox>();
    }
コード例 #21
0
        public static HearingDto MapToDto(Hearing hearing)
        {
            var @case = hearing.GetCases().First(); // Does this need to be a lead case?

            return(new HearingDto
            {
                HearingId = hearing.Id,
                ScheduledDateTime = hearing.ScheduledDateTime,
                ScheduledDuration = hearing.ScheduledDuration,
                CaseType = hearing.CaseType.Name,
                CaseNumber = @case.Number,
                CaseName = @case.Name,
                HearingVenueName = hearing.HearingVenueName,
                RecordAudio = hearing.AudioRecordingRequired
            });
        }
コード例 #22
0
ファイル: Agent.cs プロジェクト: s162995/CtC
    // The agent generates audio and vision percept from the locations
    // within the agent's field of view.
    protected List <IPercept> Perceive()
    {
        HashSet <Location> fov = FOV.GetFov(Direction, Location);

        VisionPercept p  = Sight.Perceive(ID, fov);
        AudioPercept  p2 = Hearing.Perceive(ID, Location);

        Piece.DisplayFeature(fov.ToList(), Feature.Vision);
        Piece.DisplayFeature(fov.Intersect(Manager.Board.Obstacles.Keys).ToList(), Feature.Obstacle);
        Piece.DisplayFeature(fov.Intersect(Manager.Board.Foods.Keys).ToList(), Feature.Food);

        return(new List <IPercept>()
        {
            p, p2
        });
    }
        public HearingDetailsResponse MapHearingToDetailedResponse(Hearing videoHearing)
        {
            var caseMapper        = new CaseToResponseMapper();
            var participantMapper = new ParticipantToResponseMapper();

            var cases = videoHearing.GetCases()
                        .Select(x => caseMapper.MapCaseToResponse(x))
                        .ToList();

            var participants = videoHearing.GetParticipants()
                               .Select(x => participantMapper.MapParticipantToResponse(x))
                               .ToList();

            var endpoints = videoHearing.GetEndpoints()
                            .Select(EndpointToResponseMapper.MapEndpointToResponse)
                            .ToList();

            var response = new HearingDetailsResponse
            {
                Id = videoHearing.Id,
                ScheduledDuration        = videoHearing.ScheduledDuration,
                ScheduledDateTime        = videoHearing.ScheduledDateTime,
                HearingTypeName          = videoHearing.HearingType.Name,
                CaseTypeName             = videoHearing.CaseType.Name,
                HearingVenueName         = videoHearing.HearingVenueName,
                Cases                    = cases,
                Participants             = participants,
                HearingRoomName          = videoHearing.HearingRoomName,
                OtherInformation         = videoHearing.OtherInformation,
                CreatedBy                = videoHearing.CreatedBy,
                CreatedDate              = videoHearing.CreatedDate,
                UpdatedBy                = videoHearing.UpdatedBy,
                UpdatedDate              = videoHearing.UpdatedDate,
                ConfirmedBy              = videoHearing.ConfirmedBy,
                ConfirmedDate            = videoHearing.ConfirmedDate,
                Status                   = videoHearing.Status.MapToContractEnum(),
                QuestionnaireNotRequired = videoHearing.QuestionnaireNotRequired,
                AudioRecordingRequired   = videoHearing.AudioRecordingRequired,
                CancelReason             = videoHearing.CancelReason,
                GroupId                  = videoHearing.SourceId,
                Endpoints                = endpoints
            };

            return(response);
        }
コード例 #24
0
        //Add and Update hearing

        public Hearing AddandUpdateHearing(Hearing hearing)
        {
            Hearing hearingAppeal = new Hearing();


            if (hearing.Id == 0)
            {
                hearingAppeal = _Hearing.AddData(hearing);
            }
            else
            {
                hearingAppeal = _Hearing.UpdateData(hearing);
            }



            return(hearingAppeal);
        }
コード例 #25
0
        public async Task should_return_hearing_for_user()
        {
            var hearing = new Hearing(_hearingId, "case name", "case number", _scheduledDateTime, "caseType",
                                      "hearingType");

            _service.Setup(x => x.GetHearingFor(Username, _hearingId))
            .ReturnsAsync(hearing);

            var result = (OkObjectResult)await _controller.GetHearing(_hearingId);

            var hearingResponse = (HearingDetailsResponse)result.Value;

            Assert.AreEqual(hearing.CaseName, hearingResponse.CaseName);
            Assert.AreEqual(hearing.CaseNumber, hearingResponse.CaseNumber);
            Assert.AreEqual(hearing.HearingType, hearingResponse.HearingType);
            Assert.AreEqual(hearing.CaseType, hearingResponse.CaseType);
            Assert.AreEqual(hearing.ScheduledDateTime, hearingResponse.ScheduledDateTime);
        }
コード例 #26
0
    void Awake()
    {
        agent   = GetComponent <NavMeshAgent>();
        sight   = GetComponent <Sight>();
        anim    = GetComponent <Animator>();
        look    = GetComponent <FocusLook>();
        emotion = GetComponent <EmotionRenderer>();

        ear        = GetComponent <Hearing>();
        ear.heard += (Vector3 position) => { this.OnHeard(position); };

        movementSpeed = gameObject.AddComponent <MovementSpeed>();

        // Check which objects are currently grabbable
        rangeEvent = GetComponentInChildren <CollisionEventTransmitter>();
        rangeEvent.onTriggerEnter += (Collider other) => { inRange.Add(other.transform.gameObject); };
        rangeEvent.onTriggerExit  += (Collider other) => { inRange.Remove(other.transform.gameObject); };
    }
コード例 #27
0
 public static HearingDto MapToDto(Hearing entity)
 {
     return(new HearingDto()
     {
         HearingId = entity.HearingId,
         HearingDate = entity.HearingDate.AddHours(-1),
         CreatedByUserId = entity.CreatedByUserId,
         CaseId = entity.CaseId,
         UserHearing = entity.UserHearing.Select(x => new UserHearingDto()
         {
             UserId = x.UserId,
             UserName = x.User.Username
         }).ToList(),
         Note = entity.Note.Select(x => new NoteDto()
         {
             Text = x.Text,
             CreatedByUserId = x.CreatedByUserId,
             HearingId = x.HearingId
         }).ToList()
     });
 }
コード例 #28
0
ファイル: EventManager.cs プロジェクト: bill42362/WizardFight
 public int RegisterListener(Object target, string type, Object listener, Hearing.EventCallback method)
 {
     int eventId = -1;
     for(int i = 0; i < hearings.Length; ++i) {
         Hearing h = hearings[i];
         if((target == h.target) && (type == h.type) && (listener == h.listener)) {
             eventId = i;
         }
     }
     if(-1 == eventId) {
         eventId = hearings.Length;
         Hearing hearing = new Hearing();
         hearing.target = target;
         hearing.listener = listener;
         hearing.type = type;
         hearing.method = method;
         Hearing.push(ref hearings, hearing);
         PushString(ref hearingTypes, type);
     }
     return eventId;
 }
コード例 #29
0
        public async Task Should_get_kinly_virtual_court_room()
        {
            var hearing = new Hearing
            {
                Uris = new Uris
                {
                    Admin      = "https://Admin.com", Participant = "https://Participant.com",
                    Pexip_node = "https://Pexip_node.com"
                },
                Telephone_conference_id = "12345678",
                Virtual_courtroom_id    = Guid.NewGuid()
            };

            _kinlyApiClientMock.Setup(x => x.GetHearingAsync(It.IsAny <string>())).ReturnsAsync(hearing);

            var result = await _kinlyPlatformService.GetVirtualCourtRoomAsync(It.IsAny <Guid>());

            result.Should().NotBeNull();
            result.AdminUri.Should().Be(hearing.Uris.Admin);
            result.JudgeUri.Should().Be(hearing.Uris.Participant);
            result.ParticipantUri.Should().Be(hearing.Uris.Participant);
        }
コード例 #30
0
    //Field of Sound Additional Details On Character Selection
    void EnableFOS()
    {
        // Changes the editor to draw a field of sound visualization on the selected target
        Hearing fos = (Hearing)target;

        // Set color of sound visualization
        Handles.color = Color.white;
        // Draw the max range circle of the field of sound for the target
        Handles.DrawWireArc(fos.transform.position, Vector3.up, Vector3.forward, 360, fos.soundRadius);
        // Draw sound radius lines
        Vector3 soundAngleA = fos.DirFromAngle(-fos.soundAngle / 2, false);
        Vector3 soundAngleB = fos.DirFromAngle(fos.soundAngle / 2, false);

        Handles.DrawLine(fos.transform.position, fos.transform.position + soundAngleA * fos.soundRadius);
        Handles.DrawLine(fos.transform.position, fos.transform.position + soundAngleB * fos.soundRadius);
        // Draw line between selected and hearableTarget
        Handles.color = Color.blue;
        Vector3 modify = fos.transform.position + new Vector3(1.0f, 0, 0);

        foreach (Transform hearableTarget in fos.hearableTargets)
        {
            Handles.DrawLine(modify, hearableTarget.position);
        }
    }
 public HearingDetailsUpdatedIntegrationEvent(Hearing hearing)
 {
     Hearing = HearingDtoMapper.MapToDto(hearing);
 }