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

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

public class QuestionStartingNewStmt
extends IndentRuleQuestion

Determines if the current line is starting a new statement by searching backwards to see if the previous line was the end of a statement. Specifically, checks if the previous non-whitespace character not on this line is one of the following: ';', '{', '}', or DOCSTART.

Note that characters in comments and quotes are disregarded.

Version:
$Id: QuestionStartingNewStmt.java,v 1.5 2002/03/30 08:38:28 csreis Exp $

Fields inherited from class edu.rice.cs.drjava.model.definitions.indent.IndentRuleQuestion
_noRule, _yesRule
 
Constructor Summary
QuestionStartingNewStmt(IndentRule yesRule, IndentRule noRule)
          Constructs a new rule to determine if the current line is the start of a new statement.
 
Method Summary
(package private)  boolean applyRule(DefinitionsDocument doc)
          Determines if the previous non-whitespace character not on this line was one of the following: ';', '{', '}' or DOCSTART.
 
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

QuestionStartingNewStmt

public QuestionStartingNewStmt(IndentRule yesRule,
                               IndentRule noRule)
Constructs a new rule to determine if the current line is the start of a new statement.
Parameters:
yesRule - Rule to use if this rule holds
noRule - Rule to use if this rule does not hold
Method Detail

applyRule

boolean applyRule(DefinitionsDocument doc)
Determines if the previous non-whitespace character not on this line was one of the following: ';', '{', '}' or DOCSTART. Ignores characters in quotes and comments.
Overrides:
applyRule in class IndentRuleQuestion
Parameters:
doc - DefinitionsDocument containing the line to be indented.
Returns:
true if this node's rule holds.