From: Michael D. <mik...@us...> - 2005-02-14 03:35:29
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18205/NHibernate/Collection Modified Files: ArrayHolder.cs Bag.cs CollectionPersister.cs IdentifierBag.cs List.cs Map.cs Set.cs SortedMap.cs SortedSet.cs Log Message: changed ctors to internal reduced number of casts in ArrayHolder with snapshot fields. Index: Bag.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/Bag.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Bag.cs 7 Feb 2005 01:34:40 -0000 1.13 --- Bag.cs 14 Feb 2005 03:35:19 -0000 1.14 *************** *** 22,26 **** /// </summary> /// <param name="session"></param> ! public Bag( ISessionImplementor session ) : base( session ) { } --- 22,26 ---- /// </summary> /// <param name="session"></param> ! internal Bag( ISessionImplementor session ) : base( session ) { } *************** *** 31,35 **** /// <param name="session"></param> /// <param name="coll"></param> ! public Bag( ISessionImplementor session, ICollection coll ) : base( session ) { bag = coll as IList; --- 31,35 ---- /// <param name="session"></param> /// <param name="coll"></param> ! internal Bag( ISessionImplementor session, ICollection coll ) : base( session ) { bag = coll as IList; Index: Map.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/Map.cs,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Map.cs 7 Feb 2005 01:34:40 -0000 1.19 --- Map.cs 14 Feb 2005 03:35:19 -0000 1.20 *************** *** 73,77 **** /// </summary> /// <param name="session">The ISession the Map should be a part of.</param> ! public Map( ISessionImplementor session ) : base( session ) { } --- 73,77 ---- /// </summary> /// <param name="session">The ISession the Map should be a part of.</param> ! internal Map( ISessionImplementor session ) : base( session ) { } *************** *** 82,86 **** /// <param name="session">The ISession the Map should be a part of.</param> /// <param name="map">The IDictionary that contains the initial values.</param> ! public Map( ISessionImplementor session, IDictionary map ) : base( session ) { this.map = map; --- 82,86 ---- /// <param name="session">The ISession the Map should be a part of.</param> /// <param name="map">The IDictionary that contains the initial values.</param> ! internal Map( ISessionImplementor session, IDictionary map ) : base( session ) { this.map = map; Index: List.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/List.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** List.cs 7 Feb 2005 01:34:40 -0000 1.18 --- List.cs 14 Feb 2005 03:35:19 -0000 1.19 *************** *** 70,74 **** /// </summary> /// <param name="session"></param> ! public List( ISessionImplementor session ) : base( session ) { } --- 70,74 ---- /// </summary> /// <param name="session"></param> ! internal List( ISessionImplementor session ) : base( session ) { } *************** *** 79,83 **** /// <param name="session"></param> /// <param name="list"></param> ! public List( ISessionImplementor session, IList list ) : base( session ) { this.list = list; --- 79,83 ---- /// <param name="session"></param> /// <param name="list"></param> ! internal List( ISessionImplementor session, IList list ) : base( session ) { this.list = list; Index: CollectionPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/CollectionPersister.cs,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** CollectionPersister.cs 7 Feb 2005 01:34:40 -0000 1.32 --- CollectionPersister.cs 14 Feb 2005 03:35:19 -0000 1.33 *************** *** 336,340 **** if( sqlWhereStringTemplate != null ) { ! return StringHelper.Replace( sqlWhereStringTemplate, Template.PlaceHolder, alias ); } else --- 336,340 ---- if( sqlWhereStringTemplate != null ) { ! return StringHelper.Replace( sqlWhereStringTemplate, Template.Placeholder, alias ); } else *************** *** 354,358 **** if( sqlOrderByStringTemplate != null ) { ! return StringHelper.Replace( sqlOrderByStringTemplate, Template.PlaceHolder, alias ); } else --- 354,358 ---- if( sqlOrderByStringTemplate != null ) { ! return StringHelper.Replace( sqlOrderByStringTemplate, Template.Placeholder, alias ); } else Index: ArrayHolder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/ArrayHolder.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ArrayHolder.cs 7 Feb 2005 01:34:40 -0000 1.16 --- ArrayHolder.cs 14 Feb 2005 03:35:19 -0000 1.17 *************** *** 14,18 **** public class ArrayHolder : PersistentCollection { ! private static readonly ILog log = LogManager.GetLogger( typeof( PersistentCollection ) ); /// <summary> --- 14,18 ---- public class ArrayHolder : PersistentCollection { ! private static readonly ILog log = LogManager.GetLogger( typeof( ArrayHolder ) ); /// <summary> *************** *** 37,41 **** /// <param name="session"></param> /// <param name="array"></param> ! public ArrayHolder( ISessionImplementor session, object array ) : base( session ) { this.array = (Array) array; --- 37,41 ---- /// <param name="session"></param> /// <param name="array"></param> ! internal ArrayHolder( ISessionImplementor session, object array ) : base( session ) { this.array = (Array) array; *************** *** 116,122 **** public override bool EqualsSnapshot( IType elementType ) { ! object snapshot = GetSnapshot(); ! int xlen = ( ( Array ) snapshot ).Length; ! if( xlen != ( ( Array ) array ).Length ) { return false; --- 116,123 ---- public override bool EqualsSnapshot( IType elementType ) { ! Array snapshot = GetSnapshot() as Array; ! ! int xlen = snapshot.Length; ! if( xlen != array.Length ) { return false; *************** *** 124,128 **** for( int i = 0; i < xlen; i++ ) { ! if( elementType.IsDirty( ( ( Array ) snapshot ).GetValue( i ), ( ( Array ) array ).GetValue( i ), session ) ) { return false; --- 125,129 ---- for( int i = 0; i < xlen; i++ ) { ! if( elementType.IsDirty( snapshot.GetValue( i ), array.GetValue( i ), session ) ) { return false; *************** *** 139,147 **** { //if (array==null) return tempList; ! int length = ( ( Array ) array ).Length; IList list = new ArrayList( length ); for( int i = 0; i < length; i++ ) { ! list.Add( ( ( Array ) array ).GetValue( i ) ); } return list; --- 140,148 ---- { //if (array==null) return tempList; ! int length = array.Length; IList list = new ArrayList( length ); for( int i = 0; i < length; i++ ) { ! list.Add( array.GetValue( i ) ); } return list; *************** *** 280,288 **** public override object Disassemble( CollectionPersister persister ) { ! int length = ( ( Array ) array ).Length; object[ ] result = new object[length]; for( int i = 0; i < length; i++ ) { ! result[ i ] = persister.ElementType.Disassemble( ( ( Array ) array ).GetValue( i ), session ); } return result; --- 281,289 ---- public override object Disassemble( CollectionPersister persister ) { ! int length = array.Length; object[ ] result = new object[length]; for( int i = 0; i < length; i++ ) { ! result[ i ] = persister.ElementType.Disassemble( array.GetValue( i ), session ); } return result; *************** *** 308,314 **** { IList deletes = new ArrayList(); ! object sn = GetSnapshot(); int snSize = ( ( Array ) sn ).Length; ! int arraySize = ( ( Array ) array ).Length; int end; if( snSize > arraySize ) --- 309,315 ---- { IList deletes = new ArrayList(); ! Array sn = GetSnapshot() as Array; int snSize = ( ( Array ) sn ).Length; ! int arraySize = array.Length; int end; if( snSize > arraySize ) *************** *** 326,330 **** for( int i = 0; i < end; i++ ) { ! if( ( ( Array ) array ).GetValue( i ) == null && ( ( Array ) sn ).GetValue( i ) != null ) { deletes.Add( i ); --- 327,331 ---- for( int i = 0; i < end; i++ ) { ! if( array.GetValue( i ) == null && sn.GetValue( i ) != null ) { deletes.Add( i ); *************** *** 343,348 **** public override bool NeedsInserting( object entry, int i, IType elemType ) { ! object sn = GetSnapshot(); ! return ( ( Array ) array ).GetValue( i ) != null && ( i >= ( ( Array ) sn ).Length || ( ( Array ) sn ).GetValue( i ) == null ); } --- 344,349 ---- public override bool NeedsInserting( object entry, int i, IType elemType ) { ! Array sn = GetSnapshot() as Array; ! return array.GetValue( i ) != null && ( i >= sn.Length || sn.GetValue( i ) == null ); } *************** *** 356,364 **** public override bool NeedsUpdating( object entry, int i, IType elemType ) { ! object sn = GetSnapshot(); ! return i < ( ( Array ) sn ).Length && ! ( ( Array ) sn ).GetValue( i ) != null && ! ( ( Array ) array ).GetValue( i ) != null && ! elemType.IsDirty( ( ( Array ) array ).GetValue( i ), ( ( Array ) sn ).GetValue( i ), session ); } --- 357,365 ---- public override bool NeedsUpdating( object entry, int i, IType elemType ) { ! Array sn = GetSnapshot() as Array; ! return i < sn.Length && ! sn.GetValue( i ) != null && ! array.GetValue( i ) != null && ! elemType.IsDirty( array.GetValue( i ), sn.GetValue( i ), session ); } *************** *** 392,396 **** public override void CopyTo( Array array, int index ) { ! ( ( Array ) this.array ).CopyTo( array, index ); } --- 393,397 ---- public override void CopyTo( Array array, int index ) { ! this.array.CopyTo( array, index ); } *************** *** 400,404 **** public override int Count { ! get { return ( ( Array ) array ).Length; } } --- 401,405 ---- public override int Count { ! get { return array.Length; } } *************** *** 409,413 **** public override IEnumerator GetEnumerator() { ! return ( ( Array ) array ).GetEnumerator(); } --- 410,414 ---- public override IEnumerator GetEnumerator() { ! return array.GetEnumerator(); } Index: SortedSet.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/SortedSet.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SortedSet.cs 7 Feb 2005 01:34:40 -0000 1.13 --- SortedSet.cs 14 Feb 2005 03:35:19 -0000 1.14 *************** *** 55,59 **** /// <param name="session"></param> /// <param name="comparer">The IComparer to user for Sorting.</param> ! public SortedSet( ISessionImplementor session, IComparer comparer ) : base( session ) { this.comparer = comparer; --- 55,59 ---- /// <param name="session"></param> /// <param name="comparer">The IComparer to user for Sorting.</param> ! internal SortedSet( ISessionImplementor session, IComparer comparer ) : base( session ) { this.comparer = comparer; *************** *** 66,70 **** /// <param name="map">The initial values.</param> /// <param name="comparer">The IComparer to use for Sorting.</param> ! public SortedSet( ISessionImplementor session, ISet map, IComparer comparer ) : base( session, new Iesi.Collections.SortedSet( map, comparer ) ) { --- 66,70 ---- /// <param name="map">The initial values.</param> /// <param name="comparer">The IComparer to use for Sorting.</param> ! internal SortedSet( ISessionImplementor session, ISet map, IComparer comparer ) : base( session, new Iesi.Collections.SortedSet( map, comparer ) ) { Index: SortedMap.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/SortedMap.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SortedMap.cs 7 Feb 2005 01:34:40 -0000 1.8 --- SortedMap.cs 14 Feb 2005 03:35:19 -0000 1.9 *************** *** 48,52 **** /// </summary> /// <param name="session">The ISession the Map should be a part of.</param> ! public SortedMap( ISessionImplementor session ) : base( session ) { --- 48,52 ---- /// </summary> /// <param name="session">The ISession the Map should be a part of.</param> ! internal SortedMap( ISessionImplementor session ) : base( session ) { *************** *** 58,62 **** /// <param name="session"></param> /// <param name="comparer">The IComparer to user for Sorting.</param> ! public SortedMap( ISessionImplementor session, IComparer comparer ) : base( session ) { --- 58,62 ---- /// <param name="session"></param> /// <param name="comparer">The IComparer to user for Sorting.</param> ! internal SortedMap( ISessionImplementor session, IComparer comparer ) : base( session ) { *************** *** 70,74 **** /// <param name="map">The IDictionary that contains the initial values.</param> /// <param name="comparer">The IComparer to use for Sorting.</param> ! public SortedMap( ISessionImplementor session, IDictionary map, IComparer comparer ) : base( session, new SortedList( map, comparer ) ) { --- 70,74 ---- /// <param name="map">The IDictionary that contains the initial values.</param> /// <param name="comparer">The IComparer to use for Sorting.</param> ! internal SortedMap( ISessionImplementor session, IDictionary map, IComparer comparer ) : base( session, new SortedList( map, comparer ) ) { Index: Set.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/Set.cs,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Set.cs 10 Feb 2005 17:47:59 -0000 1.24 --- Set.cs 14 Feb 2005 03:35:19 -0000 1.25 *************** *** 98,102 **** /// </summary> /// <param name="session"></param> ! public Set( ISessionImplementor session ) : base( session ) { } --- 98,102 ---- /// </summary> /// <param name="session"></param> ! internal Set( ISessionImplementor session ) : base( session ) { } *************** *** 110,114 **** /// Only call this constructor if you consider the map initialized. /// </remarks> ! public Set( ISessionImplementor session, ISet collection ) : base( session ) { internalSet = collection; --- 110,114 ---- /// Only call this constructor if you consider the map initialized. /// </remarks> ! internal Set( ISessionImplementor session, ISet collection ) : base( session ) { internalSet = collection; Index: IdentifierBag.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/IdentifierBag.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** IdentifierBag.cs 7 Feb 2005 01:34:40 -0000 1.8 --- IdentifierBag.cs 14 Feb 2005 03:35:19 -0000 1.9 *************** *** 35,39 **** /// </summary> /// <param name="session"></param> ! public IdentifierBag( ISessionImplementor session ) : base( session ) { } --- 35,39 ---- /// </summary> /// <param name="session"></param> ! internal IdentifierBag( ISessionImplementor session ) : base( session ) { } *************** *** 44,52 **** /// <param name="session"></param> /// <param name="coll"></param> ! public IdentifierBag( ISessionImplementor session, ICollection coll ) : base( session ) { ! if( coll is IList ) { ! values = ( IList ) coll; } else --- 44,54 ---- /// <param name="session"></param> /// <param name="coll"></param> ! internal IdentifierBag( ISessionImplementor session, ICollection coll ) : base( session ) { ! IList list = coll as IList; ! ! if( list!=null ) { ! values = list; } else |