Beispiel #1
0
        /***************************************************/

        // Convert list of integers to CCX format.
        public static List <string> IntsToCCX(IEnumerable <int> ints, bool toCCXIds = false)
        {
            List <int> data = new List <int>(ints);

            if (toCCXIds)
            {
                for (int i = 0; i < data.Count; i++)
                {
                    data[i]++;
                }
            }

            List <string> CCXFormat = new List <string>();

            foreach (List <int> chnk in GuanacoUtil.Chunks(data, 16))
            {
                CCXFormat.Add(string.Join(",", chnk) + ",");
            }

            if (CCXFormat.Count != 0)
            {
                CCXFormat[CCXFormat.Count - 1] = CCXFormat.Last().TrimEnd(',');
            }

            return(CCXFormat);
        }
Beispiel #2
0
        /***************************************************/

        // Convert element information to CCX format.
        public override List <string> ToCCX()
        {
            List <string> ss = new List <string>();
            string        s  = this.CCXId() + ",";

            foreach (List <int> chnk in GuanacoUtil.Chunks(this._nodes.Select(n => n.Id.AsInteger).ToList(), 15))
            {
                foreach (int n in chnk)
                {
                    s += ((n + 1).ToString() + ",");
                }
                ss.Add(s);
                s = string.Empty;
            }

            ss[ss.Count - 1] = ss.Last().TrimEnd(',');
            return(ss);
        }