|
From: Michael D. <mik...@us...> - 2004-04-08 21:24:45
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13890/Collection Modified Files: SortedSet.cs Log Message: minor mods with SortedSet - removed a ctor and made property Comparer read only because SortedList does not have a way to change the Comparer after being initialized. Index: SortedSet.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/SortedSet.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SortedSet.cs 10 Feb 2004 18:28:50 -0000 1.2 --- SortedSet.cs 8 Apr 2004 21:11:33 -0000 1.3 *************** *** 35,39 **** public IComparer Comparer { get { return comparer;} ! set { comparer = value;} } --- 35,39 ---- public IComparer Comparer { get { return comparer;} ! //set { comparer = value;} } *************** *** 43,61 **** } ! public SortedSet(ISessionImplementor session) : base(session) { ! } ! //TODO: think about not implementing this because in .NET the comparer is a protected ! // property - not a public get/set pair like in Java... ! // Added the IComparer property because of this. ! public SortedSet(ISessionImplementor session, IDictionary map, IComparer comparer) : base(session, new SortedList(map, comparer)) { this.comparer = comparer; } ! public SortedSet(ISessionImplementor session, CollectionPersister persister, IComparer comparer, object disassembled, object owner) : this(session) { this.comparer = comparer; BeforeInitialize(persister); object[] array = (object[])disassembled; ! for(int i = 0; i < array.Length; i++) { object newObject = persister.ElementType.Assemble(array[i], session, owner); map.Add(newObject, newObject); --- 43,79 ---- } ! // changed the Comparer to a readonly property because you can't change it on SortedList after ! // it has been created - so there is no point in being able to change it on this class. ! // public SortedSet(ISessionImplementor session) : base(session) ! // { ! // } ! /// <summary> ! /// Constuct a new empty SortedSet ! /// </summary> ! /// <param name="session"></param> ! /// <param name="comparer"></param> ! public SortedSet(ISessionImplementor session, IComparer comparer) : base(session, new SortedList(comparer)) ! { this.comparer = comparer; } ! /// <summary> ! /// Construct a new SortedSet initialized with the map values. ! /// </summary> ! /// <param name="session">The Session to be bound to.</param> ! /// <param name="map">The initial values.</param> ! /// <param name="comparer">The IComparer to use for Sorting.</param> ! public SortedSet(ISessionImplementor session, IDictionary map, IComparer comparer) : base(session, new SortedList(map, comparer)) ! { this.comparer = comparer; + } + + public SortedSet(ISessionImplementor session, CollectionPersister persister, IComparer comparer, object disassembled, object owner) : this(session, comparer) + { BeforeInitialize(persister); object[] array = (object[])disassembled; ! for(int i = 0; i < array.Length; i++) ! { object newObject = persister.ElementType.Assemble(array[i], session, owner); map.Add(newObject, newObject); |