diff --git a/ICD.Common.Utils/Collections/IcdHashSet.cs b/ICD.Common.Utils/Collections/IcdHashSet.cs
index a4a8b90..17fbe65 100644
--- a/ICD.Common.Utils/Collections/IcdHashSet.cs
+++ b/ICD.Common.Utils/Collections/IcdHashSet.cs
@@ -67,6 +67,11 @@ namespace ICD.Common.Utils.Collections
#region Methods
+ ///
+ /// Returns a set containing all of this sets items plus all of the items in the given set.
+ ///
+ ///
+ ///
[PublicAPI]
public IcdHashSet Union(IEnumerable set)
{
@@ -80,6 +85,11 @@ namespace ICD.Common.Utils.Collections
return unionSet;
}
+ ///
+ /// Returns a new set of this sets items exluding the items in the given set.
+ ///
+ ///
+ ///
[PublicAPI]
public IcdHashSet Subtract(IEnumerable set)
{
@@ -94,13 +104,11 @@ namespace ICD.Common.Utils.Collections
return subtractSet;
}
- [PublicAPI]
- public bool IsSubsetOf(IcdHashSet set)
- {
- IcdHashSet setToCompare = set ?? NullSet;
- return this.All(setToCompare.Contains);
- }
-
+ ///
+ /// Returns all of the items that are common between this set and the given set.
+ ///
+ ///
+ ///
[PublicAPI]
public IcdHashSet Intersection(IcdHashSet set)
{
@@ -126,40 +134,74 @@ namespace ICD.Common.Utils.Collections
[PublicAPI]
public IcdHashSet NonIntersection(IcdHashSet set)
{
- return Subtract(set).Union(set.Subtract(this));
+ IcdHashSet setToCompare = set ?? NullSet;
+
+ return Subtract(set).Union(setToCompare.Subtract(this));
}
+ ///
+ /// Returns true if the given set contains all of the items in this set.
+ ///
+ ///
+ ///
+ [PublicAPI]
+ public bool IsSubsetOf(IcdHashSet set)
+ {
+ IcdHashSet setToCompare = set ?? NullSet;
+
+ return this.All(setToCompare.Contains);
+ }
+
+ ///
+ /// Returns true if the given set contains all of the items in this set, and the sets are not equal.
+ ///
+ ///
+ ///
[PublicAPI]
public bool IsProperSubsetOf(IcdHashSet set)
{
IcdHashSet setToCompare = set ?? NullSet;
- // Is a proper subset if A is a subset of B and A != B
- return (IsSubsetOf(setToCompare) && !setToCompare.IsSubsetOf(this));
+ return IsSubsetOf(setToCompare) && !setToCompare.IsSubsetOf(this);
}
+ ///
+ /// Returns true if this set contains all of the items in the given set.
+ ///
+ ///
+ ///
[PublicAPI]
public bool IsSupersetOf(IcdHashSet set)
{
IcdHashSet setToCompare = set ?? NullSet;
+
return setToCompare.IsSubsetOf(this);
}
+ ///
+ /// Returns true if this set contains all of the items in the given set, and the sets are not equal.
+ ///
+ ///
+ ///
[PublicAPI]
public bool IsProperSupersetOf(IcdHashSet set)
{
IcdHashSet setToCompare = set ?? NullSet;
- // B is a proper superset of A if B is a superset of A and A != B
- return (IsSupersetOf(setToCompare) && !setToCompare.IsSupersetOf(this));
+ return IsSupersetOf(setToCompare) && !setToCompare.IsSupersetOf(this);
}
+ ///
+ /// Returns true if this set contains all of the items in the given set, and vice versa.
+ ///
+ ///
+ ///
[PublicAPI]
public bool SetEquals(IcdHashSet set)
{
- var setToCompare = set ?? NullSet;
+ IcdHashSet setToCompare = set ?? NullSet;
- return (IsSubsetOf(setToCompare) && setToCompare.IsSubsetOf(this));
+ return IsSupersetOf(setToCompare) && setToCompare.IsSupersetOf(this);
}
#endregion