140 likes | 223 Views
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. Code Recommendation phase. Code completion phases.
E N D
Demo 1 • Given a text file, use Scanner object to read tokens in that text file: Using following objects: File, Scanner And control: while()
Code completion phases • # 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()
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()
Code completion phases • # tokens filled by developer: (ArrayList, arlist, if) =3 • # tokens filled by Grapacc: (new, ArrayList, arlist, size) = 4