Exemplo n.º 1
0
        public bool Equals(BeliefsAboutAgent anotherBeliefsAboutAgent)
        {
            if (anotherBeliefsAboutAgent == null)
            {
                return(false);
            }

            bool infoEquals          = info.Equals(anotherBeliefsAboutAgent.info);
            bool infoReferenceEquals = object.ReferenceEquals(info, anotherBeliefsAboutAgent.info);

            bool roleEquals          = (role == anotherBeliefsAboutAgent.role);
            bool roleReferenceEquals = object.ReferenceEquals(role, anotherBeliefsAboutAgent.role);

            bool statusEquals          = (isAlive == anotherBeliefsAboutAgent.isAlive);
            bool statusReferenceEquals = object.ReferenceEquals(isAlive, anotherBeliefsAboutAgent.isAlive);

            bool inLocationEquals          = inLocation.Equals(anotherBeliefsAboutAgent.inLocation);
            bool inLocationReferenceEquals = object.ReferenceEquals(inLocation, anotherBeliefsAboutAgent.inLocation);

            bool angryAtEquals          = angryAt.Equals(anotherBeliefsAboutAgent.angryAt);
            bool angryAtReferenceEquals = object.ReferenceEquals(angryAt, anotherBeliefsAboutAgent.angryAt);

            bool infoGlobal       = infoEquals || infoReferenceEquals;
            bool roleGlobal       = roleEquals || roleReferenceEquals;
            bool statusGlobal     = statusEquals || statusReferenceEquals;
            bool inLocationGlobal = inLocationEquals || inLocationReferenceEquals;
            bool angryAtGlobal    = angryAtEquals || angryAtReferenceEquals;

            bool equal = infoGlobal && roleGlobal && statusGlobal && inLocationGlobal && angryAtGlobal;

            return(equal);
        }
        public bool Equals(AgentAngryAt anotherAngryAt)
        {
            if (anotherAngryAt == null)
            {
                return(false);
            }

            bool angryEquals          = (angry == anotherAngryAt.angry);
            bool angryReferenceEquals = object.ReferenceEquals(angry, anotherAngryAt.angry);

            bool objectOfAngryEquals;
            bool objectOfAngryReferenceEquals;

            if (objectOfAngry == null && anotherAngryAt.objectOfAngry == null)
            {
                objectOfAngryEquals          = true;
                objectOfAngryReferenceEquals = true;
            }
            else
            {
                objectOfAngryEquals          = objectOfAngry.Equals(anotherAngryAt.objectOfAngry);
                objectOfAngryReferenceEquals = object.ReferenceEquals(objectOfAngry, anotherAngryAt.objectOfAngry);
            }

            bool angryGlobal         = angryEquals || angryReferenceEquals;
            bool objectOfAngryGlobal = objectOfAngryEquals || objectOfAngryReferenceEquals;

            bool equal = angryGlobal && objectOfAngryGlobal;

            return(equal);
        }
