You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to javap...@googlegroups.com
hi, i am new to JavaParser. part of my research is to modify the contents of a specific method. for example suppose the following method
public void mymethod() { long l1=System.currentTimeMillis(); for(int j=1;j<imax;j++) a[j]=b[j]+c[j]; long l2=System.currentTimeMillis(); System.out.println("Time Consumed: "+(l2-l1)); }
and i have to modify the loop (for / while etc) and convert it into two loops like
public void mymethod() { long l1=System.currentTimeMillis();
for(int j=1;j<imax;j++) a[j]=b[j]+c[j];
for(int j=imax/2;j<imax;j++) a[j]=b[j]+c[j];
long l2=System.currentTimeMillis(); System.out.println("Time Consumed: "+(l2-l1)); }
this is an example. i have got the body of the method in a string using the n.getBody() method. now the question is "whether to use my own code to edit the body (available in a string) and prepare the complete string. or there is some direct way in JavaParser to understand and modify the contents of the body".
hope it would be clear now. thanks in advance !
Matías Costa
unread,
Jan 14, 2013, 3:49:04 PM1/14/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
There you can analize the for and do whatever transformation you need. Do not forget the <for(A a: x) > statement that sometimes is equivalent to the <for> you are interested.