コード例 #1
0
        public static CMEquivalenceClassUI getEquivTest()
        {
            CMEquivalenceClassUI eq1 = new CMEquivalenceClassUI();

            //eq1.EquivalenceClassId = 1;
            ////eq1.Name = "equ1";
            //eq1.StateId = 0;
            //eq1.Value = "valor1";
            //eq1.RiskLevel = 10;
            //eq1.Description = "Test equivalenceClass";

            //CMEffectUI ef1 = new CMEffectUI();
            //CMEffectUI ef2 = new CMEffectUI();

            //ef1.EffectId = "1";
            //ef1.EffectName = "effec1";
            //ef1.Description = "description1";
            //ef1.State = "0";
            //ef1.Value = "value1";
            //ef1.RiskLevel = 1;

            //ef2.EffectId = "2";
            //ef2.EffectName = "effec2";
            //ef2.Description = "description2";
            //ef2.State = "0";
            //ef2.Value = "value2";
            //ef2.RiskLevel = 2;


            //eq1.addEffect(ef1);
            //eq1.addEffect(ef2);

            return(eq1);
        }
コード例 #2
0
        public void copyFromClone(CMEquivalenceClassCollectionUI __clonedList)
        {
            //remove deleted eq. classes
            foreach (CMEquivalenceClassUI ecClonned in __clonedList.getRemovedEquivalenceClasses())
            {
                CMEquivalenceClassUI eq = FindByID(ecClonned.EquivalenceClassId);
                Remove(eq);
            }

            //Modify equivalence classes masks
            foreach (CMEquivalenceClassUI eq in List)
            {
                CMEquivalenceClassUI eqCloned = __clonedList.FindByID(eq.EquivalenceClassId);
                eq.copyFromClone(eqCloned);
            }

            //add new eq. classes
            foreach (CMEquivalenceClassUI ecClonned in __clonedList.getAddedEquivalenceClasses())
            {
                CMEquivalenceClassUI newEq = new CMEquivalenceClassUI(_parentObject, ecClonned);
            }

            //delete the list from the cloned
            __clonedList.clearListAddRemove();
        }
コード例 #3
0
 public void copyAttributesFrom(CMEquivalenceClassUI __eqFrom)
 {
     StateId     = __eqFrom.StateId;
     Value       = __eqFrom.Value;
     Description = __eqFrom.Description;
     RiskLevel   = __eqFrom.RiskLevel;
     isMarked    = __eqFrom.isMarked;
 }
コード例 #4
0
 public Boolean existEquivalence(CMEquivalenceClassUI eq)
 {
     foreach (CMEquivalenceClassUI e in InnerList)
     {
         if (e.Equals(eq))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #5
0
 public void Remove(CMEquivalenceClassUI eq)
 {
     List.Remove(eq);
     _RemovedEqClassList.Add(eq);
     if (_parentObject != null)
     {
         Element el = _parentObject.getRealObject() as Element;
         if (el != null)
         {
             el.RemoveEquivalenceClass(eq.getRealObject() as EquivalenceClass);
         }
     }
 }
コード例 #6
0
        public CMEquivalenceClassUI Clone(CMElementUI __ElementParent)
        {
            CMEquivalenceClassUI cloneEquivalence = newClone(__ElementParent);

            cloneEquivalence.EquivalenceClassId = EquivalenceClassId;
            cloneEquivalence.copyAttributesFrom(this);

            //foreach (CMEffectUI ef in Effects) {
            //    CMEffectUI newEf = ef.Clone();
            //    cloneEquivalence.addEffect(newEf);
            //}
            return(cloneEquivalence);
        }
コード例 #7
0
        public void Add(CMEquivalenceClassUI __eqClassMask)
        {
            //verify if exist!
            if (!existEquivalence(__eqClassMask))
            {
                __eqClassMask.Owner = this;
                List.Add(__eqClassMask);
            }

            _AddedEqClassList.Add(__eqClassMask);
            //if (_parentObject != null) {
            //    Element el = _parentObject.getRealObject() as Element;
            //    if (el != null)
            //        el.AddEquivalenceClass(__eqClassMask.getRealObject() as EquivalenceClass);
            //}
        }
コード例 #8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="__listEquivalenceClasses"></param>
 /// <param name="__element"></param>
 public CMEquivalenceClassCollectionUI(IList <EquivalenceClass> __listEquivalenceClasses, CMElementUI __element)
 {
     _parentObject             = __element;
     _AddedEqClassList         = new List <CMEquivalenceClassUI>();
     _RemovedEqClassList       = new List <CMEquivalenceClassUI>();
     _equivalenceClassListReal = __listEquivalenceClasses;
     if (__listEquivalenceClasses.Count > 0)
     {
         foreach (EquivalenceClass equivalenceClass in __listEquivalenceClasses)
         {
             CMEquivalenceClassUI eq = new CMEquivalenceClassUI(equivalenceClass);
             eq.parentElement = __element;
             eq.Owner         = this;
             List.Add(eq);
         }
     }
 }
コード例 #9
0
        public void copyFromClone(CMEquivalenceClassUI __ClonedEqClass)
        {
            if (!__ClonedEqClass.EquivalenceClassId.Equals(EquivalenceClassId))
            {
                throw new Exception("The cloned element do not correspond to the target.");
            }


            /*Copy attributes*/
            StateId     = __ClonedEqClass.StateId;
            Value       = __ClonedEqClass.Value;
            Description = __ClonedEqClass.Description;
            RiskLevel   = __ClonedEqClass.RiskLevel;

            /*Copy Effects*/
            //Effects.Copy(__ClonedEqClass.Effects);
        }
コード例 #10
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (GetType() != obj.GetType())
            {
                return(false);
            }
            // safe because of the GetType check
            CMEquivalenceClassUI eq = (CMEquivalenceClassUI)obj;

            // use this pattern to compare value members
            if (!EquivalenceClassId.Equals(eq.EquivalenceClassId))
            {
                return(false);
            }
            return(true);
        }
コード例 #11
0
 public CMEquivalenceClassUI(CMElementUI __maskElement, CMEquivalenceClassUI __eqClass)
 {
     _equivalenceClassReal = new EquivalenceClass(__maskElement.getRealObject() as Element);
     __maskElement.addEquivalenceClass(this);
     copyAttributesFrom(__eqClass);
 }
コード例 #12
0
        private CMEquivalenceClassUI newClone(CMElementUI __ElementParent)
        {
            CMEquivalenceClassUI cloneEquivalence = new CMEquivalenceClassUI(__ElementParent);

            return(cloneEquivalence);
        }