remove method

FuzzyVariable remove(
  1. FuzzySet fuzzySet
)

Removes the given fuzzy set from this FLV.

Implementation

FuzzyVariable remove(FuzzySet fuzzySet ) {
	final fuzzySets = this.fuzzySets;

	final index = fuzzySets.indexOf( fuzzySet );
	fuzzySets.removeAt(index);

	// iterate over all fuzzy sets to recalculate the min/max range

	minRange = double.infinity;
	maxRange = - double.infinity;

	for ( int i = 0, l = fuzzySets.length; i < l; i ++ ) {
		final fuzzySet = fuzzySets[ i ];
		if ( fuzzySet.left < minRange ) minRange = fuzzySet.left;
		if ( fuzzySet.right > maxRange ) maxRange = fuzzySet.right;
	}

	return this;
}