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

java.lang.Object
  |
  +--edu.rice.cs.drjava.model.definitions.indent.IndentRuleQuestion
        |
        +--edu.rice.cs.drjava.model.definitions.indent.QuestionPrevLineStartsComment
All Implemented Interfaces:
IndentRule

class QuestionPrevLineStartsComment
extends IndentRuleQuestion

Given the start of the current line is inside a C-style comment, asks whether the comment begins on the "previous line," ignoring white space.

Version:
$Id: QuestionPrevLineStartsComment.java,v 1.9 2002/07/22 22:50:41 csreis Exp $

Fields inherited from class edu.rice.cs.drjava.model.definitions.indent.IndentRuleQuestion
_noRule, _yesRule
 
Constructor Summary
(package private) QuestionPrevLineStartsComment(IndentRule yesRule, IndentRule noRule)
           
 
Method Summary
(package private)  boolean applyRule(DefinitionsDocument doc)
          Determines if the previous line in the document starts a block comment.
 
Methods inherited from class edu.rice.cs.drjava.model.definitions.indent.IndentRuleQuestion
applyRule, indentLine, indentLine
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

QuestionPrevLineStartsComment

QuestionPrevLineStartsComment(IndentRule yesRule,
                              IndentRule noRule)
Method Detail

applyRule

boolean applyRule(DefinitionsDocument doc)
Determines if the previous line in the document starts a block comment. We know that the current line is in a block comment. Therefore, if the start of the previous line is not inside of a block comment, then the previous line must have started the comment.

There is an exception to this; however, it is handled adequately. Consider the case when the previous line contains the following code: */ bar(); /*

Our approach will say that since the beginning of the previous line is inside of a comment, the previous line did not start the comment. This is acceptable because we think of the previous line as a continuation of a larger commented out region.

Overrides:
applyRule in class IndentRuleQuestion
Parameters:
doc - DefinitionsDocument containing the line to be indented.
Returns:
true if this node's rule holds.