Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 52463dc

Browse files
committed
Update documentation comments
1 parent 21d3c95 commit 52463dc

32 files changed

+690
-342
lines changed

Runtime/Accumulators/ValueAccumulator.cs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
namespace Zigurous.DataStructures
44
{
5-
/// <summary>Accumulates a set of stored values into a single total value.</summary>
5+
/// <summary>
6+
/// Accumulates a set of stored values into a single total value.
7+
/// </summary>
68
/// <typeparam name="T">The type of value to accumulate.</typeparam>
79
public abstract class ValueAccumulator<T>
810
{
@@ -17,12 +19,15 @@ public abstract class ValueAccumulator<T>
1719
/// </summary>
1820
public T total { get; protected set; }
1921

20-
/// <returns>
22+
/// <summary>
2123
/// The number of unique values being accumulated.
22-
/// </returns>
24+
/// </summary>
2325
public int Count => this.values.Count;
2426

25-
/// <returns>The stored value with the given <paramref name="identifier"/>.</returns>
27+
/// <summary>
28+
/// Returns the stored value with the given <paramref name="identifier"/>,
29+
/// or the default of <typeparamref name="T"/> if the value does not exist.
30+
/// </summary>
2631
/// <param name="id">The identifier of the stored value.</param>
2732
public T GetValue(int identifier)
2833
{
@@ -84,14 +89,18 @@ public void Clear()
8489
this.total = default(T);
8590
}
8691

87-
/// <summary>Increases the accumulated total by a given value.</summary>
88-
/// <returns>The new total value.</returns>
92+
/// <summary>
93+
/// Increases the accumulated total by a given value.
94+
/// </summary>
8995
/// <param name="value">The value to add to the total.</param>
96+
/// <returns>The new total value.</returns>
9097
protected abstract T Add(T value);
9198

92-
/// <summary>Decreases the accumulated total by a given value.</summary>
93-
/// <returns>The new total value.</returns>
99+
/// <summary>
100+
/// Decreases the accumulated total by a given value.
101+
/// </summary>
94102
/// <param name="value">The value to subtract from the total.</param>
103+
/// <returns>The new total value.</returns>
95104
protected abstract T Subtract(T value);
96105

97106
}

Runtime/Bitmask.cs

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,102 +17,122 @@ public struct Bitmask : IEquatable<Bitmask>, IEquatable<int>
1717
[HideInInspector]
1818
private int mask;
1919

20-
/// <summary>Creates a new Bitmask from the given 32-bit integer.</summary>
20+
/// <summary>
21+
/// Creates a new Bitmask from the given 32-bit integer.
22+
/// </summary>
2123
/// <param name="mask">The 32-bit integer to represent as a bitmask.</param>
2224
public Bitmask(int mask)
2325
{
2426
this.mask = mask;
2527
}
2628

27-
/// <returns>
28-
/// True if the bitmask contains the <paramref name="flag"/>.
29+
/// <summary>
30+
/// Checks if the bitmask contains the <paramref name="flag"/>.
2931
/// <code>(mask &amp; flag) == flag</code>
30-
/// </returns>
32+
/// </summary>
3133
/// <param name="flag">The flag to check for.</param>
3234
public bool HasFlag(int flag)
3335
{
3436
return (this.mask & flag) == flag;
3537
}
3638

37-
/// <returns>
38-
/// True if the bitmask contains any of the <paramref name="flags"/>.
39+
/// <summary>
40+
/// Checks if the bitmask contains any of the <paramref name="flags"/>.
3941
/// <code>(mask &amp; flags) != 0</code>
40-
/// </returns>
42+
/// </summary>
4143
/// <param name="flags">The flags to check for.</param>
4244
public bool HasAnyFlag(int flags)
4345
{
4446
return (this.mask & flags) != 0;
4547
}
4648

47-
/// <returns>
48-
/// True if the bitmask contains only the given <paramref name="flags"/>
49+
/// <summary>
50+
/// Checks if the bitmask contains only the given <paramref name="flags"/>
4951
/// and no other flags.
5052
/// <code>((mask ^ flags) &amp; flags) == 0</code>
51-
/// </returns>
53+
/// </summary>
5254
/// <param name="flags">The flags to check for.</param>
5355
public bool HasOnlyFlags(int flags)
5456
{
5557
return ((this.mask ^ flags) & flags) == 0;
5658
}
5759

58-
/// <returns>True if the nth bit of the bitmask is set.</returns>
60+
/// <summary>
61+
/// Checks if the nth bit of the bitmask is set.
62+
/// </summary>
5963
/// <param name="n">The nth bit to check for.</param>
6064
public bool Has(int n)
6165
{
6266
return Get(n) != 0;
6367
}
6468

65-
/// <returns>The nth bit of the bitmask.</returns>
69+
/// <summary>
70+
/// Returns the nth bit of the bitmask.
71+
/// </summary>
6672
/// <param name="n">The nth bit to get.</param>
6773
public int Get(int n)
6874
{
6975
return (this.mask >> n) & 1;
7076
}
7177

72-
/// <summary>Sets the nth bit of the bitmask to 1.</summary>
78+
/// <summary>
79+
/// Sets the nth bit of the bitmask to 1.
80+
/// </summary>
7381
/// <param name="n">The nth bit to set.</param>
7482
public void Set(int n)
7583
{
7684
this.mask |= 1 << n;
7785
}
7886

79-
/// <summary>Sets the nth bit of the bitmask to 0.</summary>
87+
/// <summary>
88+
/// Sets the nth bit of the bitmask to 0.
89+
/// </summary>
8090
/// <param name="n">The nth bit to clear.</param>
8191
public void Clear(int n)
8292
{
8393
this.mask &= ~(1 << n);
8494
}
8595

86-
/// <summary>Toggles the nth bit of the bitmask.</summary>
96+
/// <summary>
97+
/// Toggles the nth bit of the bitmask.
98+
/// </summary>
8799
/// <param name="n">The nth bit to toggle.</param>
88100
public void Toggle(int n)
89101
{
90102
this.mask ^= 1 << n;
91103
}
92104

93-
/// <summary>Sets the nth bit of the bitmask to x.</summary>
105+
/// <summary>
106+
/// Sets the nth bit of the bitmask to x.
107+
/// </summary>
94108
/// <param name="n">The nth bit to set.</param>
95109
/// <param name="x">The value to set the bit to.</param>
96110
public void Change(int n, int x)
97111
{
98112
this.mask = (this.mask & ~(1 << n)) | (x << n);
99113
}
100114

101-
/// <returns>True if the bitmask is equal to the <paramref name="other"/>.</returns>
115+
/// <summary>
116+
/// Determines if the bitmask is equal to <paramref name="other"/>.
117+
/// </summary>
102118
/// <param name="other">The bitmask to compare to.</param>
103119
public bool Equals(Bitmask other)
104120
{
105121
return this.mask == other.mask;
106122
}
107123

108-
/// <returns>True if the bitmask is equal to the <paramref name="other"/>.</returns>
124+
/// <summary>
125+
/// Determines if the bitmask is equal to <paramref name="other"/>.
126+
/// </summary>
109127
/// <param name="other">The bitmask to compare to.</param>
110128
public bool Equals(int other)
111129
{
112130
return this.mask == other;
113131
}
114132

115-
/// <returns>True if the bitmask is equal to the <paramref name="other"/>.</returns>
133+
/// <summary>
134+
/// Determines if the bitmask is equal to <paramref name="other"/>.
135+
/// </summary>
116136
/// <param name="other">The object to compare to.</param>
117137
public override bool Equals(object other)
118138
{
@@ -125,17 +145,18 @@ public override bool Equals(object other)
125145
}
126146
}
127147

