コード例 #1
0
ファイル: BAG.cs プロジェクト: avjabalpur/ccd-generator
        internal static BAG <T> Parse(LIST <IGraphable> o)
        {
            BAG <T> retVal = new BAG <T>(o);

            retVal.NullFlavor     = o.NullFlavor;
            retVal.ControlActExt  = o.ControlActExt;
            retVal.ControlActRoot = o.ControlActRoot;
            retVal.Flavor         = o.Flavor;
            retVal.UpdateMode     = o.UpdateMode;
            retVal.ValidTimeHigh  = o.ValidTimeHigh;
            retVal.ValidTimeLow   = o.ValidTimeLow;
            return(retVal);
        }
コード例 #2
0
ファイル: BAG.cs プロジェクト: avjabalpur/ccd-generator
 /// <summary>
 /// Determine if this BAG of T equals another BAG of T
 /// </summary>
 /// <remarks>
 /// In this class, you will notice that we use the Find method for each item in this
 /// BAG within the other (ie: we search for an item matching each item in this bag to appear
 /// in the other). This is done because the BAG collection is unordered, so in theory
 /// the following BAGs are equal:
 /// <para>
 ///     { 0, 2, 3, 1 }
 /// </para>
 /// <para>
 /// is equal to { 0, 1, 2, 3 }
 /// </para>
 /// <para>
 /// However two BAGs are not considered equal of the count of items are different, for example:
 /// </para>
 /// <para>
 ///     { 0, 2, 3, 1 }
 /// </para>
 /// <para>
 /// is not equal to { 0, 1, 2, 3, 1 }
 /// </para>
 /// </remarks>
 public bool Equals(BAG <T> other)
 {
     if (other != null)
     {
         bool result = base.Equals((ANY)other);
         foreach (var itm in items)
         {
             result &= itm != null?other.Find(o => o.Equals(itm)) != null : other.Find(o => o == null) != null;
         }
         result &= other.Count == this.Count;
         return(result);
     }
     return(false);
 }