-
Notifications
You must be signed in to change notification settings - Fork 0
/
CrystallineControlPathParentChildrenCollection.cs
143 lines (123 loc) · 4.35 KB
/
CrystallineControlPathParentChildrenCollection.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*****************************************************************************
* *
* CrystallineControlPathParentChildrenCollection.cs *
* 14 January 2008 *
* Project: Crystalline *
* Written by: Richard Sartor *
* Copyright © 2008 Metaphysics Industries, Inc. *
* *
* Auto-generated by buildinterlinking4.pl on 9 December 2008. *
* *
* An unordered collection of Path objects, based on an existing *
* CrystallineControlEntityParentChildrenCollection collection. *
* *
*****************************************************************************/
using System;
using System.Collections.Generic;
using MetaphysicsIndustries.Collections;
namespace MetaphysicsIndustries.Crystalline
{
public class CrystallineControlPathParentChildrenCollection : ICollection<Path>, IDisposable
{
public CrystallineControlPathParentChildrenCollection(CrystallineControlEntityParentChildrenCollection parentInterlinking)
{
if (parentInterlinking == null) { throw new ArgumentNullException("parentInterlinking"); }
_parentInterlinking = parentInterlinking;
}
public virtual void Dispose()
{
Clear();
}
public void AddRange(params Path[] items)
{
AddRange((IEnumerable<Path>)items);
}
public void AddRange<T>(IEnumerable<T> items)
where T : Path
{
foreach (T item in items)
{
Add(item);
}
}
public void RemoveRange(params Path[] items)
{
RemoveRange((IEnumerable<Path>)items);
}
public void RemoveRange<T>(IEnumerable<T> items)
where T : Path
{
foreach (T item in items)
{
Remove(item);
}
}
//ICollection<Path>
public virtual void Add(Path item)
{
if (!Contains(item))
{
_count++;
}
_parentInterlinking.Add(item);
}
public virtual bool Contains(Path item)
{
return _parentInterlinking.Contains(item);
}
public virtual bool Remove(Path item)
{
if (Contains(item))
{
_count--;
item.From = null;
item.To = null;
}
return _parentInterlinking.Remove(item);
}
public virtual void Clear()
{
Path[] array = new Path[Count];
CopyTo(array, 0);
foreach (Path item in array)
{
Remove(item);
}
}
public virtual void CopyTo(Path[] array, int arrayIndex)
{
List<Path> list = new List<Path>(Count);
foreach (Path item in this)
{
list.Add(item);
}
list.CopyTo(array, arrayIndex);
}
public virtual IEnumerator<Path> GetEnumerator()
{
foreach (object item in _parentInterlinking)
{
if (item is Path)
{
yield return (Path)item;
}
}
yield break;
}
//ICollection<Path>
public virtual int Count
{
get { return _count; }
}
public virtual bool IsReadOnly
{
get { return _parentInterlinking.IsReadOnly; }
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
private CrystallineControlEntityParentChildrenCollection _parentInterlinking;
private int _count = 0;
}
}