public List <ClusterLeaf <T> > GetLeafs() { List <ClusterLeaf <T> > leafs = new List <ClusterLeaf <T> >(); for (int i = 0; i < NR_OF_CLUSTERS; i++) { if (childClusters[i] != null) { if (childClusters[i] is ClusterHierarchy <T> ) { ClusterHierarchy <T> h = childClusters[i] as ClusterHierarchy <T>; leafs.AddRange(h.GetLeafs()); } else if (childClusters[i] is ClusterLeaf <T> ) { leafs.Add((ClusterLeaf <T>)childClusters[i]); } } } return(leafs); }