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

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Natural Language Processing
51.Net
52.Parser
53.PDF
54.Portal
55.Profiler
56.Project Management
57.Report
58.RSS RDF
59.Rule Engine
60.Science
61.Scripting
62.Search Engine
63.Security
64.Sevlet Container
65.Source Control
66.Swing Library
67.Template Engine
68.Test Coverage
69.Testing
70.UML
71.Web Crawler
72.Web Framework
73.Web Mail
74.Web Server
75.Web Services
76.Web Services apache cxf 2.2.6
77.Web Services AXIS2
78.Wiki Engine
79.Workflow Engines
80.XML
81.XML UI
Java Source Code / Java Documentation  » IDE » DrJava » edu.rice.cs.drjava.model.definitions.indent 
edu.rice.cs.drjava.model.definitions.indent
Provides a decision tree used to correctly indent the current line.

The tree is composed of {@link edu.rice.cs.drjava.model.definitions.indent.IndentRule}s, and asks a series of yes or no questions about the current position before determining the appropriate action. All nodes use helper methods from {@link edu.rice.cs.drjava.model.definitions.DefinitionsDocument} and the {@link edu.rice.cs.drjava.model.definitions.reducedmodel Reduced Model} package for context.

The tree itself is built in the {@link edu.rice.cs.drjava.model.definitions.indent.Indenter} class, where a singleton instance is made available to DefinitionsDocument for using on a single line. An outline of the tree is given below.

  • 1. QuestionInsideComment
    • 2. Yes: QuestionPrevLineStartsComment
      • 3. Yes: QuestionCurrLineEmptyOrEnterPress
        Starting first line of a mutli-line comment
        • 4. Yes (no auto-close): ActionStartPrevLinePlus(" * ")
          Without auto-close comments, we always do the same thing.
        • 42. Yes (auto-close): QuestionFollowedByStar
          • 4. Yes: ActionStartPrevLinePlus(" * ")
            We are already inside a comment - no need to close it.
          • 41. No: ActionStartPrevLinePlusMultiline
                      (new String[] { " * \n", " */" }, 0, 3)
            We are starting a new block comment - close it.
        • 5. No: ActionStartPrevLinePlus(" ")
          Revisiting first line of a mutli-line comment
      • 6. No: QuestionPrevLineStartsWith("*")
        • 7. Yes: QuestionCurrLineStartsWith("*")
          • 8. Yes: ActionStartPrevLinePlus("") (Goto 12)
            Revisiting middle line of a mutli-line comment (with star)
          • 9. No: QuestionCurrLineEmptyOrEnterPress
            • 10. Yes: ActionStartPrevLinePlus("* ")
              Starting middle line of a mutli-line comment
            • 11. No: ActionStartPrevLinePlus("") (Goto 12)
              Revisiting middle line of a mutli-line comment (without star)
        • 12. No: ActionStartPrevLinePlus("")
          Following a line with no start in a mutli-line comment
    • 13. No: QuestionBraceIsParenOrBracket
      • 14. Yes: QuestionNewParenPhrase
        • 15. Yes: ActionBracePlus(" ")
        • 16. No: ActionBracePlus(" " + 1 level)
      • 17. No: QuestionBraceIsCurly
        • 18. Yes: QuestionCurrLineStartsWithSkipComments("}")
          • 19. Yes: ActionStartStmtOfBracePlus("")
          • 20. No: QuestionStartAfterOpenBrace
            • 21. Yes: ActionStartStmtOfBracePlus(1 level) (Goto 36)
            • 22. No: QuestionHasCharPrecedingOpenBrace
              • 23. Yes: ActionStartStmtOfBracePlus(1 level) (Goto 36)
              • 24. No: Goto 25.
        • 25. No: QuestionStartingNewStmt
          • 26. Yes: QuestionLineContains(":")
            • 27. Yes: QuestionExistsCharInStmt("?", ":")
              • 28. Yes: ActionStartPrevStmtPlus("", false) (Goto 30)
              • 29. No: ActionStartStmtOfBracePlus(1 level) (Goto 36)
            • 30. No: ActionStartPrevStmtPlus("", true)
          • 31. No: QuestionCurrLineStartsWithSkipComments("{")
            • 32. Yes: ActionStartCurrStmtPlus("")
            • 33. No: QuestionLineContains(":")
              • 34. Yes: QuestionExistsCharInStmt("?", ":")
                • 35. Yes: ActionStartCurrStmtPlus(1 level) (Goto 37)
                • 36. No: ActionStartStmtOfBracePlus(1 level)
              • 37. No: ActionStartCurrStmtPlus(1 level)

@see edu.rice.cs.drjava.model.definitions @see edu.rice.cs.drjava.model.definitions.reducedmodel