Exemplo n.º 3
0
        public bool Equals(TalkingWith anotherTalkingWith)
        {
            if (anotherTalkingWith == null)
            {
                return(false);
            }

            bool talkingEquals          = (talking == anotherTalkingWith.talking);
            bool talkingReferenceEquals = object.ReferenceEquals(talking, anotherTalkingWith.talking);

            bool interlocutorEquals;
            bool interlocutorReferenceEquals;

            if (interlocutor == null && anotherTalkingWith.interlocutor == null)
            {
                interlocutorEquals          = true;
                interlocutorReferenceEquals = true;
            }
            else
            {
                interlocutorEquals          = interlocutor.Equals(anotherTalkingWith.interlocutor);
                interlocutorReferenceEquals = object.ReferenceEquals(interlocutor, anotherTalkingWith.interlocutor);
            }

            bool talkingGlobal      = talkingEquals || talkingReferenceEquals;
            bool interlocutorGlobal = interlocutorEquals || interlocutorReferenceEquals;

            bool equal = talkingGlobal && interlocutorGlobal;

            return(equal);
        }
        public bool Equals(WantToEntrap anotherWantToEntrap)
        {
            if (anotherWantToEntrap == null)
            {
                return(false);
            }

            bool entrapingEquals          = (entraping == anotherWantToEntrap.entraping);
            bool entrapingReferenceEquals = object.ReferenceEquals(entraping, anotherWantToEntrap.entraping);

            bool whomEquals;
            bool whomReferenceEquals;

            if (whom == null && anotherWantToEntrap.whom == null)
            {
                whomEquals          = true;
                whomReferenceEquals = true;
            }
            else
            {
                whomEquals          = whom.Equals(anotherWantToEntrap.whom);
                whomReferenceEquals = object.ReferenceEquals(whom, anotherWantToEntrap.whom);
            }

            bool whereEquals;
            bool whereReferenceEquals;

            if (where == null && anotherWantToEntrap.where == null)
            {
                whereEquals          = true;
                whereReferenceEquals = true;
            }
            else
            {
                whereEquals          = where.Equals(anotherWantToEntrap.where);
                whereReferenceEquals = object.ReferenceEquals(where, anotherWantToEntrap.where);
            }

            bool entrapingGlobal = entrapingEquals || entrapingReferenceEquals;
            bool whomGlobal      = whomEquals || whomReferenceEquals;
            bool whereGlobal     = whereEquals || whereReferenceEquals;

            bool equal = entrapingGlobal && whomGlobal && whereGlobal;

            return(equal);
        }
Exemplo n.º 5
0
        public bool Equals(AgentFoundEvidence anotherAgentFoundEvidence)
        {
            if (anotherAgentFoundEvidence == null)
            {
                return(false);
            }

            bool foundEvidenceEquals          = foundEvidence.Equals(anotherAgentFoundEvidence.foundEvidence);
            bool foundEvidenceReferenceEquals = object.ReferenceEquals(foundEvidence, anotherAgentFoundEvidence.foundEvidence);

            bool evidenceAgainstEquals;
            bool evidenceAgainstReferenceEquals;

            if (evidenceAgainst == null && anotherAgentFoundEvidence.evidenceAgainst == null)
            {
                evidenceAgainstEquals          = true;
                evidenceAgainstReferenceEquals = true;
            }
            else if (evidenceAgainst == null && anotherAgentFoundEvidence.evidenceAgainst != null)
            {
                evidenceAgainstEquals          = false;
                evidenceAgainstReferenceEquals = false;
            }
            else
            {
                evidenceAgainstEquals          = evidenceAgainst.Equals(anotherAgentFoundEvidence.evidenceAgainst);
                evidenceAgainstReferenceEquals = object.ReferenceEquals(evidenceAgainst, anotherAgentFoundEvidence.evidenceAgainst);
            }

            bool foundEvidenceGlobal   = foundEvidenceEquals || foundEvidenceReferenceEquals;
            bool evidenceAgainstGlobal = evidenceAgainstEquals || evidenceAgainstReferenceEquals;

            bool equal = foundEvidenceGlobal && evidenceAgainstGlobal;

            return(equal);
        }
