Examples of using Grapacc
Demo 1 Given a text file, use Scanner object to read tokens in that text file: Using following objects: File, Scanner And control: while()
Developer filling phase Developer input objects and while control. Each task should be enclosed in one method as in example.
Code Recommendation phase Developer press Ctrl + Space to call code completion tool. Based on the context of objects and controls, Grapacc will suggest relevant patterns
Code completion phases After Developer choosing the most relevant pattern and pressing Enter, Grapacc will automatically fill additional code into corresponding location in the program.Developer will count number of tokens filled by himself and by Grapacc (or copy from Google without change if he uses Google Code Search). # tokens filled by developer: (File, f, new, File, Scanner, sc, while) = 7 # tokens filled by Grapacc: (new, Scanner, f, sc,hasNext, sc,Next) = 6
Demo 2 Given an ArrayList, read all of its element using iterator: Using following objects: ArrayList, Iterator And control: for()
Developer filling phase
Code Recommendation phase
Code completion phases # tokens filled by developer: (ArrayList, arlist, for) =3 # tokens filled by Grapacc: (new, ArrayList, Iterator, it, arlist, iterator, for, it, hasNext, it, Next) = 11
Demo 3 Given an ArrayList, check if its size >0: Using following objects: ArrayList And control: if()
Developer filling phase
Code Recommendation phase
Code completion phases # tokens filled by developer: (ArrayList, arlist, if) =3 # tokens filled by Grapacc: (new, ArrayList, arlist, size) = 4
Table of counted tokens Task Use #Tokens filled by developer #Tokens filled by Grapacc #Tokens copied from Google Demo1 Grapacc 7 6 NA Developer will send Anh the summary table for each tasks.