Beispiel #1
0
        /// <summary>
        /// Creates and defines a link between 2 events and add a reference to both Events
        /// </summary>
        /// <param name="firstEvent">The first Event to link</param>
        /// <param name="secondEvent">The second Event to link</param>
        /// <param name="firstToSecondEventRelationship">The nature of the link</param>
        /// <returns>The new links (2)</returns>
        public List <EventRelationship> CreateLinkBetweenTwoEvents(PastEvent firstEvent, PastEvent secondEvent, EventRelationshipType firstToSecondEventRelationship)
        {
            string description        = string.Empty;
            string reverseDescription = string.Empty;
            EventRelationshipType inverseRelationshipType = EventRelationshipType.Followed;

            switch (firstToSecondEventRelationship)
            {
            case EventRelationshipType.Caused:
                description             = EventRelationshipDescriptions.Caused;
                reverseDescription      = EventRelationshipDescriptions.CausedBy;
                inverseRelationshipType = EventRelationshipType.CausedBy;
                break;

            case EventRelationshipType.CausedBy:
                description             = EventRelationshipDescriptions.CausedBy;
                reverseDescription      = EventRelationshipDescriptions.Caused;
                inverseRelationshipType = EventRelationshipType.Caused;
                break;

            case EventRelationshipType.Followed:
                description             = EventRelationshipDescriptions.Followed;
                reverseDescription      = EventRelationshipDescriptions.Preceded;
                inverseRelationshipType = EventRelationshipType.Preceded;
                break;

            case EventRelationshipType.PartOf:
                description             = EventRelationshipDescriptions.PartOf;
                reverseDescription      = EventRelationshipDescriptions.Included;
                inverseRelationshipType = EventRelationshipType.Included;
                break;

            case EventRelationshipType.Preceded:
                description             = EventRelationshipDescriptions.Preceded;
                reverseDescription      = EventRelationshipDescriptions.Followed;
                inverseRelationshipType = EventRelationshipType.Followed;
                break;
            }

            EventRelationship directRelationship = new EventRelationship(secondEvent, firstToSecondEventRelationship, Guid.NewGuid(), description);

            firstEvent.AddEventLink(directRelationship);

            EventRelationship reverseRelationship = new EventRelationship(firstEvent, inverseRelationshipType, Guid.NewGuid(), reverseDescription);

            secondEvent.AddEventLink(reverseRelationship);

            return(new List <EventRelationship> {
                directRelationship, reverseRelationship
            });
        }
        /// <inheritdoc />
        public override MemoryItem GetInaccurateCopy()
        {
            GameTime.GameTime     started = Started;
            GameTime.GameTime     ended   = Ended;
            EventRelationshipType type    = Type;

            //TODO : Randomize name

            int falsificationCase = RandomValueGenerator.GenerateIntWithMaxValue(4);

            switch (falsificationCase)
            {
            case 1:
                int variance = RandomValueGenerator.GenerateRealWithinValues(-15, 15);
                started?.SetYear(started.GetYear() + variance);
                break;

            case 2:
                int deathVariance = RandomValueGenerator.GenerateRealWithinValues(-15, 15);
                ended?.SetYear(ended.GetYear() + deathVariance);
                break;

            case 3:
                type = (EventRelationshipType)RandomValueGenerator.GenerateIntWithMaxValue(Enum.GetNames(typeof(EventRelationshipType)).Length);
                break;

            case 4:
                type     = (EventRelationshipType)RandomValueGenerator.GenerateIntWithMaxValue(Enum.GetNames(typeof(EventRelationshipType)).Length);
                variance = RandomValueGenerator.GenerateRealWithinValues(-15, 15);
                started?.SetYear(started.GetYear() + variance);
                break;
            }

            var copy = new EventRelationship(LinkedEvent, type, ReferenceId)
            {
                ItemType    = ItemType,
                Description = Description,
                Started     = started,
                Ended       = ended
            };

            return(copy);
        }
Beispiel #3
0
 private EventRelationship(EventRelationshipType type)
 {
     Type = type;
 }
 internal EventRelationship(PastEvent linkedEvent, EventRelationshipType type, Guid referenceId, string description = "") : base(type, referenceId)
 {
     LinkedEvent = linkedEvent;
     Description = description;
     ItemType    = MemoryItemType.EventRelationship;
 }