Exemplo n.º 1
0
        /// <summary>
        /// 지정된 key와 일치하는 자료에 대해 입력된 자료를 추가 합니다.
        /// </summary>
        /// <param name="list"></param>
        /// <param name="key"></param>
        /// <param name="overwrite"></param>
        /// <returns></returns>
        public AZList Merge(AZList list, string key, bool overwrite = false)
        {
            var rtnVal =
                from src in this
                from tgt in list
                .Where(row => row.Get(key).Equals(src.Get(key)))
                .DefaultIfEmpty()
                select tgt == null ? src : src.Merge(tgt, overwrite);

            return(rtnVal.ToAZList());

            /*
             * for (int i=0; i<Size(); i++) {
             * AZData src = Get(i);
             * if (src.HasKey(key)) {
             *  for (int k=0; k<list.Size(); k++) {
             *    AZData tgt = list.Get(k);
             *    if (tgt.HasKey(key)) {
             *      if (src.Get(key) == tgt.Get(key)) {
             *        src.Merge(tgt, overwrite);
             *        break;
             *      }
             *    }
             *  }
             * }
             * }
             * return this;
             */
        }
Exemplo n.º 2
0
 /// <summary>AZList 자료의 모든 AZData 자료를 추가</summary>
 /// <param name="list">AZList, 추가할 AZList 자료</param>
 public AZList Add(AZList list)
 {
     for (int cnti = 0; cnti < list.Size(); cnti++)
     {
         this.Add(list.Get(cnti));
     }
     return(this);
 }
Exemplo n.º 3
0
        /// <summary>모든 AZData 중 Name값이 설정되고, Name값이 지정된 Name값과 일치하는 자료의 목록을 반환</summary>
        /// <param name="name">string, </param>
        public AZList Get(string name)
        {
            AZList rtnValue = new AZList();

            for (int cnti = 0; cnti < this.list.Count; cnti++)
            {
                if (Get(cnti).Name != null && Get(cnti).Name.Equals(name))
                {
                    rtnValue.Add(Get(cnti));
                }
            }
            return(rtnValue);
        }
Exemplo n.º 4
0
        /// <summary></summary>
        public AZList GetList(int start_index, int length)
        {
            if (start_index < 0 || length < 1 || start_index >= Size())
            {
                throw new Exception("start_index or length value is invalid");
            }
            int end_index = start_index + length;

            if (end_index >= Size())
            {
                end_index = Size();
            }
            //
            AZList rtnValue = new AZList();

            for (int cnti = start_index; cnti < end_index; cnti++)
            {
                rtnValue.Add(Get(cnti));
            }
            return(rtnValue);
        }
Exemplo n.º 5
0
        public AZList Splice(int idx, int length)
        {
            AZList rtnVal = new AZList();

            //
            if (Size() < 1 || length < 1 || idx < 0)
            {
                return(rtnVal);
            }
            int sIdx = idx;
            int eIdx = idx + length <= Size() ? idx + length : Size();

            for (int i = sIdx; i < eIdx; i++)
            {
                if (sIdx < 0 || sIdx >= Size())
                {
                    continue;
                }
                rtnVal.Add(Get(sIdx));
                Remove(sIdx);
            }
            //
            return(rtnVal);
        }