Exemplo n.º 6
0
        public bool Equals(AgentStateDynamic anotherState)
        {
            if (anotherState == null)
            {
                return(false);
            }

            bool agentInfoEquals          = agentInfo.Equals(anotherState.agentInfo);
            bool agentInfoReferenceEquals = object.ReferenceEquals(agentInfo, anotherState.agentInfo);

            bool statusEquals          = (alive == anotherState.alive);
            bool statusReferenceEquals = object.ReferenceEquals(alive, anotherState.alive);

            bool goalsEquals          = myGoals.Equals(anotherState.myGoals);
            bool goalsReferenceEquals = object.ReferenceEquals(myGoals, anotherState.myGoals);

            bool initiativeEquals          = (initiative == anotherState.initiative);
            bool initiativeReferenceEquals = object.ReferenceEquals(initiative, anotherState.initiative);

            bool scaredEquals          = (scared == anotherState.scared);
            bool scaredReferenceEquals = object.ReferenceEquals(scared, anotherState.scared);

            bool angryAtEquals          = angryAt.Equals(anotherState.angryAt);
            bool angryAtReferenceEquals = object.ReferenceEquals(angryAt, anotherState.angryAt);

            bool wantsToGoEquals;
            bool wantsToGoReferenceEquals;

            if (wantsToGo == null && anotherState.wantsToGo == null)
            {
                wantsToGoEquals          = true;
                wantsToGoReferenceEquals = true;
            }
            else
            {
                wantsToGoEquals          = wantsToGo.Equals(anotherState.wantsToGo);
                wantsToGoReferenceEquals = object.ReferenceEquals(wantsToGo, anotherState.wantsToGo);
            }

            bool wantToEntrapEquals          = wantToEntrap.Equals(anotherState.wantToEntrap);
            bool wantToEntrapReferenceEquals = object.ReferenceEquals(wantToEntrap, anotherState.wantToEntrap);

            bool talkingWithEquals          = talkingWith.Equals(anotherState.talkingWith);
            bool talkingWithReferenceEquals = object.ReferenceEquals(talkingWith, anotherState.talkingWith);

            bool skipedTurnsEquals          = (skipedTurns == anotherState.skipedTurns);
            bool skipedTurnsReferenceEquals = object.ReferenceEquals(skipedTurns, anotherState.skipedTurns);

            bool beliefsEquals          = beliefs.Equals(anotherState.beliefs);
            bool beliefsReferenceEquals = object.ReferenceEquals(beliefs, anotherState.beliefs);

            bool foundEvidenceEquals          = foundEvidence.Equals(anotherState.foundEvidence);
            bool foundEvidenceReferenceEquals = object.ReferenceEquals(foundEvidence, anotherState.foundEvidence);

            bool exploredRoomsEquals          = true;
            bool exploredRoomsReferenceEquals = true;

            if (exploredRooms.Count == anotherState.exploredRooms.Count)
            {
                for (int i = 0; i < exploredRooms.Count; i++)
                {
                    if (!exploredRooms.ElementAt(i).Equals(anotherState.exploredRooms.ElementAt(i)))
                    {
                        exploredRoomsEquals = false;
                    }
                    if (!object.ReferenceEquals(exploredRooms.ElementAt(i), anotherState.exploredRooms.ElementAt(i)))
                    {
                        exploredRoomsReferenceEquals = false;
                    }
                }
            }
            else
            {
                exploredRoomsEquals          = false;
                exploredRoomsReferenceEquals = false;
            }

            bool agentInfoGlobal     = agentInfoEquals || agentInfoReferenceEquals;
            bool statusGlobal        = statusEquals || statusReferenceEquals;
            bool goalsGlobal         = goalsEquals || goalsReferenceEquals;
            bool initiativeGlobal    = initiativeEquals || initiativeReferenceEquals;
            bool scaredGlobal        = scaredEquals || scaredReferenceEquals;
            bool angryAtGlobal       = angryAtEquals || angryAtReferenceEquals;
            bool wantToGoGlobal      = wantsToGoEquals || wantsToGoReferenceEquals;
            bool wantToEntrapGlobal  = wantToEntrapEquals || wantToEntrapReferenceEquals;
            bool talkingWithGlobal   = talkingWithEquals || talkingWithReferenceEquals;
            bool skipedTurnsGlobal   = skipedTurnsEquals || skipedTurnsReferenceEquals;
            bool beliefsGlobal       = beliefsEquals || beliefsReferenceEquals;
            bool foundEvidenceGlobal = foundEvidenceEquals || foundEvidenceReferenceEquals;
            bool exploredRoomsGlobal = exploredRoomsEquals || exploredRoomsReferenceEquals;

            bool equal = agentInfoGlobal && statusGlobal && goalsGlobal && initiativeGlobal && scaredGlobal && angryAtGlobal && wantToGoGlobal &&
                         wantToEntrapGlobal && talkingWithGlobal && skipedTurnsGlobal && beliefsGlobal && foundEvidenceGlobal && exploredRoomsGlobal;

            return(equal);
        }