public void IndexByAllNames()
 {
     NodeFieldReferenceCollection nodes = new NodeFieldReferenceCollection();
     hibernatemapping hm = new hibernatemapping();
     NodeFieldReference field = new NodeFieldReference(hm,
         typeof(hibernatemapping).GetField("Items"),
         new SchemaEditorNodeTestFactory(), new SchemaEditorTestNode("blah", null, null));
     nodes.Add(field);
     Assert.AreSame(field,nodes[typeof(@class)]);
     Assert.AreSame(field,nodes[typeof(@joinedsubclass)]);
 }
 public SchemaEditorTestNode(string name, object val, NodeFieldReference fieldReference)
 {
     this.activeAttributes = new FieldReferenceCollection();
     this.attributes = new FieldReferenceCollection();
     this.nodeFields = new NodeFieldReferenceCollection();
     this.activeNodes = new SchemaEditorNodeCollection();
     this.fieldReference = fieldReference;
     this.name = name;
     this.val = val;
     this.attributesReadOnly = FieldReferenceCollection.ReadOnly(attributes);
     this.activeAttributesReadOnly = FieldReferenceCollection.ReadOnly(activeAttributes);
     this.activeNodesReadOnly = SchemaEditorNodeCollection.ReadOnly(activeNodes);
     this.nodeFieldsReadOnly = NodeFieldReferenceCollection.ReadOnly(nodeFields);
 }
 public WinFormsSchemaEditorNode(SchemaEditorView view,  NodeFieldReference fieldReference, object val, string name)
 {
     this.activeAttributes = new FieldReferenceCollection();
     this.attributes = new FieldReferenceCollection();
     this.nodeFields = new NodeFieldReferenceCollection();
     this.activeNodes = new SchemaEditorNodeCollection();
     this.fieldReference = fieldReference;
     this.view = view;
     this.val = val;
     this.attributesReadOnly = FieldReferenceCollection.ReadOnly(attributes);
     this.activeAttributesReadOnly = FieldReferenceCollection.ReadOnly(activeAttributes);
     this.activeNodesReadOnly = SchemaEditorNodeCollection.ReadOnly(activeNodes);
     this.nodeFieldsReadOnly = NodeFieldReferenceCollection.ReadOnly(nodeFields);
     this.nodeName = name;
     RefreshTitle();
 }
        /// <summary>
        /// Creates a shallow copy of the <see cref="NodeFieldReferenceCollection"/>.
        /// </summary>
        /// <returns>
        /// A shallow copy of the <see cref="NodeFieldReferenceCollection"/>.
        /// </returns>
        /// <remarks>
        /// Please refer to <see cref="ArrayList.Clone"/> for details.
        /// </remarks>
        public virtual object Clone()
        {
            NodeFieldReferenceCollection clone = new NodeFieldReferenceCollection(_data.Count);

            Array.Copy(_data.Items, 0, clone._data.Items, 0, _data.Count);
            clone._data.Count = _data.Count;
            clone._data.IsUnique = _data.IsUnique;

            return clone;
        }
        /// <overloads>
        /// Adds a range of elements to the end of the
        /// <see cref="NodeFieldReferenceCollection"/>.
        /// </overloads>
        /// <summary>
        /// Adds the elements of another collection to the end of the
        /// <see cref="NodeFieldReferenceCollection"/>.
        /// </summary>
        /// <param name="collection">
        /// The <see cref="NodeFieldReferenceCollection"/> whose elements
        /// should be added to the end of the current collection.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="collection"/> is a null reference.</exception>
        /// <exception cref="NotSupportedException"><para>
        /// The <see cref="NodeFieldReferenceCollection"/> 
        /// is read-only or has a fixed size.
        /// </para><para>-or-</para><para>
        /// The <b>NodeFieldReferenceCollection</b> already contains one
        /// or more elements in <paramref name="collection"/>,
        /// and the <b>NodeFieldReferenceCollection</b>
        /// ensures that all elements are unique.
        /// </para></exception>
        /// <remarks>
        /// Please refer to <see cref="ArrayList.AddRange"/> for details.
        /// </remarks>
        public virtual void AddRange(NodeFieldReferenceCollection collection)
        {
            if (collection == null)
                throw new ArgumentNullException("collection");

            AddRange(collection._data.Items, collection.Count);
        }
        /// <summary>
        /// Returns a read-only wrapper for the specified
        /// <see cref="NodeFieldReferenceCollection"/>.
        /// </summary>
        /// <param name="collection">
        /// The <see cref="NodeFieldReferenceCollection"/> to wrap.</param>
        /// <returns>
        /// A read-only wrapper around <paramref name="collection"/>.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="collection"/> is a null reference.</exception>
        /// <remarks>
        /// Please refer to <see cref="ArrayList.ReadOnly"/> for details.
        /// </remarks>
        public static NodeFieldReferenceCollection ReadOnly(NodeFieldReferenceCollection collection)
        {
            if (collection == null)
                throw new ArgumentNullException("collection");

            return new ReadOnlyWrapper(collection._data);
        }
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="NodeFieldReferenceCollection"/> class that
        /// contains elements copied from the specified collection and that
        /// has the same initial capacity as the number of elements copied.
        /// </summary>
        /// <param name="collection">
        /// The <see cref="NodeFieldReferenceCollection"/>
        /// whose elements are copied to the new collection.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="collection"/> is a null reference.</exception>
        /// <remarks>
        /// Please refer to <see cref="ArrayList(ICollection)"/> for details.
        /// </remarks>
        public NodeFieldReferenceCollection(NodeFieldReferenceCollection collection)
        {
            if (collection == null)
                throw new ArgumentNullException("collection");

            _data = new Data();
            _data.Items = new NodeFieldReference[collection.Count];
            AddRange(collection._data.Items, collection.Count);
        }
 public override void AddRange(NodeFieldReferenceCollection collection)
 {
     throw new NotSupportedException("Read-only collections cannot be modified.");
 }