Java Doc for ReducedModelControl.java in  » IDE » DrJava » edu » rice » cs » drjava » model » definitions » reducedmodel » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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.reducedmodel 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   edu.rice.cs.drjava.model.definitions.reducedmodel.ReducedModelControl

ReducedModelControl
public class ReducedModelControl implements BraceReduction(Code)
This class provides an implementation of the BraceReduction interface for brace matching. In order to correctly match, this class keeps track of what is commented (line and block) and what is inside double quotes and keeps this in mind when matching. To avoid unnecessary complication, this class maintains a few invariants for its consistent states, i.e., between top-level function calls.
  1. The cursor offset is never at the end of a brace. If movement or insertion puts it there, the cursor is updated to point to the 0 offset of the next brace.
  2. Quoting information is invalid inside valid comments. When part of the document becomes uncommented, the reduced model must update the quoting information linearly in the newly revealed code.
  3. Quote shadowing and comment shadowing are mutually exclusive.
  4. There is no nesting of comment open characters. If // is encountered in the middle of a comment, it is treated as two separate slashes. Similar for /*.
All of the code in the class assumes that a lock on this is held.
author:
   JavaPLT
version:
   $Id: ReducedModelControl.java 4255 2007-08-28 19:17:37Z mgricken $


Field Summary
volatile  int_offset
    
volatile  ReducedModelBrace_rmb
    
volatile  ReducedModelComment_rmc
    


Method Summary
public  intabsOffset()
     Gets the absolute character offset into the document represented by the reduced model.
 booleanatEnd()
     Determines if the cursor is at the end of the reduced model.
 booleanatStart()
     Determines if the cursor is at the start of the reduced model.
public  intbalanceBackward()
    

Finds the open brace that matches the previous significant brace iff that brace is an closing brace.

the distance until the matching open brace.
public  intbalanceForward()
    

Finds the closing brace that matches the next significant brace iff that brace is an open brace.

the distance until the matching closing brace.
public  ReducedTokencurrentToken()
     Get the token currently pointed at by the cursor.
public  voiddelete(int count)
    

Update the BraceReduction to reflect text deletion.


Parameters:
  count - indicates the size and direction of text deletion.
 intgetBlockOffset()
     Gets the offset within the current token.
public  intgetDistToNextNewline()
    
public  intgetDistToPreviousNewline(int relLoc)
     Gets distance to end of line on the line previous.
public  Vector<HighlightStatus>getHighlightStatus(int start, int length)
     Return all highlight status info for text between the current location and current location + length.
public  IndentInfogetIndentInformation()
    
 intgetSize()
     Gets the size of the current token. It checks both the brace and comment sub-models to find the size of the current token.
 intgetSize(ReducedToken rmbToken, ReducedToken rmcToken)
    
public  ReducedModelStategetStateAtCurrent()
     Get the shadowing state at the current caret position.
 StringgetType()
     Get a string representation of the current token's type.
public  voidinsertChar(char ch)
    
public  voidmove(int count)
    

Updates the BraceReduction to reflect cursor movement.

public  ReducedModelStatemoveWalkerGetState(int relDistance)
     This function returns the state at the relDistance, where relDistance is relative to the last time it was called.
 voidnext()
     Move the reduced model to the next token and update the cursor information.
public  ReducedTokennextItem()
     Get the next token.
 voidprev()
     Move the reduced model to the previous token and update the cursor information.
public  ReducedTokenprevItem()
     Get the previous token.
public  voidresetLocation()
     This function resets the location of the walker in the comment list to where the current cursor is.
public  StringsimpleString()
     A toString() substitute.

Field Detail
_offset
volatile int _offset(Code)



_rmb
volatile ReducedModelBrace _rmb(Code)



_rmc
volatile ReducedModelComment _rmc(Code)





Method Detail
absOffset
public int absOffset()(Code)
Gets the absolute character offset into the document represented by the reduced model.



atEnd
boolean atEnd()(Code)
Determines if the cursor is at the end of the reduced model.



atStart
boolean atStart()(Code)
Determines if the cursor is at the start of the reduced model.