Java Source File NameTypeComment
ActionBracePlus.javaClass Aligns indentation of the current line to the character that opened the enclosing block or expression list.
ActionBracePlusTest.javaClass Test class according to the JUnit protocol.
ActionDoNothing.javaClass Indents the current line in the document to the indent level of the start of the contract or statement of the brace enclosing the current position, plus the given suffix.
ActionDoNothingTest.javaClass Tests the action rule which does nothing to the given text.
ActionStartCurrStmtPlus.javaClass Indents the current line in the document to the indent level of the start of the statement that the cursor is currently on, plus the given suffix string.
ActionStartPrevLinePlus.javaClass Indents current line to the indent level of the previous line augmented by a suffix.
ActionStartPrevLinePlusMultiline.javaClass Indents the current line in the document to the indent level of the start of the previous line, adds several lines of text at that indent level, and moves the cursor to a particular line and position.
ActionStartPrevLinePlusMultilinePreserve.javaClass Indents the current line in the document to the indent level of the start of the previous line, preserving any text on the current line, and adds several lines of text at that indent level, and moves the cursor to a particular line and position.
ActionStartPrevLinePlusMultilinePreserveTest.javaClass Tests ActionStartPrevLinePlusMultilinePreserve(String,int,int,int,int).
ActionStartPrevLinePlusTest.javaClass
ActionStartPrevStmtPlus.javaClass Indents the current line in the document to the indent level of the start of the statement previous to the one the cursor is currently on, plus the given suffix string.
ActionStartPrevStmtPlusTest.javaClass Test the action rules for code in the indentation decision tree.
ActionStartStmtOfBracePlus.javaClass Indents the current line in the document to the indent level of the start of the brace enclosing the start of the current line, plus the given suffix.
ActionStartStmtOfBracePlusTest.javaClass Test the action rules for code in the indentation decision tree.
Indenter.javaClass Singleton class to construct and use the indentation decision tree.
IndentRule.javaInterface A node in the decision tree used for the indentation system.
IndentRuleAction.javaClass A leaf node in the decision tree for the indentation system.
IndentRuleQuestion.javaClass A question node in the decision tree for the indentation system.
IndentRulesTestCase.javaClass Superclass for all test classes for the indentation decision tree.
IndentRuleWithTrace.javaClass This class does almost all the work for keeping an indent tree trace.
IndentRuleWithTraceTest.javaClass This class does almost all the work for keeping an indent tree trace.
QuestionBraceIsCurly.javaClass Determines whether or not the last block or expression list opened previous to the start of the current line was opened by the character '{'.
QuestionBraceIsCurlyTest.javaClass Test class according to the JUnit protocol.
QuestionBraceIsParenOrBracket.javaClass Determines whether or not the last block or expression list opened previous to the start of the current line was opened by one of the characters '(' or '['.
QuestionBraceIsParenOrBracketTest.javaClass Test class according to the JUnit protocol.
QuestionCurrLineEmpty.javaClass
QuestionCurrLineEmptyOrEnterPress.javaClass
QuestionCurrLineEmptyOrEnterPressTest.javaClass Tests whether the current line is empty.
QuestionCurrLineIsWingComment.javaClass
QuestionCurrLineIsWingCommentTest.javaClass Tests visitor class that determines whether the current line is a wing comment.
QuestionCurrLineStartsWith.javaClass Question rule in the indentation decision tree.
QuestionCurrLineStartsWithSkipComments.javaClass Determines whether the current line in the document starts with a specific character sequence, skipping over any comments and leading whitespace on that line.
QuestionCurrLineStartsWithSkipCommentsTest.javaClass Tests the proper functionality of the class QuestionCurrLineStartsWithSkipComments.
QuestionCurrLineStartsWithTest.javaClass Tests the indention rule which detects whether the current line starts with a particular string.
QuestionExistsCharInPrevStmt.javaClass
QuestionExistsCharInStmt.javaClass Determines if the given search character is found between the start of the current statement and the end character. Accomplishes this by searching backwards from the end character, for the search character until one of the following characters is found: '}', '{', ';', 0. The given end character must exist on the current line and not be part of a quote or comment. If there is more than end character on the given line, then the first end character is used.

This question is useful for determining if, when a colon is found on a line, it is part of a ternary operator or not (construct this question with '?' for search character and ':' for end character).

It can also be used to determine if a statement contains a particular character by constructing it with the desired character as a search character and the end character as ';'.

Note that characters in comments and quotes are disregarded.

QuestionExistsCharInStmtTest.javaClass Tests the question rule which determines if the given findChar is found between the start of the statement and the endChar, which must exist on the current line.
QuestionFollowedByStar.javaClass Question rule in the indentation decision tree.
QuestionHasCharPrecedingOpenBrace.javaClass Determines whether or not the line enclosing brace is '{' and is immediately preceded by the given _prefix.
QuestionHasCharPrecedingOpenBraceTest.javaClass Test class according to the JUnit protocol.
QuestionInsideComment.javaClass Asks whether the beginning of the current line is inside a C-style comment.
QuestionInsideCommentTest.javaClass Tests whether start of line is within a multiline comment.
QuestionLineContains.javaClass Question rule in the indentation decision tree.
QuestionLineContainsTest.javaClass Tests the question rule which determines if the current line in the document contains the given character.
QuestionNewParenPhrase.javaClass Question rule in the indentation decision tree.
QuestionNewParenPhraseTest.javaClass Tests the indention rule which detects whether the current line starts a new parenthesized phrase.
QuestionPrevLineStartsComment.javaClass Given the start of the current line is inside a block comment, asks whether the comment begins on the "previous line," ignoring white space.
QuestionPrevLineStartsCommentTest.javaClass Tests whether the previous line starts the comment containing the cursor.
QuestionPrevLineStartsJavaDocWithText.javaClass Question rule in the indentation decision tree.
QuestionPrevLineStartsWith.javaClass Question rule in indentation decision tree.
QuestionPrevLineStartsWithTest.javaClass Tests the indention rule which detects whether the immediately previous line starts with a particular string.
QuestionStartAfterOpenBrace.javaClass Determines whether or not the closest non-whitespace character preceding the start of the current line (excluding any characters inside comments or strings) is on the same line as the enclosing CURLY brace (class is misnamed!).
QuestionStartAfterOpenBraceTest.javaClass Tests whether the closest non-whitespace character preceding the start of the current line (excluding any characters inside comments or strings) is an open brace.
QuestionStartingNewStmt.javaClass 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.
QuestionStartingNewStmtTest.javaClass Tests the question rule which determines if the current line is starting a new statement.
w__w_w__.__ja_v__a___2__s__.co_m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.