public static Sharpen.Util.ISet BuildHierarchy(ClassMetadataRepository repository ) { ClassMetadataIterator classIter = repository.Iterator(); IDictionary nodes = new Hashtable(); Sharpen.Util.ISet roots = new HashSet(); while (classIter.MoveNext()) { Db4objects.Db4o.Internal.ClassMetadata clazz = classIter.CurrentClass(); Db4objects.Db4o.Filestats.ClassNode node = new Db4objects.Db4o.Filestats.ClassNode (clazz); nodes[clazz.GetName()] = node; if (clazz.GetAncestor() == null) { roots.Add(node); } } for (IEnumerator nodeIter = nodes.Values.GetEnumerator(); nodeIter.MoveNext(); ) { Db4objects.Db4o.Filestats.ClassNode node = ((Db4objects.Db4o.Filestats.ClassNode) nodeIter.Current); Db4objects.Db4o.Internal.ClassMetadata ancestor = node.ClassMetadata().GetAncestor (); if (ancestor != null) { ((Db4objects.Db4o.Filestats.ClassNode)nodes[ancestor.GetName()]).AddSubClass(node ); } } return roots; }
public static Sharpen.Util.ISet BuildHierarchy(ClassMetadataRepository repository ) { ClassMetadataIterator classIter = repository.Iterator(); IDictionary nodes = new Hashtable(); Sharpen.Util.ISet roots = new HashSet(); while (classIter.MoveNext()) { Db4objects.Db4o.Internal.ClassMetadata clazz = classIter.CurrentClass(); Db4objects.Db4o.Filestats.ClassNode node = new Db4objects.Db4o.Filestats.ClassNode (clazz); nodes[clazz.GetName()] = node; if (clazz.GetAncestor() == null) { roots.Add(node); } } for (IEnumerator nodeIter = nodes.Values.GetEnumerator(); nodeIter.MoveNext();) { Db4objects.Db4o.Filestats.ClassNode node = ((Db4objects.Db4o.Filestats.ClassNode) nodeIter.Current); Db4objects.Db4o.Internal.ClassMetadata ancestor = node.ClassMetadata().GetAncestor (); if (ancestor != null) { ((Db4objects.Db4o.Filestats.ClassNode)nodes[ancestor.GetName()]).AddSubClass(node ); } } return(roots); }
internal virtual void AddSubClass(Db4objects.Db4o.Filestats.ClassNode node) { _subClasses.Add(node); }