Ejemplo n.º 1
0
 public static ISet BuildHierarchy(ClassMetadataRepository repository
     )
 {
     var classIter = repository.Iterator();
     IDictionary nodes = new Hashtable();
     ISet roots = new HashSet();
     while (classIter.MoveNext())
     {
         var clazz = classIter.CurrentClass();
         var node = new ClassNode
             (clazz);
         nodes[clazz.GetName()] = node;
         if (clazz.GetAncestor() == null)
         {
             roots.Add(node);
         }
     }
     for (var nodeIter = nodes.Values.GetEnumerator(); nodeIter.MoveNext();)
     {
         var node = ((ClassNode)
             nodeIter.Current);
         var ancestor = node.ClassMetadata().GetAncestor
             ();
         if (ancestor != null)
         {
             ((ClassNode) nodes[ancestor.GetName()]).AddSubClass(node
                 );
         }
     }
     return roots;
 }
Ejemplo n.º 2
0
		private long CollectClassStats(FileUsageStats stats, ClassNode classNode)
		{
			long subClassSlotUsage = 0;
			for (IEnumerator curSubClassIter = classNode.SubClasses().GetEnumerator(); curSubClassIter
				.MoveNext(); )
			{
				ClassNode curSubClass = ((ClassNode)curSubClassIter.Current);
				subClassSlotUsage += CollectClassStats(stats, curSubClass);
			}
			ClassMetadata clazz = classNode.ClassMetadata();
			long classIndexUsage = 0;
			if (clazz.HasClassIndex())
			{
				classIndexUsage = BTreeUsage(((BTreeClassIndexStrategy)clazz.Index()).Btree());
			}
			long fieldIndexUsage = FieldIndexUsage(clazz);
			FileUsageStatsCollector.InstanceUsage instanceUsage = ClassSlotUsage(clazz);
			long totalSlotUsage = instanceUsage.slotUsage;
			long ownSlotUsage = totalSlotUsage - subClassSlotUsage;
			ClassUsageStats classStats = new ClassUsageStats(clazz.GetName(), ownSlotUsage, classIndexUsage
				, fieldIndexUsage, instanceUsage.miscUsage);
			stats.AddClassStats(classStats);
			return totalSlotUsage;
		}
Ejemplo n.º 3
0
 internal virtual void AddSubClass(ClassNode node)
 {
     _subClasses.Add(node);
 }
Ejemplo n.º 4
0
 internal virtual void AddSubClass(ClassNode node)
 {
     _subClasses.Add(node);
 }