Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6596/src/NHibernate/Collection
Modified Files:
ArrayHolder.cs
Log Message:
synched with h2.0.3
Index: ArrayHolder.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/ArrayHolder.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** ArrayHolder.cs 24 Jun 2004 15:26:12 -0000 1.9
--- ArrayHolder.cs 13 Jul 2004 06:48:47 -0000 1.10
***************
*** 29,33 ****
int length = /*(array==null) ? temp.Count :*/ ((System.Array)array).Length;
object result = System.Array.CreateInstance(persister.ElementClass, length);
! for (int i=0; i<length; i++) {
object elt = /*(array==null) ? temp[i] :*/ ((System.Array)array).GetValue(i);
try
--- 29,34 ----
int length = /*(array==null) ? temp.Count :*/ ((System.Array)array).Length;
object result = System.Array.CreateInstance(persister.ElementClass, length);
! for (int i=0; i<length; i++)
! {
object elt = /*(array==null) ? temp[i] :*/ ((System.Array)array).GetValue(i);
try
***************
*** 55,59 ****
! public ArrayHolder(ISessionImplementor session, CollectionPersister persister) : base(session)
{
elementClass = persister.ElementClass;
--- 56,61 ----
! public ArrayHolder(ISessionImplementor session, CollectionPersister persister)
! : base(session)
{
elementClass = persister.ElementClass;
***************
*** 79,83 ****
public override ICollection Elements()
{
! if (array==null) return tempList;
int length = ((System.Array)array).Length;
IList list = new ArrayList(length);
--- 81,85 ----
public override ICollection Elements()
{
! //if (array==null) return tempList;
int length = ((System.Array)array).Length;
IList list = new ArrayList(length);
***************
*** 162,174 ****
public override object GetInitialValue(bool lazy)
{
- tempList = new ArrayList();
base.GetInitialValue(false);
- array = System.Array.CreateInstance( elementClass, tempList.Count );
- for (int i=0; i<tempList.Count; i++)
- {
- ((System.Array)array).SetValue(tempList[i],i);
- }
session.AddArrayHolder(this);
- tempList=null;
return array;
}
--- 164,169 ----
***************
*** 188,192 ****
}
! public ArrayHolder(ISessionImplementor session, CollectionPersister persister, object disassembled, object owner) : base(session)
{
object[] cached = (object[]) disassembled;
--- 183,188 ----
}
! public ArrayHolder(ISessionImplementor session, CollectionPersister persister, object disassembled, object owner)
! : base(session)
{
object[] cached = (object[]) disassembled;
***************
*** 198,210 ****
((System.Array)array).SetValue( persister.ElementType.Assemble(cached[i], session, owner), i);
}
}
public override object Disassemble(CollectionPersister persister)
{
! int length = tempList.Count;
object[] result = new object[length];
for (int i=0; i<length; i++)
{
! result[i] = persister.ElementType.Disassemble( tempList[i], session);
}
return result;
--- 194,207 ----
((System.Array)array).SetValue( persister.ElementType.Assemble(cached[i], session, owner), i);
}
+ initialized = true;
}
public override object Disassemble(CollectionPersister persister)
{
! int length = ((System.Array)array).Length;
object[] result = new object[length];
for (int i=0; i<length; i++)
{
! result[i] = persister.ElementType.Disassemble( ((System.Array)array).GetValue(i) , session);
}
return result;
***************
*** 235,240 ****
for (int i=0; i<end; i++)
{
! if ( ((System.Array)array).GetValue(i)==null && ((System.Array)sn).GetValue(i)!=null )
deletes.Add( i );
}
return deletes;
--- 232,239 ----
for (int i=0; i<end; i++)
{
! if ( ((System.Array)array).GetValue(i)==null && ((System.Array)sn).GetValue(i)!=null )
! {
deletes.Add( i );
+ }
}
return deletes;
|