private int getNumberOfObjects(byte type) {
		int n = 0;
		switch (type) {
		case BY_ATOM:
		case BY_ELEMENT:
			n = model.getNumberOfParticles();
			break;
		case BY_OBSTACLE:
			n = model.obstacles.size();
			break;
		case BY_IMAGE:
			n = view.getNumberOfInstances(ImageComponent.class);
			break;
		case BY_TEXTBOX:
			n = view.getNumberOfInstances(TextBoxComponent.class);
			break;
		case BY_LINE:
			n = view.getNumberOfInstances(LineComponent.class);
			break;
		case BY_RECTANGLE:
			n = view.getNumberOfInstances(RectangleComponent.class);
			break;
		case BY_ELLIPSE:
			n = view.getNumberOfInstances(EllipseComponent.class);
			break;
		case BY_RBOND:
			if (model instanceof MolecularModel)
				n = ((MolecularModel) model).bonds.size();
			break;
		case BY_ABOND:
			if (model instanceof MolecularModel)
				n = ((MolecularModel) model).bends.size();
			break;
		case BY_MOLECULE:
			if (model instanceof MolecularModel)
				n = ((MolecularModel) model).molecules.size();
			break;
		}
		return n;
	}