From: Michael D. <mik...@us...> - 2004-09-02 15:07:29
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19639/src/NHibernate/Collection Modified Files: List.cs Map.cs PersistentCollection.cs Set.cs SortedSet.cs Log Message: Removed collection proxies that did not have any use in .net since collection interfaces are diff than java collection interfaces Index: SortedSet.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/SortedSet.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SortedSet.cs 9 Aug 2004 03:11:45 -0000 1.6 --- SortedSet.cs 2 Sep 2004 15:07:19 -0000 1.7 *************** *** 83,91 **** initialized = true; } - - - //TODO: H2.0.3 has an internal class SubSetProxy that inherits from another - // undefined class PersistentCollection.SetProxy - } } --- 83,86 ---- Index: Map.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/Map.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Map.cs 9 Aug 2004 18:33:11 -0000 1.12 --- Map.cs 2 Sep 2004 15:07:19 -0000 1.13 *************** *** 121,125 **** { Read(); ! return new CollectionProxy(this, map.Keys); } } --- 121,125 ---- { Read(); ! return map.Keys; } } *************** *** 129,133 **** { Read(); ! return new CollectionProxy(this, map.Values); } --- 129,133 ---- { Read(); ! return map.Values; } Index: PersistentCollection.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/PersistentCollection.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PersistentCollection.cs 9 Aug 2004 03:11:45 -0000 1.12 --- PersistentCollection.cs 2 Sep 2004 15:07:19 -0000 1.13 *************** *** 318,323 **** } - // In H2.0.3 all of this is underneat the ProxyClasses - public virtual ICollectionSnapshot CollectionSnapshot { --- 318,321 ---- *************** *** 359,709 **** ! ! ! //TODO: H2.0.3 has an IteratorProxy implement Iterator ! //TODO: H2.0.3 has a ListIteratorProxy implements ListIterator ! //TODO: H2.0.3 has an SetProxy implements Set ! ! internal class CollectionProxy : ICollection ! { ! protected PersistentCollection pc; ! private ICollection collection; ! ! public CollectionProxy(PersistentCollection pc, ICollection collection) ! { ! this.pc = pc; ! this.collection = collection; ! } ! ! #region ICollection Members ! ! public bool IsSynchronized ! { ! get{ return false; } ! } ! ! public int Count ! { ! get{return collection.Count;} ! } ! ! public void CopyTo(Array array, int index) ! { ! collection.CopyTo(array, index); ! } ! ! public object SyncRoot ! { ! get{return null;} ! } ! ! #endregion ! ! #region IEnumerable Members ! ! public IEnumerator GetEnumerator() ! { ! return new EnumeratorProxy(collection.GetEnumerator()); ! } ! ! #endregion ! } ! ! ! internal sealed class ListProxy : CollectionProxy, IList ! { ! private IList list; ! ! public ListProxy(PersistentCollection pc, IList list) : base(pc, list) ! { ! this.list = list; ! } ! ! #region IList Members ! ! public bool IsReadOnly ! { ! get { return list.IsReadOnly; } ! } ! ! public object this[int index] ! { ! get { return list[index];} ! set ! { ! pc.Write(); ! list[index] = value; ! } ! } ! ! public void RemoveAt(int index) ! { ! pc.Write(); ! list.RemoveAt(index); ! } ! ! public void Insert(int index, object value) ! { ! pc.Write(); ! list.Insert(index, value); ! } ! ! public void Remove(object value) ! { ! pc.Write(); ! list.Remove(value); ! } ! ! public bool Contains(object value) ! { ! return list.Contains(value); ! } ! ! public void Clear() ! { ! pc.Write(); ! list.Clear(); ! } ! ! public int IndexOf(object value) ! { ! return list.IndexOf(value); ! } ! ! public int Add(object value) ! { ! pc.Write(); ! return list.Add(value); ! } ! ! public bool IsFixedSize ! { ! get { return list.IsFixedSize;} ! } ! ! #endregion ! ! } - internal sealed class DictionaryProxy : IDictionary - { - private PersistentCollection pc; - private IDictionary dictionary; - - public DictionaryProxy(PersistentCollection pc, IDictionary dictionary) - { - this.pc = pc; - this.dictionary = dictionary; - } - - #region IDictionary Members - - public bool IsReadOnly - { - get - { - // TODO: Add DictionaryProxy.IsReadOnly getter implementation - return false; - } - } - - public IDictionaryEnumerator GetEnumerator() - { - // TODO: Add DictionaryProxy.GetEnumerator implementation - return null; - } - - public object this[object key] - { - get - { - // TODO: Add DictionaryProxy.this getter implementation - return null; - } - set - { - // TODO: Add DictionaryProxy.this setter implementation - } - } - - public void Remove(object key) - { - // TODO: Add DictionaryProxy.Remove implementation - } - - public bool Contains(object key) - { - // TODO: Add DictionaryProxy.Contains implementation - return false; - } - - public void Clear() - { - // TODO: Add DictionaryProxy.Clear implementation - } - - public ICollection Values - { - get - { - // TODO: Add DictionaryProxy.Values getter implementation - return null; - } - } ! public void Add(object key, object value) ! { ! // TODO: Add DictionaryProxy.Add implementation ! } ! ! public ICollection Keys ! { ! get ! { ! // TODO: Add DictionaryProxy.Keys getter implementation ! return null; ! } ! } ! ! public bool IsFixedSize ! { ! get ! { ! // TODO: Add DictionaryProxy.IsFixedSize getter implementation ! return false; ! } ! } ! ! #endregion ! ! #region ICollection Members ! ! public bool IsSynchronized ! { ! get{ return false; } ! } ! ! public int Count ! { ! get{return dictionary.Count;} ! } ! ! public void CopyTo(Array array, int index) ! { ! dictionary.CopyTo(array, index); ! } ! ! public object SyncRoot ! { ! get{return null;} ! } ! ! #endregion ! ! #region IEnumerable Members ! ! IEnumerator System.Collections.IEnumerable.GetEnumerator() ! { ! // TODO: Add DictionaryProxy.System.Collections.IEnumerable.GetEnumerator implementation ! return null; ! } ! ! #endregion ! } ! ! /// <summary> ! /// ! /// </summary> ! /// <remarks> ! /// I don't know how needed this is because the java.util.Iterator provides methods ! /// to modify the underlying object - such as remove() and set(Object). In .NET ! /// the IEnumerator does not provide any means to modify the underlying collection ! /// while using the IEnumerator interface. ! /// </remarks> ! internal sealed class EnumeratorProxy : IEnumerator ! { ! private IEnumerator en; ! ! public EnumeratorProxy(IEnumerator en) ! { ! this.en = en; ! } ! ! public object Current ! { ! get { return en.Current; } ! } ! ! public bool MoveNext() ! { ! return en.MoveNext(); ! } ! ! public void Reset() ! { ! en.Reset(); ! } ! } ! ! /// <summary> ! /// ! /// </summary> ! /// <remarks> ! /// I don't know how needed this is because the java.util.Iterator provides methods ! /// to modify the underlying object - such as remove() and set(Object). In .NET ! /// the IEnumerator does not provide any means to modify the underlying collection ! /// while using the IEnumerator interface. ! /// </remarks> ! internal sealed class DictionaryEnumeratorProxy : IDictionaryEnumerator ! { ! private IDictionaryEnumerator en; ! ! public DictionaryEnumeratorProxy(IDictionaryEnumerator en) ! { ! this.en = en; ! } ! ! #region IDictionaryEnumerator Members ! ! public object Key ! { ! get{ return en.Key; } ! } ! ! public object Value ! { ! get { return en.Value; } ! } ! ! public DictionaryEntry Entry ! { ! get { return new DictionaryEntry(Key, Value); } ! } ! ! #endregion ! ! #region IEnumerator Members ! ! public void Reset() ! { ! en.Reset(); ! } ! ! public object Current ! { ! get { return en.Current; } ! } ! ! public bool MoveNext() ! { ! return en.MoveNext(); ! } ! ! #endregion ! ! } ! ! } --- 357,371 ---- ! #region - Hibernate Collection Proxy Classes + /* + * These were needed by Hibernate because Java's collections provide methods + * to get sublists, modify a collection with an iterator - all things that + * Hibernate needs to be made aware of. If .net changes their collection interfaces + * then we can readd these back in. + */ ! #endregion } Index: Set.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/Set.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Set.cs 9 Aug 2004 18:33:11 -0000 1.11 --- Set.cs 2 Sep 2004 15:07:19 -0000 1.12 *************** *** 159,163 **** { Read(); ! return new CollectionProxy(this, map.Keys); } } --- 159,163 ---- { Read(); ! return map.Keys; } } *************** *** 171,175 **** { Read(); ! return new CollectionProxy(this, map.Values); } } --- 171,175 ---- { Read(); ! return map.Values; } } Index: List.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/List.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** List.cs 9 Aug 2004 18:33:11 -0000 1.12 --- List.cs 2 Sep 2004 15:07:19 -0000 1.13 *************** *** 98,102 **** public override IEnumerator GetEnumerator() { Read(); ! return new EnumeratorProxy(list.GetEnumerator()); } --- 98,102 ---- public override IEnumerator GetEnumerator() { Read(); ! return list.GetEnumerator(); } |