Java Doc for LexerTestUtilities.java in  » IDE-Netbeans » lexer » org » netbeans » lib » lexer » test » 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 Netbeans » lexer » org.netbeans.lib.lexer.test 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.netbeans.lib.lexer.test.LexerTestUtilities

LexerTestUtilities
final public class LexerTestUtilities (Code)
Various utilities related to lexer's and token testing.
author:
   mmetelka




Method Summary
public static  voidassertCollectionsEqual(Collection expected, Collection actual)
    
public static  voidassertCollectionsEqual(String message, Collection expected, Collection actual)
    
public static  voidassertConsistency(TokenHierarchy hi)
    
public static  voidassertNextTokenEquals(TokenSequence ts, TokenId id, String text)
    
public static  voidassertNextTokenEquals(String message, TokenSequence ts, TokenId id, String text)
    
public static  voidassertTextEquals(CharSequence expected, CharSequence actual)
    
public static  voidassertTextEquals(String message, CharSequence expected, CharSequence actual)
    
public static  voidassertTokenEquals(TokenSequence ts, TokenId id, String text, int offset)
    
public static  voidassertTokenEquals(String message, TokenSequence ts, TokenId id, String text, int offset)
     Compare TokenSequence.token() to the given token id, text and offset.
Parameters:
  offset - expected offset.
public static  voidassertTokenEquals(TokenSequence ts, TokenId id, String text, int offset, int lookahead, Object state)
    
public static  voidassertTokenEquals(String message, TokenSequence ts, TokenId id, String text, int offset, int lookahead, Object state)
    
public static  voidassertTokenFlyweight(Token token)
    
public static  voidassertTokenNotFlyweight(Token token)
    
public static  voidassertTokenOffsetsEqual(String message, int offset1, int offset2)
    
public static  voidassertTokenSequencesEqual(TokenSequence expected, TokenHierarchy expectedHi, TokenSequence actual, TokenHierarchy actualHi, boolean testLookaheadAndState)
    
public static  voidassertTokenSequencesEqual(String message, TokenSequence expected, TokenHierarchy expectedHi, TokenSequence actual, TokenHierarchy actualHi, boolean testLookaheadAndState)
     Compare contents of the given token sequences by moving through all their tokens.
Token hierarchies are given to check implementations of the Token.offset(TokenHierarchy) - useful for checking of token snapshots.
Parameters:
  message - message to display (may be null).
Parameters:
  expected - non-null token sequence to be compared to the other token sequence.
Parameters:
  expectedHi - token hierarchy to which expected relates.
Parameters:
  actual - non-null token sequence to be compared to the other token sequence.
Parameters:
  actualHi - token hierarchy to which actual relates.
Parameters:
  testLookaheadAndState - whether lookahead and states should be checkedor not.
public static  voidcheckTokenDump(NbTestCase test, String relFilePath, Language language)
     Check whether token descriptions dump file (a file with added suffix ".tokens.txt") for the given input file exists and whether it has the same content like the one obtained by lexing the input file.
It allows to test whether the tested lexer still produces the same tokens.
The method will only pass successfully if both the input file and token descriptions files exist and the token descriptions file contains the same information as the generated files.
If the token descriptions file does not exist the method will create it.
As the lexer's behavior at the EOF is important and should be well tested there is a support for splitting input file virtually into multiple inputs by virtual EOF - see TokenDumpTokenId for details.
Also there is possibility to specify special chars - see TokenDumpTokenId for details.
Parameters:
  test - non-null test (used for calling test.getDataDir()).
Parameters:
  relFilePath - non-null file path relative to datadir of the test.
For example if "testfiles/testinput.mylang.txt" gets passed the test method willsearch for new File(test.getDataDir() + "testfiles/testinput.mylang.txt"),read its content, lex it and create token descriptions.
public static  booleancollectionsEqual(Collection c1, Collection c2)
    
