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

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.QuestionLineContains
All Implemented Interfaces:
IndentRule

public class QuestionLineContains
extends IndentRuleQuestion

Question rule in the indentation decision tree. Determines if the current line contains the given character. Does not check for the character inside comments or quotes.

Does not work if character being searched for is a '/' or a '*'

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

Field Summary
private  char _findChar
          Character to search for
 
Fields inherited from class edu.rice.cs.drjava.model.definitions.indent.IndentRuleWithTrace
NO, TERMINUS_RULE, YES
 
Constructor Summary
QuestionLineContains(char findChar, IndentRule yesRule, IndentRule noRule)
          Constructs a new rule which determines if the line contains the given character.
 
Method Summary
(package private)  boolean applyRule(AbstractDJDocument doc, Indenter.IndentReason reason)
          Determines if the given character exists on the current 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

_findChar

private char _findChar
Character to search for

Constructor Detail

QuestionLineContains

public QuestionLineContains(char findChar,
                            IndentRule yesRule,
                            IndentRule noRule)
Constructs a new rule which determines if the line contains the given character.

Parameters:
findChar - Character to search for
yesRule - Rule to use if this rule holds
noRule - Rule to use if this rule does not hold
Method Detail

applyRule

boolean applyRule(AbstractDJDocument doc,
                  Indenter.IndentReason reason)
Determines if the given character exists on the current line. Does not search in quotes or comments.

Does not work if character being searched for is a '/' or a '*'

Specified by:
applyRule in class IndentRuleQuestion
Parameters:
doc - AbstractDJDocument containing the line to be indented.
reason - The reason that indentation was initiated, specified in Indenter
Returns:
true if this node's rule holds.