private boolean evaluateSelectClause(String clause) {

		if (clause == null || clause.equals(""))
			return false;

		// "none" clause is a special case for clearing the selection status of all types
		if ("none".equalsIgnoreCase(clause)) {
			deselectAll();
			return true;
		}

		if (!NOT_SELECTED.matcher(clause).find()) { // "not selected" clause is a special case.
			deselectAll();
		}

		Matcher matcher = IMAGE.matcher(clause); // select by image
		if (matcher.find()) {
			String str = clause.substring(matcher.end()).trim();
			BitSet selection = null;
			if (LOGICAL_OPERATOR.matcher(str).find()) { // logical expressions
				selection = parseLogicalExpression(str, BY_IMAGE);
			} else {
				selection = selectImages(str);
			}
			if (!getAsTask())
				out(ScriptEvent.SUCCEEDED, (selection != null ? selection.cardinality() : 0) + " images are selected.");
			return true;
		}

		matcher = TEXTBOX.matcher(clause); // select by text box
		if (matcher.find()) {
			String str = clause.substring(matcher.end()).trim();
			BitSet selection = null;
			if (LOGICAL_OPERATOR.matcher(str).find()) { // logical expressions
				selection = parseLogicalExpression(str, BY_TEXTBOX);
			} else {
				selection = selectTextBoxes(str);
			}
			if (!getAsTask())
				out(ScriptEvent.SUCCEEDED, (selection != null ? selection.cardinality() : 0) + " text boxes are selected.");
			return true;
		}

		matcher = LINE.matcher(clause); // select by line
		if (matcher.find()) {
			String str = clause.substring(matcher.end()).trim();
			BitSet selection = null;
			if (LOGICAL_OPERATOR.matcher(str).find()) { // logical expressions
				selection = parseLogicalExpression(str, BY_LINE);
			} else {
				selection = selectLines(str);
			}
			if (!getAsTask())
				out(ScriptEvent.SUCCEEDED, (selection != null ? selection.cardinality() : 0) + " lines are selected.");
			return true;
		}

		matcher = RECTANGLE.matcher(clause); // select by rectangle
		if (matcher.find()) {
			String str = clause.substring(matcher.end()).trim();
			BitSet selection = null;
			if (LOGICAL_OPERATOR.matcher(str).find()) { // logical expressions
				selection = parseLogicalExpression(str, BY_RECTANGLE);
			} else {
				selection = selectRectangles(str);
			}
			if (!getAsTask())
				out(ScriptEvent.SUCCEEDED, (selection != null ? selection.cardinality() : 0) + " rectangles are selected.");
			return true;
		}

		matcher = TRIANGLE.matcher(clause); // select by triangle
		if (matcher.find()) {
			String str = clause.substring(matcher.end()).trim();
			BitSet selection = null;
			if (LOGICAL_OPERATOR.matcher(str).find()) { // logical expressions
				selection = parseLogicalExpression(str, BY_TRIANGLE);
			} else {
				selection = selectTriangles(str);
			}
			if (!getAsTask())
				out(ScriptEvent.SUCCEEDED, (selection != null ? selection.cardinality() : 0) + " triangles are selected.");
			return true;
		}

		matcher = ELLIPSE.matcher(clause); // select by ellipse
		if (matcher.find()) {
			String str = clause.substring(matcher.end()).trim();
			BitSet selection = null;
			if (LOGICAL_OPERATOR.matcher(str).find()) { // logical expressions
				selection = parseLogicalExpression(str, BY_ELLIPSE);
			} else {
				selection = selectEllipses(str);
			}
			if (!getAsTask())
				out(ScriptEvent.SUCCEEDED, (selection != null ? selection.cardinality() : 0) + " ellipses are selected.");
			return true;
		}

		matcher = ATOM.matcher(clause); // select by atom
		if (matcher.find()) {
			BitSet selection = null;
			String str = clause.substring(matcher.end()).trim();
			if (LOGICAL_OPERATOR.matcher(str).find()) { // logical expressions
				selection = parseLogicalExpression(str, BY_ATOM);
			} else {
				selection = selectParticles(str);
			}
			if (!getAsTask())
				out(ScriptEvent.SUCCEEDED, (selection != null ? selection.cardinality() : 0) + " atoms are selected.");
			return true;
		}

		if (model instanceof MolecularModel) {

			matcher = RBOND.matcher(clause); // select by radial bond
			if (matcher.find()) {
				String str = clause.substring(matcher.end()).trim();
				BitSet selection = null;
				if (LOGICAL_OPERATOR.matcher(str).find()) {// logical expressions
					selection = parseLogicalExpression(str, BY_RBOND);
				} else {
					selection = selectRadialBonds(str);
				}
				if (!getAsTask())
					out(ScriptEvent.SUCCEEDED, (selection != null ? selection.cardinality() : 0) + " radial bonds are selected.");
				return true;
			}

			matcher = ABOND.matcher(clause); // select by angular bond
			if (matcher.find()) {
				String str = clause.substring(matcher.end()).trim();
				BitSet selection = null;
				if (LOGICAL_OPERATOR.matcher(str).find()) {// logical expressions
					selection = parseLogicalExpression(str, BY_ABOND);
				} else {
					selection = selectAngularBonds(str);
				}
				if (!getAsTask())
					out(ScriptEvent.SUCCEEDED, (selection != null ? selection.cardinality() : 0) + " angular bonds are selected.");
				return true;
			}

			matcher = MOLECULE.matcher(clause); // select by molecule
			if (matcher.find()) {
				String str = clause.substring(matcher.end()).trim();
				BitSet selection = null;
				if (LOGICAL_OPERATOR.matcher(str).find()) { // logical expressions
					selection = parseLogicalExpression(str, BY_MOLECULE);
				} else {
					selection = selectMolecules(str);
				}
				if (!getAsTask())
					out(ScriptEvent.SUCCEEDED, (selection != null ? selection.cardinality() : 0) + " molecules are selected.");
				return true;
			}

			matcher = OBSTACLE.matcher(clause); // select by obstacle
			if (matcher.find()) {
				String str = clause.substring(matcher.end()).trim();
				BitSet selection = null;
				if (LOGICAL_OPERATOR.matcher(str).find()) { // logical expressions
					selection = parseLogicalExpression(str, BY_OBSTACLE);
				} else {
					selection = selectObstacles(str);
				}
				if (!getAsTask())
					out(ScriptEvent.SUCCEEDED, (selection != null ? selection.cardinality() : 0) + " obstacles are selected.");
				return true;
			}

			matcher = ELEMENT.matcher(clause); // select by element
			if (matcher.find()) {
				String str = clause.substring(matcher.end()).trim();
				BitSet selection = null;
				if (LOGICAL_OPERATOR.matcher(str).find()) {// logical expressions
					selection = parseLogicalExpression(str, BY_ELEMENT);
				} else {
					selection = selectElements(str);
				}
				if (!getAsTask())
					out(ScriptEvent.SUCCEEDED, (selection != null ? selection.cardinality() : 0) + " atoms are selected.");
				return true;
			}

		}

		out(ScriptEvent.FAILED, "Unrecognized keyword in: " + clause);
		return false;

	}