Click here to load reader

Examples of using Grapacc

  • Upload
    bette

  • View
    31

  • Download
    0

Embed Size (px)

DESCRIPTION

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. - PowerPoint PPT Presentation

Citation preview

Slide 1

Examples of using GrapaccDemo 1Given a text file, use Scanner object to read tokens in that text file:Using following objects: File, ScannerAnd control: while()Developer filling phase

Developer input objects and while control. Each task should be enclosed in one method as in example.3Code Recommendation phase

Developer press Ctrl + Space to call code completion tool. Based on the context of objects and controls, Grapacc will suggest relevant patterns4Code 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

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).5Demo 2Given an ArrayList, read all of its element using iterator:Using following objects: ArrayList, IteratorAnd 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 3Given an ArrayList, check if its size >0:Using following objects: ArrayListAnd 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 tokensTaskUse#Tokens filled by developer#Tokens filled by Grapacc#Tokens copied from GoogleDemo1Grapacc76NADeveloper will send Anh the summary table for each tasks.14