contains method

bool contains(
  1. List<num> position
)

Returns true if the point position belongs to the search space this.

Implementation

bool contains(List<num> position) {
  try {
    for (var i in order) {
      if (!_intervals[i].contains(position[i])) {
        return false;
      }
    }
    return true;
  } catch (e) {
    if (position.length != dimensions) {
      throw ErrorOf<SearchSpace>(
          message: 'Error encountered in method: \'contains($position)\'.',
          invalidState: 'Space dimension $dimensions != $position.length.',
          expectedState: 'The vector argument must have length $dimensions.');
    }
    rethrow;
  }
}