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

java.lang.Object
  extended by edu.rice.cs.drjava.model.definitions.indent.Indenter

public class Indenter
extends Object

Singleton class to construct and use the indentation decision tree.

Version:
$Id: Indenter.java 4691 2008-12-02 23:33:27Z dlsmith $

Nested Class Summary
static class Indenter.IndentReason
          Enumeration of reasons why indentation may be preformed.
 
Field Summary
protected  int _indentLevel
           
protected  IndentRule _topRule
          Root of decision tree.
 
Constructor Summary
Indenter(int indentLevel)
           
 
Method Summary
 void buildTree(int indentLevel)
          Builds the decision tree for indentation.
 int getIndentLevel()
           
 boolean indent(AbstractDJDocument doc, Indenter.IndentReason reason)
          Indents the current line based on a decision tree which determines the indent based on context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_indentLevel

protected int _indentLevel

_topRule

protected IndentRule _topRule
Root of decision tree.

Constructor Detail

Indenter

public Indenter(int indentLevel)
Method Detail

getIndentLevel

public int getIndentLevel()

buildTree

public void buildTree(int indentLevel)
Builds the decision tree for indentation. For now, this method needs to be called every time the size of one indent level is being changed!


indent

public boolean indent(AbstractDJDocument doc,
                      Indenter.IndentReason reason)
Indents the current line based on a decision tree which determines the indent based on context.

Parameters:
doc - document containing line to be indented Assumes that reduced lock is already held.
Returns:
true if the condition tested by the top rule holds, false otherwise