Java Doc for SyntaxUtils.java in  » IDE » tIDE » tide » utils » 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 » tIDE » tide.utils 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   tide.utils.SyntaxUtils

SyntaxUtils
public class SyntaxUtils (Code)
To fetch syntax info directly from source string representation. Quicker than javaCC, used for edit and completion purposes. Other advantage: parses locally, also when not globally valid.


Field Summary
static  MatchercastMatcher
    
static  MatcherfalseCastMatcher
    
final public static  PatternjavaAbsoluteIdentifierPattern
    
final public static  TreeSet<String>javaKeywords
    
final public static  PatternjavaNamePattern
    
final public static  TreeSet<String>modifiers
    
final public static  TreeSet<String>primitiveTypes
    
final static  Patternpublicstaticvoidmain
    


Method Summary
public static  StringconvertVmNameToFullJavaNames(String className)
     [I => int[] (defined in Class.getName()).
public static  intcountLinesUpToPosition(String txt, int pos)
    
public static  StringcreateVariableNameFromClassName(String cn)
    
public static  String[]extractModifiersAndType(String modAndType)
     without generics parameters.
public static  intgetArgumentNumberAtEnd(String as)
     Given an argument string, like "123, var, nd(1), 2", the number of the argument (0 for the first).
public static  ParsedIDgetJavaIdentifierBefore(SimpleDocument doc, int pos, String prepend)
     Takes greedilly a full java identifier before the position given. Used from document filter when "." is pressed somewhere for completion purposes. Quick and not requiring a compilable state... xxx.
public static  StringgetJavaNameSimpleIfLongForView(String jn)
    
public static  StringgetNameForVMNativeType(char charType)
     I => int, ...
public static  StringgetPackageName(String jn)
    
public static  booleanhasStaticMainMethod(String txt)
     Not really robust, but is a minimal condition to look before trying to execute some class.
public static  booleanisInComment(String txt, int posItem)
    
public static  booleanisInString(String txt, int posItem)
    
public static  booleanisKeyWord(String w)
    
public static  booleanisModifier(String w)
    
public static  booleanisPrimitiveType(String w)
    
public static  booleanisValidIdentifier(String id)
     a.b.d is valid, 12.43 not.
public static  voidmain(String[] aa)
    
public static  StringmakeAllJavaNamesSimpleInText(String signature)
     java.lang.String hello(myApp.XYZ var) => String hello(XYZ var) NOT ROBUST: => only simplify if the guessed package name is lowercase.
public static  StringmakeSingleJavaNameSimple(String jn)
     Suitable for a single name, like java.lang.Object => Object.
public static  intmatchingEndBrace(CharSequence text, int pos, char open, char end)
    
public static  ArrayList<String>[]parseSignatureAfterForJavaDoc(String doc, int pos)
     Used in javadoc completion.
public static  StringremoveAllArrayPartsAtEnd(String id)
     Removes all array [] elements at the end, including content internal: remove everything after the first "[" occurence.
public static  StringBuilderremoveAllContents(StringBuilder ids, char open, char end)
    
public static  StringremoveLastArrayPartAtEnd(String id)
    
public static  StringremoveSingleTypeParameters(String id)
     Map> => Map. the < and > must be balanced...
public static  Map<String, String>replaceAllCastsWithName(StringBuilder ids)
     Reduce casts ( ((Double)xxx).nono(23,43).doubleValue() => #{C:1}.nono().doubleValue() the map contains the replacements {1,Double}.
public static  Map<String, String>replaceAllTypeVariablesWithName(StringBuilder ids)
     Reduce type variables Vector => Vector#{TV:1} the map contains the replacements {1,String}.
public static  String[]splitTypeParams(String tp)
    

Field Detail
castMatcher
static Matcher castMatcher(Code)



falseCastMatcher
static Matcher falseCastMatcher(Code)



javaAbsoluteIdentifierPattern
final public static Pattern javaAbsoluteIdentifierPattern(Code)



javaKeywords
final public static TreeSet<String> javaKeywords(Code)
java keywords up to 1.6



javaNamePattern
final public static Pattern javaNamePattern(Code)



modifiers
final public static TreeSet<String> modifiers(Code)
Also present in the javaKeywords



primitiveTypes
final public static TreeSet<String> primitiveTypes(Code)
Also present in the javaKeywords



publicstaticvoidmain
final static Pattern publicstaticvoidmain(Code)





Method Detail
convertVmNameToFullJavaNames
public static String convertVmNameToFullJavaNames(String className)(Code)
[I => int[] (defined in Class.getName()). Names are NOT also in simple form. Used in the decompiledClass to match javap signatures ! Also used in JMapReader and JavaDocParser.



countLinesUpToPosition
public static int countLinesUpToPosition(String txt, int pos)(Code)
0 if the pos is on the first line.Just count the return backslash + n, ignore CRs



createVariableNameFromClassName
public static String createVariableNameFromClassName(String cn)(Code)



extractModifiersAndType
public static String[] extractModifiersAndType(String modAndType)(Code)
without generics parameters. {mods, type}, type being empty if none found (for constructors)type may have several items (as in "void hello")



getArgumentNumberAtEnd
public static int getArgumentNumberAtEnd(String as)(Code)
Given an argument string, like "123, var, nd(1), 2", the number of the argument (0 for the first). 4 in this case



getJavaIdentifierBefore
public static ParsedID getJavaIdentifierBefore(SimpleDocument doc, int pos, String prepend)(Code)
Takes greedilly a full java identifier before the position given. Used from document filter when "." is pressed somewhere for completion purposes. Quick and not requiring a compilable state... xxx. yyy.zzz => "xxx.yyy.zzz"; xxx. yy y.zzz => "y.zzz"; xxx.yyy(12.32, z())[8].zzz => xxx.yyy()[].zzz casts are reduced ((Double) xxx).doubleValue() => {C:Double}.doubleValue() type variable also Vector => Vector{TV:Double} Don't look at Character.isJavaIdentifierStart() limitations. Not very exact, somehow tolerant... the identifier, without spaces.TODO2: count args at level -1 of parenthesis (number of ",") , allow [ ] in argsApril2007: skip (ignore( the type params as in Vector() => Vector();May2007: improved
Parameters:
  prepend - "this." in the case of CTRL+space completion



getJavaNameSimpleIfLongForView
public static String getJavaNameSimpleIfLongForView(String jn)(Code)



getNameForVMNativeType
public static String getNameForVMNativeType(char charType)(Code)
I => int, ...



getPackageName
public static String getPackageName(String jn)(Code)
Example: snow.utils.gui.FileChooserFilter$SearchHit => snow.utils.gui



hasStaticMainMethod
public static boolean hasStaticMainMethod(String txt)(Code)
Not really robust, but is a minimal condition to look before trying to execute some class.



isInComment
public static boolean isInComment(String txt, int posItem)(Code)
in a comment iff preceded by some // on the same line // TODO: ignore " that are in literals !



isInString
public static boolean isInString(String txt, int posItem)(Code)
true if on the same line, an uneven number of " is presentTODO: odd slashes \ befor " invalidate themTODO: also look for '



isKeyWord
public static boolean isKeyWord(String w)(Code)



isModifier
public static boolean isModifier(String w)(Code)



isPrimitiveType
public static boolean isPrimitiveType(String w)(Code)
if one of [boolean, float, ..., void]



isValidIdentifier
public static boolean isValidIdentifier(String id)(Code)
a.b.d is valid, 12.43 not. keywords are not allowed, names starting with bad letter also not. (JFrame) as simplified cast form of ((JFrame) aa) is allowed



main
public static void main(String[] aa)(Code)



makeAllJavaNamesSimpleInText
public static String makeAllJavaNamesSimpleInText(String signature)(Code)
java.lang.String hello(myApp.XYZ var) => String hello(XYZ var) NOT ROBUST: => only simplify if the guessed package name is lowercase. => static method calls like String.hello remains unchanged



makeSingleJavaNameSimple
public static String makeSingleJavaNameSimple(String jn)(Code)
Suitable for a single name, like java.lang.Object => Object.



matchingEndBrace
public static int matchingEndBrace(CharSequence text, int pos, char open, char end)(Code)



parseSignatureAfterForJavaDoc
public static ArrayList<String>[] parseSignatureAfterForJavaDoc(String doc, int pos)(Code)
Used in javadoc completion. [0]: the return type [1]: the arguments names list (ONLY MADE) [2]: the throws listthis must be called from within a comment



removeAllArrayPartsAtEnd
public static String removeAllArrayPartsAtEnd(String id)(Code)
Removes all array [] elements at the end, including content internal: remove everything after the first "[" occurence.



removeAllContents
public static StringBuilder removeAllContents(StringBuilder ids, char open, char end)(Code)
the same passed ref for convenience.Removes all the content between the balanced open, end items.Useful for example to remove type params, "<", ">".



removeLastArrayPartAtEnd
public static String removeLastArrayPartAtEnd(String id)(Code)
Removes the last array [ ] element at the end, including content



removeSingleTypeParameters
public static String removeSingleTypeParameters(String id)(Code)
Map> => Map. the < and > must be balanced... uses first and lastindexof



replaceAllCastsWithName
public static Map<String, String> replaceAllCastsWithName(StringBuilder ids)(Code)
Reduce casts ( ((Double)xxx).nono(23,43).doubleValue() => #{C:1}.nono().doubleValue() the map contains the replacements {1,Double}.



replaceAllTypeVariablesWithName
public static Map<String, String> replaceAllTypeVariablesWithName(StringBuilder ids)(Code)
Reduce type variables Vector => Vector#{TV:1} the map contains the replacements {1,String}.



splitTypeParams
public static String[] splitTypeParams(String tp)(Code)
{name, params} for example {String, null} as in "String" or {Vector, String} as in Vector.or {Class[], ?} as in "Class[]"



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.