@@ -0,0 +1,1851 @@
+/*%0A * To change this template, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage stockanalysis;%0A%0A/**%0A *%0A * @author rodrigoa%0A */%0Aimport java.io.*;%0Aimport java.awt.Frame;%0Aimport java.awt.FileDialog;%0A%0Aimport java.util.Enumeration;%0A%0Aimport org.rosuda.JRI.Rengine;%0Aimport org.rosuda.JRI.REXP;%0Aimport org.rosuda.JRI.RList;%0Aimport org.rosuda.JRI.RVector;%0Aimport org.rosuda.JRI.RMainLoopCallbacks;%0A%0Aclass TextConsole implements RMainLoopCallbacks%0A%7B%0A    public void rWriteConsole(Rengine re, String text, int oType) %7B%0A        System.out.print(text);%0A    %7D%0A    %0A    public void rBusy(Rengine re, int which) %7B%0A        System.out.println(%22rBusy(%22+which+%22)%22);%0A    %7D%0A    %0A    public String rReadConsole(Rengine re, String prompt, int addToHistory) %7B%0A        System.out.print(prompt);%0A        try %7B%0A            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));%0A            String s=br.readLine();%0A            return (s==null%7C%7Cs.length()==0)?s:s+%22%5Cn%22;%0A        %7D catch (Exception e) %7B%0A            System.out.println(%22jriReadConsole exception: %22+e.getMessage());%0A        %7D%0A        return null;%0A    %7D%0A    %0A    public void rShowMessage(Rengine re, String message) %7B%0A        System.out.println(%22rShowMessage %5C%22%22+message+%22%5C%22%22);%0A    %7D%0A%09%0A    public String rChooseFile(Rengine re, int newFile) %7B%0A%09FileDialog fd = new FileDialog(new Frame(), (newFile==0)?%22Select a file%22:%22Select a new file%22, (newFile==0)?FileDialog.LOAD:FileDialog.SAVE);%0A%09fd.show();%0A%09String res=null;%0A%09if (fd.getDirectory()!=null) res=fd.getDirectory();%0A%09if (fd.getFile()!=null) res=(res==null)?fd.getFile():(res+fd.getFile());%0A%09return res;%0A    %7D%0A    %0A    public void   rFlushConsole (Rengine re) %7B%0A    %7D%0A%09%0A    public void   rLoadHistory  (Rengine re, String filename) %7B%0A    %7D%09%09%09%0A    %0A    public void   rSaveHistory  (Rengine re, String filename) %7B%0A    %7D%09%09%09%0A%7D%0A

Create TextConsole.java