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

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 geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
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 the current line in the document to the indent level of the start of the previous line, plus the given suffix.
ActionStartPrevLinePlusBackup.javaClass Indents the current line in the document to the indent level of the start of the previous line, plus the given suffix, then backs up to a specific cursor position.
ActionStartPrevLinePlusBackupTest.javaClass Test class for an indent rule with a really long name.
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).
ActionStartPrevLinePlusMultilineTest.javaClass Test class for an indent rule with a really long name.
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 contract or statement 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. Calls to indentLine on an IndentRuleQuestion will make a decision based on context and call the same method on one of its children.
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 or not the current line in the document starts with a specific character sequence, skipping over any comments on that line.
QuestionCurrLineStartsWithSkipCommentsTest.javaClass Test class according to the JUnit protocol.
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: '}', '{', ';', DOCSTART. 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 last '{' was immediately preceded by _prefix So when _prefix='=', effectivily, we are looking for "={" This questions corresponds to rule 22 in our decision tree.
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 the 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 previous to the start of the current line (excluding any characters inside comments or strings) is an open brace.
QuestionStartAfterOpenBraceTest.javaClass Test class according to the JUnit protocol.
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.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.