public static  StringdebugText(CharSequence text)
     Return the given text as String translating the special characters (and '\') into escape sequences.
Parameters:
  text - non-null text to be debugged.
public static  StringdebugTextOrNull(CharSequence text)
     Return the given text as String translating the special characters (and '\') into escape sequences.
Parameters:
  text - non-null text to be debugged.
public static  List<Integer>flyweightDistribution(TokenSequence ts)
     Compute distribution of flyweight token lengths accross the given token sequence.
Parameters:
  ts - non-null token sequence.
public static  intflyweightTextLength(TokenSequence ts)
     Compute total number of characters represented by flyweight tokens in the given token sequence.
Parameters:
  ts - non-null token sequence.
public static  intflyweightTokenCount(TokenSequence ts)
     Compute number of flyweight tokens in the given token sequence.
Parameters:
  ts - non-null token sequence.
public static  DocumentEventgetLastDocumentEvent(Document doc)
    
public static  TokenHierarchyEventgetLastTokenHierarchyEvent(Document doc)
    
public static  voidincCheck(Document doc, boolean nested)
    
public static  voidinitLastDocumentEventListening(Document doc)
    
public static  voidinitLastTokenHierarchyEventListening(Document doc)
    
public static  intlookahead(TokenSequence ts)
     Get lookahead for the token to which the token sequence is positioned.
public static  voidsetTesting(boolean testing)
     Set whether the lexer should run in testing mode where there are some additional correctness checks performed.
public static  Objectstate(TokenSequence ts)
     Get state for the token to which the token sequence is positioned.
public static  booleantextEquals(CharSequence text1, CharSequence text2)
     Compare whether the two character sequences represent the same text.
public static  TokenList<T>tokenList(TokenSequence<T> ts)
     Get token list from the given token sequence for testing purposes.



Method Detail
assertCollectionsEqual
public static void assertCollectionsEqual(Collection expected, Collection actual)(Code)



assertCollectionsEqual
public static void assertCollectionsEqual(String message, Collection expected, Collection actual)(Code)



assertConsistency
public static void assertConsistency(TokenHierarchy hi)(Code)



assertNextTokenEquals
public static void assertNextTokenEquals(TokenSequence ts, TokenId id, String text)(Code)
Assert that the next token in the token sequence



assertNextTokenEquals
public static void assertNextTokenEquals(String message, TokenSequence ts, TokenId id, String text)(Code)



assertTextEquals
public static void assertTextEquals(CharSequence expected, CharSequence actual)(Code)



assertTextEquals
public static void assertTextEquals(String message, CharSequence expected, CharSequence actual)(Code)



assertTokenEquals
public static void assertTokenEquals(TokenSequence ts, TokenId id, String text, int offset)(Code)

See Also:   LexerTestUtilities.assertTokenEquals(String,TokenSequence,TokenId,String,int)



assertTokenEquals
public static void assertTokenEquals(String message, TokenSequence ts, TokenId id, String text, int offset)(Code)
Compare TokenSequence.token() to the given token id, text and offset.
Parameters:
  offset - expected offset. It may be -1 to prevent offset testing.



assertTokenEquals
public static void assertTokenEquals(TokenSequence ts, TokenId id, String text, int offset, int lookahead, Object state)(Code)



assertTokenEquals
public static void assertTokenEquals(String message, TokenSequence ts, TokenId id, String text, int offset, int lookahead, Object state)(Code)



assertTokenFlyweight
public static void assertTokenFlyweight(Token token)(Code)



assertTokenNotFlyweight
public static void assertTokenNotFlyweight(Token token)(Code)



assertTokenOffsetsEqual
public static void assertTokenOffsetsEqual(String message, int offset1, int offset2)(Code)



assertTokenSequencesEqual
public static void assertTokenSequencesEqual(TokenSequence expected, TokenHierarchy expectedHi, TokenSequence actual, TokenHierarchy actualHi, boolean testLookaheadAndState)(Code)

See Also:   LexerTestUtilities.assertTokenSequencesEqual(String,TokenSequence,TokenHierarchy,TokenSequence,TokenHierarchy,boolean)



assertTokenSequencesEqual
public static void assertTokenSequencesEqual(String message, TokenSequence expected, TokenHierarchy expectedHi, TokenSequence actual, TokenHierarchy actualHi, boolean testLookaheadAndState)(Code)
Compare contents of the given token sequences by moving through all their tokens.
Token hierarchies are given to check implementations of the Token.offset(TokenHierarchy) - useful for checking of token snapshots.
Parameters:
  message - message to display (may be null).
Parameters:
  expected - non-null token sequence to be compared to the other token sequence.
Parameters:
  expectedHi - token hierarchy to which expected relates.
Parameters:
  actual - non-null token sequence to be compared to the other token sequence.
Parameters:
  actualHi - token hierarchy to which actual relates.
Parameters:
  testLookaheadAndState - whether lookahead and states should be checkedor not. Generally it should be true but for snapshots checking it mustbe false because snapshots do not hold lookaheads and states.



checkTokenDump
public static void checkTokenDump(NbTestCase test, String relFilePath, Language language) throws Exception(Code)
Check whether token descriptions dump file (a file with added suffix ".tokens.txt") for the given input file exists and whether it has the same content like the one obtained by lexing the input file.
It allows to test whether the tested lexer still produces the same tokens.
The method will only pass successfully if both the input file and token descriptions files exist and the token descriptions file contains the same information as the generated files.
If the token descriptions file does not exist the method will create it.
As the lexer's behavior at the EOF is important and should be well tested there is a support for splitting input file virtually into multiple inputs by virtual EOF - see TokenDumpTokenId for details.
Also there is possibility to specify special chars - see TokenDumpTokenId for details.
Parameters:
  test - non-null test (used for calling test.getDataDir()).
Parameters:
  relFilePath - non-null file path relative to datadir of the test.
For example if "testfiles/testinput.mylang.txt" gets passed the test method willsearch for new File(test.getDataDir() + "testfiles/testinput.mylang.txt"),read its content, lex it and create token descriptions. Then it will search for new File(test.getDataDir() + "testfiles/testinput.mylang.txt.tokens.txt")and it will compare the file content with the generated descriptions.



collectionsEqual
public static boolean collectionsEqual(Collection c1, Collection c2)(Code)



debugText
public static String debugText(CharSequence text)(Code)
Return the given text as String translating the special characters (and '\') into escape sequences.
Parameters:
  text - non-null text to be debugged. non-null string containing the debug text.



debugTextOrNull
public static String debugTextOrNull(CharSequence text)(Code)
Return the given text as String translating the special characters (and '\') into escape sequences.
Parameters:
  text - non-null text to be debugged. non-null string containing the debug text or "".



flyweightDistribution
public static List<Integer> flyweightDistribution(TokenSequence ts)(Code)
Compute distribution of flyweight token lengths accross the given token sequence.
Parameters:
  ts - non-null token sequence. non-null list containing number of the flyweight tokens that have the lengthequal to the index in the list.



flyweightTextLength
public static int flyweightTextLength(TokenSequence ts)(Code)
Compute total number of characters represented by flyweight tokens in the given token sequence.
Parameters:
  ts - non-null token sequence. number of characters contained in the flyweight tokensin the token sequence.



flyweightTokenCount
public static int flyweightTokenCount(TokenSequence ts)(Code)
Compute number of flyweight tokens in the given token sequence.
Parameters:
  ts - non-null token sequence. number of flyweight tokens in the token sequence.



getLastDocumentEvent
public static DocumentEvent getLastDocumentEvent(Document doc)(Code)



getLastTokenHierarchyEvent
public static TokenHierarchyEvent getLastTokenHierarchyEvent(Document doc)(Code)



incCheck
public static void incCheck(Document doc, boolean nested)(Code)



initLastDocumentEventListening
public static void initLastDocumentEventListening(Document doc)(Code)



initLastTokenHierarchyEventListening
public static void initLastTokenHierarchyEventListening(Document doc)(Code)



lookahead
public static int lookahead(TokenSequence ts)(Code)
Get lookahead for the token to which the token sequence is positioned.
The method uses reflection to get reference to tokenList field in token sequence.



setTesting
public static void setTesting(boolean testing)(Code)
Set whether the lexer should run in testing mode where there are some additional correctness checks performed.



state
public static Object state(TokenSequence ts)(Code)
Get state for the token to which the token sequence is positioned.
The method uses reflection to get reference to tokenList field in token sequence.



textEquals
public static boolean textEquals(CharSequence text1, CharSequence text2)(Code)
Compare whether the two character sequences represent the same text.



tokenList
public static TokenList<T> tokenList(TokenSequence<T> ts)(Code)
Get token list from the given token sequence for testing purposes.



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)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.