| java.lang.Object edu.rice.cs.drjava.model.definitions.indent.IndentRuleWithTrace edu.rice.cs.drjava.model.definitions.indent.IndentRuleQuestion edu.rice.cs.drjava.model.definitions.indent.QuestionExistsCharInStmt
QuestionExistsCharInStmt | public class QuestionExistsCharInStmt extends IndentRuleQuestion (Code) | | Determines if the given search character is found between the start of the current statement and the end character.
Accomplishes this by searching backwards from the end character, for the search character until one of the
following characters is found: '}', '{', ';', DOCSTART.
The given end character must exist on the current line and not be part of a quote or comment. If there is
more than end character on the given line, then the first end character is used.
This question is useful for determining if, when a colon is found on a line, it is part of a ternary operator
or not (construct this question with '?' for search character and ':' for end character).
It can also be used to determine if a statement contains a particular character by constructing it with the
desired character as a search character and the end character as ';'.
Note that characters in comments and quotes are disregarded.
version: $Id: QuestionExistsCharInStmt.java 4255 2007-08-28 19:17:37Z mgricken $ |
Constructor Summary | |
public | QuestionExistsCharInStmt(char findChar, char endChar, IndentRule yesRule, IndentRule noRule) Constructs a rule to determine if findChar exists
between the start of the current statement and endChar.
Parameters: findChar - Character to search for from the start of thestatement to endChar Parameters: endChar - Character that marks the end of the search space. |
QuestionExistsCharInStmt | public QuestionExistsCharInStmt(char findChar, char endChar, IndentRule yesRule, IndentRule noRule)(Code) | | Constructs a rule to determine if findChar exists
between the start of the current statement and endChar.
Parameters: findChar - Character to search for from the start of thestatement to endChar Parameters: endChar - Character that marks the end of the search space. Mustexist on the current line and not be in quotes or comments. Parameters: yesRule - Rule to use if this rule holds Parameters: noRule - Rule to use if this rule does not hold |
applyRule | boolean applyRule(AbstractDJDocument doc, Indenter.IndentReason reason)(Code) | | Searches backwards from endChar to the start of the statement looking for findChar. Ignores characters in
comments and quotes. Start of the statement is the point right after when one of the following characters
is found: ';', '{', '}', DOCSTART.
Parameters: doc - AbstractDJDocument containing the line to be indented. true if this node's rule holds. |
|
|