CardinalityUtils class

Provides utility methods for set cardinality calculations.

This class contains static methods for computing cardinality of sets and verifying cardinality relationships based on set theory principles.

Constructors

CardinalityUtils()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

atLeastOne<T>(CustomSet<T> a, CustomSet<T> b) int
Calculates the number of elements in at least one of the sets.
both<T>(CustomSet<T> a, CustomSet<T> b) int
Calculates the number of elements in both sets.
cardinality<T>(CustomSet<T> set) int
Returns the cardinality (number of elements) of a set.
cartesianProductCardinality<T, U>(CustomSet<T> a, CustomSet<U> b) int
Calculates the cardinality of the Cartesian product of two sets.
cartesianProductCardinalityN<T>(List<CustomSet<T>> sets) int
Calculates the cardinality of the Cartesian product of n sets.
complementCardinality<T>(CustomSet<T> a, CustomSet<T> universal) int
Calculates the cardinality of the complement of a set.
differenceCardinality<T>(CustomSet<T> a, CustomSet<T> b) int
Calculates the cardinality of the difference of two sets.
exactlyOne<T>(CustomSet<T> a, CustomSet<T> b) int
Calculates the number of elements in exactly one of the sets.
isEmpty<T>(CustomSet<T> set) bool
Checks if a set is empty (cardinality = 0).
isFinite<T>(CustomSet<T> set) bool
Checks if a set is finite (has a finite cardinality).
isSingleton<T>(CustomSet<T> set) bool
Checks if a set is a singleton (cardinality = 1).
neither<T>(CustomSet<T> a, CustomSet<T> b, CustomSet<T> universal) int
Calculates the number of elements in neither set (relative to universal).
powerSetCardinality<T>(CustomSet<T> set) int
Calculates the cardinality of the power set of a set.
printReport<T>(CustomSet<T> a, CustomSet<T> b, {String title = 'Cardinality Report'}) → void
Prints a detailed cardinality report for two sets.
summary<T>(CustomSet<T> a, CustomSet<T> b) Map<String, int>
Creates a summary of cardinality relationships between two sets.
symmetricDifferenceCardinality<T>(CustomSet<T> a, CustomSet<T> b) int
Calculates the cardinality of the symmetric difference of two sets.
unionCardinality<T>(CustomSet<T> a, CustomSet<T> b) int
Calculates the cardinality of the union of two sets using the Inclusion-Exclusion Principle.
unionCardinality3<T>(CustomSet<T> a, CustomSet<T> b, CustomSet<T> c) int
Calculates the cardinality of the union of three sets using the Inclusion-Exclusion Principle.
unionCardinalityN<T>(List<CustomSet<T>> sets) int
Calculates the cardinality of the union of multiple sets using the Generalized Inclusion-Exclusion Principle.
verifyDisjointUnion<T>(CustomSet<T> a, CustomSet<T> b) bool
Verifies cardinality relationship for disjoint sets.
verifyInclusionExclusion2<T>(CustomSet<T> a, CustomSet<T> b) bool
Verifies the Inclusion-Exclusion Principle for two sets.
verifyInclusionExclusion3<T>(CustomSet<T> a, CustomSet<T> b, CustomSet<T> c) bool
Verifies the Inclusion-Exclusion Principle for three sets.