128-
/// <returns>
129-
/// The hash code of the bitmask.
130-
/// </returns>
148+
/// <summary>
149+
/// Returns the hash code of the bitmask.
150+
/// </summary>
131151
public override int GetHashCode()
132152
{
133153
return this.mask.GetHashCode();
134154
}
135155

136-
/// <returns>
137-
/// The string representation of the bitmask.
138-
/// </returns>
156+
/// <summary>
157+
/// Converts the bitmask to a string.
158+
/// </summary>
159+
/// <returns>A string representation of the bitmask.</returns>
139160
public override string ToString()
140161
{
141162
string binary = System.Convert.ToString(this.mask, 2);

Runtime/Bool3.cs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ public struct Bool3 : IEquatable<Bool3>
5252
/// </summary>
5353
public static Bool3 Z => new Bool3(false, false, true);
5454

55-
/// <summary>Creates a new Bool3 with the specified values.</summary>
55+
/// <summary>
56+
/// Creates a new Bool3 with the specified values.
57+
/// </summary>
5658
/// <param name="x">The X component.</param>
5759
/// <param name="y">The Y component.</param>
5860
/// <param name="z">The Z component.</param>
@@ -63,7 +65,9 @@ public Bool3(bool x = false, bool y = false, bool z = false)
6365
this.z = z;
6466
}
6567

66-
/// <returns>True if the tuple is equal to the <paramref name="other"/>.</returns>
68+
/// <summary>
69+
/// Determines if the tuple is equal to <paramref name="other"/>.
70+
/// </summary>
6771
/// <param name="other">The tuple to compare to.</param>
6872
public bool Equals(Bool3 other)
6973
{
@@ -72,7 +76,9 @@ public bool Equals(Bool3 other)
7276
this.z == other.z;
7377
}
7478

75-
/// <returns>True if the tuple is equal to the <paramref name="other"/>.</returns>
79+
/// <summary>
80+
/// Determines if the tuple is equal to <paramref name="other"/>.
81+
/// </summary>
7682
/// <param name="other">The object to compare to.</param>
7783
public override bool Equals(object other)
7884
{
@@ -83,17 +89,18 @@ public override bool Equals(object other)
8389
}
8490
}
8591

86-
/// <returns>
87-
/// The hash code of the tuple.
88-
/// </returns>
92+
/// <summary>
93+
/// Returns the hash code of the tuple.
94+
/// </summary>
8995
public override int GetHashCode()
9096
{
9197
return HashCode.Combine(this.x.GetHashCode(), this.y.GetHashCode(), this.z.GetHashCode());
9298
}
9399

94-
/// <returns>
95-
/// The string representation of the tuple.
96-
/// </returns>
100+
/// <summary>
101+
/// Converts the tuple to a string.
102+
/// </summary>
103+
/// <returns>A string representation of the tuple.</returns>
97104
public override string ToString()
98105
{
99106
return $"{this.x.ToString()}, {this.y.ToString()}, {this.z.ToString()}";

0 commit comments

Comments
 (0)