Exemple #1
0
        public override void RestoreMemento(RequirementMemento memento)
        {
            if (memento is ComplexRequirementMemento complexMemento)
            {
                myType = complexMemento.myType;

                myRequirements = complexMemento.myRequirements.Select(x => CreateFromMemento(x)).ToList();
            }
        }
 public override void RestoreMemento(RequirementMemento memento)
 {
     if (memento is SimpleRequirementMemento simpleMemento)
     {
         myRepeatCount = simpleMemento.myRepeatCount;
         isInverted    = simpleMemento.isInverted;
         myKeyId       = simpleMemento.myKeyId;
     }
 }
        public static Requirement CreateFromMemento(RequirementMemento memento)
        {
            Requirement newReq = null;

            if (memento is SimpleRequirementMemento)
            {
                newReq = new SimpleRequirement();
            }
            if (memento is ComplexRequirementMemento)
            {
                newReq = new ComplexRequirement();
            }

            if (newReq != null)
            {
                newReq.RestoreMemento(memento);
            }

            return(newReq);
        }
 public abstract void RestoreMemento(RequirementMemento memento);