private BitSet selectRectangles(String str) {
		int n = view.getNumberOfInstances(RectangleComponent.class);
		if (n == 0)
			return null;
		BitSet bs = new BitSet(n);
		if ("selected".equalsIgnoreCase(str)) {
			for (int i = 0; i < n; i++) {
				if (view.getRectangle(i).isSelected())
					bs.set(i);
			}
			return bs;
		}
		if (selectFromCollection(str, n, bs)) {
			view.setRectangleSelectionSet(bs);
			return bs;
		}
		Matcher matcher = WITHIN_RECTANGLE.matcher(str);
		if (matcher.find()) {
			Rectangle2D area = getWithinArea(str);
			for (int i = 0; i < n; i++) {
				if (area.contains(view.getRectangle(i).getCenter())) {
					bs.set(i);
				}
			}
			view.setRectangleSelectionSet(bs);
			return bs;
		}
		out(ScriptEvent.FAILED, "Unrecognized expression: " + str);
		return null;
	}