protected override Tree ShallowCloneInternal(Tree tree) { Db4objects.Db4o.Foundation.TreeString ts = (Db4objects.Db4o.Foundation.TreeString )base.ShallowCloneInternal(tree); ts._key = _key; return(ts); }
private void PrintStats(IObjectContainer con, string filename) { Tree unavailable = new TreeString(Remove); Tree noConstructor = new TreeString(Remove); // one element too many, substract one in the end IStoredClass[] internalClasses = con.Ext().StoredClasses(); for (int i = 0; i < internalClasses.Length; i++) { string internalClassName = internalClasses[i].GetName(); Type clazz = ReflectPlatform.ForName(internalClassName); if (clazz == null) { unavailable = unavailable.Add(new TreeString(internalClassName)); } else { if (!CanCallConstructor(internalClassName)) { noConstructor = noConstructor.Add(new TreeString(internalClassName)); } } } unavailable = unavailable.RemoveLike(new TreeString(Remove)); noConstructor = noConstructor.RemoveLike(new TreeString(Remove)); if (unavailable != null) { PrintHeader("UNAVAILABLE"); unavailable.Traverse(new _IVisitor4_80()); } if (noConstructor != null) { PrintHeader("NO PUBLIC CONSTRUCTOR"); noConstructor.Traverse(new _IVisitor4_88()); } PrintHeader("CLASSES"); Sharpen.Runtime.Out.WriteLine("Number of objects per class:"); ByRef ids = ByRef.NewInstance(new TreeInt(0)); if (internalClasses.Length > 0) { Tree all = new TreeStringObject(internalClasses[0].GetName(), internalClasses[0]); for (int i = 1; i < internalClasses.Length; i++) { all = all.Add(new TreeStringObject(internalClasses[i].GetName(), internalClasses[ i])); } all.Traverse(new _IVisitor4_107(ids)); } PrintHeader("SUMMARY"); Sharpen.Runtime.Out.WriteLine("File: " + filename); Sharpen.Runtime.Out.WriteLine("Stored classes: " + internalClasses.Length); if (unavailable != null) { Sharpen.Runtime.Out.WriteLine("Unavailable classes: " + unavailable.Size()); } if (noConstructor != null) { Sharpen.Runtime.Out.WriteLine("Classes without public constructors: " + noConstructor .Size()); } Sharpen.Runtime.Out.WriteLine("Total number of objects: " + (((Tree)ids.value).Size () - 1)); }