balanceBackward
public int balanceBackward()(Code)

Finds the open brace that matches the previous significant brace iff that brace is an closing brace.

the distance until the matching open brace. On failure, returns -1.
See Also:   ReducedModelControl.balanceForward()



balanceForward
public int balanceForward()(Code)

Finds the closing brace that matches the next significant brace iff that brace is an open brace.

the distance until the matching closing brace. On failure, returns -1.
See Also:   ReducedModelControl.balanceBackward()



currentToken
public ReducedToken currentToken()(Code)
Get the token currently pointed at by the cursor. Because the reduced model is split into two reduced sub-models, we have to check each sub-model first as each one has unique information. If we find a non-gap token in either sub-model we want to return that. Otherwise, we want to return a sort of hybrid Gap of the two, i.e., a Gap where there are neither special comment/quote tokens nor parens/squigglies/brackets. a ReducedToken representative of the unified reduced model



delete
public void delete(int count)(Code)

Update the BraceReduction to reflect text deletion.


Parameters:
  count - indicates the size and direction of text deletion. Negative values delete text to the left of thecursor, positive values delete text to the right.



getBlockOffset
int getBlockOffset()(Code)
Gets the offset within the current token.



getDistToNextNewline
public int getDistToNextNewline()(Code)



getDistToPreviousNewline
public int getDistToPreviousNewline(int relLoc)(Code)
Gets distance to end of line on the line previous.



getHighlightStatus
public Vector<HighlightStatus> getHighlightStatus(int start, int length)(Code)
Return all highlight status info for text between the current location and current location + length. This should collapse adjoining blocks with the same status into one.
Parameters:
  start - The start location of the area for which we want the status. The reduced model is already at thisposition, but this value is needed to determine the absolute positions in HighlightStatus objects we return.
Parameters:
  length - The length of the text segment for which status information must be generated.



getIndentInformation
public IndentInfo getIndentInformation()(Code)
Returns an IndentInfo containing the following information: - distance to the previous newline ( start of this line) - distance to the brace enclosing the beginning of the current line - distance to the beginning of the line containing that brace



getSize
int getSize()(Code)
Gets the size of the current token. It checks both the brace and comment sub-models to find the size of the current token. If the current token is a Gap, we have to reconcile the information of both sub-models in order to get the correct size of the current token as seen by the outside world. the number of characters represented by the current token



getSize
int getSize(ReducedToken rmbToken, ReducedToken rmcToken)(Code)



getStateAtCurrent
public ReducedModelState getStateAtCurrent()(Code)
Get the shadowing state at the current caret position. FREE|INSIDE_LINE_COMMENT|INSIDE_BLOCK_COMMENT|INSIDE_SINGLE_QUOTE|INSIDE_DOUBLE_QUOTE



getType
String getType()(Code)
Get a string representation of the current token's type. "" if current is a Gap, otherwise, use ReducedToken.getType()



insertChar
public void insertChar(char ch)(Code)



move
public void move(int count)(Code)

Updates the BraceReduction to reflect cursor movement. Negative values move left from the cursor, positive values move right.


Parameters:
  count - indicates the direction and magnitude of cursor movement



moveWalkerGetState
public ReducedModelState moveWalkerGetState(int relDistance)(Code)
This function returns the state at the relDistance, where relDistance is relative to the last time it was called. You can reset the last call to the current offset using resetLocation.



next
void next()(Code)
Move the reduced model to the next token and update the cursor information.



nextItem
public ReducedToken nextItem()(Code)
Get the next token.



prev
void prev()(Code)
Move the reduced model to the previous token and update the cursor information.



prevItem
public ReducedToken prevItem()(Code)
Get the previous token.



resetLocation
public void resetLocation()(Code)
This function resets the location of the walker in the comment list to where the current cursor is. This allows the walker to keep walking and using relative distance instead of having to rewalk the same distance every call to stateAtRelLocation. It is an optimization.



simpleString
public String simpleString()(Code)
A toString() substitute.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

w___w__w.__j__a___va___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.