Esempio n. 1
0
        public object Clone()
        {
            IClustersList TargetClustersList = new IClustersList();

            foreach (ICluster cluster in ClustersList)
            {
                IItemsList TargetCentroidsList = new IItemsList();
                foreach (Item centroid in (IItemsList)cluster.Centroids.Clone())
                {
                    TargetCentroidsList.Add(new Item(centroid.ItemText, (IAttributeList)centroid.AttributeList.Clone(),
                                                     centroid.Distance, centroid.IsCentroid, centroid.Exists));
                }

                IItemsList TargetItemsList = new IItemsList();
                foreach (Item item in (IItemsList)cluster.Items.Clone())
                {
                    TargetItemsList.Add(new Item(item.ItemText, (IAttributeList)item.AttributeList.Clone(),
                                                 item.Distance, item.IsCentroid, item.Exists));
                }

                TargetClustersList.Add(new ICluster((IItemsList)TargetCentroidsList.Clone(),
                                                    (IItemsList)TargetItemsList.Clone()));
            }

            return(TargetClustersList);
        }
Esempio n. 2
0
        public object Clone()
        {
            IItemsList TargetItems = new IItemsList();

            foreach (Item item in ItemsList)
            {
                IAttributeList TargetAttributeList = new IAttributeList();
                foreach (Attribute attrib in item.GetAttributeList())
                {
                    TargetAttributeList.Add(new Attribute(attrib.Name, attrib.Value));
                }

                if (TargetAttributeList.Count() > 0)
                {
                    TargetItems.Add(new Item(item.ItemText, TargetAttributeList,
                                             item.Distance, item.IsCentroid, item.Exists));
                }
            }

            return(TargetItems);
        }
Esempio n. 3
0
        public object Clone()
        {
            IItemsList TargetItemsList     = new IItemsList();
            IItemsList TargetCentroidsList = new IItemsList();
            ICluster   TargetCluster       = (ICluster)this.MemberwiseClone();

            foreach (Item centroid in Centroids)
            {
                TargetCentroidsList.Add(centroid);
            }

            foreach (Item item in Items)
            {
                TargetItemsList.Add(item);
            }

            TargetCluster.Items     = TargetItemsList;
            TargetCluster.Centroids = TargetCentroidsList;

            return(TargetCluster);
        }
Esempio n. 4
0
 public ICluster(IItemsList cnts_list, IItemsList items_list)
 {
     Items     = items_list;
     Centroids = cnts_list;
 }