edu.rice.cs.drjava.model.definitions.indent
Class QuestionCurrLineStartsWithSkipComments

java.lang.Object
  extended by edu.rice.cs.drjava.model.definitions.indent.IndentRuleWithTrace
      extended by edu.rice.cs.drjava.model.definitions.indent.IndentRuleQuestion
          extended by edu.rice.cs.drjava.model.definitions.indent.QuestionCurrLineStartsWithSkipComments
All Implemented Interfaces:
IndentRule

public class QuestionCurrLineStartsWithSkipComments
extends IndentRuleQuestion

Determines whether the current line in the document starts with a specific character sequence, skipping over any comments and leading whitespace on that line. The character sequence is passed to the constructor of the class as a String argument.

Version:
$Id: QuestionCurrLineStartsWithSkipComments.java 5175 2010-01-20 08:46:32Z mgricken $

Field Summary
private  java.lang.String _prefix
          The String to be matched.
 
Fields inherited from class edu.rice.cs.drjava.model.definitions.indent.IndentRuleWithTrace
NO, TERMINUS_RULE, YES
 
Constructor Summary
QuestionCurrLineStartsWithSkipComments(java.lang.String prefix, IndentRule yesRule, IndentRule noRule)
           
 
Method Summary
(package private)  boolean applyRule(AbstractDJDocument doc, Indenter.IndentReason reason)
          Determines whether or not the current line in the document starts with the character sequence specified by the String field _prefix, skipping over any comments and leading whitespace on that line.
 
Methods inherited from class edu.rice.cs.drjava.model.definitions.indent.IndentRuleQuestion
applyRule, indentLine, testApplyRule, testApplyRule, testIndentLine
 
Methods inherited from class edu.rice.cs.drjava.model.definitions.indent.IndentRuleWithTrace
_addToIndentTrace, getRuleName, getTrace, indentLine, printLastIndentTrace, setRuleTraceEnabled, testIndentLine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_prefix

private java.lang.String _prefix
The String to be matched. This String may not contain whitespace characters or comment-delimiting characters.

Constructor Detail

QuestionCurrLineStartsWithSkipComments

public QuestionCurrLineStartsWithSkipComments(java.lang.String prefix,
                                              IndentRule yesRule,
                                              IndentRule noRule)
Parameters:
yesRule - The decision subtree for the case that this rule applies in the current context.
noRule - The decision subtree for the case that this rule does not apply in the current context.
Method Detail

applyRule

boolean applyRule(AbstractDJDocument doc,
                  Indenter.IndentReason reason)
Determines whether or not the current line in the document starts with the character sequence specified by the String field _prefix, skipping over any comments and leading whitespace on that line. Will not match prefixes that begin with "//" or "/*" or whitespace. Will not match empty string unless line has some uncommented nonWS text. Assumes that write lock and reduced lock are already held.

Specified by:
applyRule in class IndentRuleQuestion
Parameters:
doc - The AbstractDJDocument containing the current line.
reason - The reason that indentation was initiated, specified in Indenter
Returns:
True iff the current line in the document starts with the character sequence specified by the String field _prefix.