[Jmatlink-commitlog] jmatlink/src/jmatlink JMatLink.java,1.21,1.22 CoreJMatLink.java,1.13,1.14
Brought to you by:
st_mueller
|
From: Stefan M. <st_...@us...> - 2005-11-02 18:44:21
|
Update of /cvsroot/jmatlink/jmatlink/src/jmatlink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13752/src/jmatlink Modified Files: JMatLink.java CoreJMatLink.java Log Message: comments and removed a function from CoreJMatLink Index: CoreJMatLink.java =================================================================== RCS file: /cvsroot/jmatlink/jmatlink/src/jmatlink/CoreJMatLink.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** CoreJMatLink.java 1 Nov 2005 21:07:50 -0000 1.13 --- CoreJMatLink.java 2 Nov 2005 18:44:06 -0000 1.14 *************** *** 24,28 **** package jmatlink; ! import java.io.*; import java.util.Vector; --- 24,28 ---- package jmatlink; ! //import java.io.*; import java.util.Vector; *************** *** 582,604 **** /** Get an 'char' array (string) from MATLAB's workspace. */ ! public synchronized String[] engGetCharArray(String arrayS) ! { ! // convert to double array ! engEvalString( "engGetCharArrayD=double(" + arrayS +")" ); ! ! // get double array ! double[][] arrayD = engGetVariable("engGetCharArrayD"); ! ! // delete temporary double array ! engEvalString("clear engGetCharArrayD"); ! ! // If array "engGetCharArrayD" does not exist in MATLAB's workspace ! // immediately return null ! if (arrayD == null) return null; ! ! // convert double back to char ! return double2String( arrayD ); ! } ! --- 582,603 ---- /** Get an 'char' array (string) from MATLAB's workspace. */ ! // public synchronized String[] engGetCharArray(String arrayS) ! //{ ! // // convert to double array ! // engEvalString( "engGetCharArrayD=double(" + arrayS +")" ); ! // ! // // get double array ! // double[][] arrayD = engGetVariable("engGetCharArrayD"); ! // ! // // delete temporary double array ! // engEvalString("clear engGetCharArrayD"); ! // ! // // If array "engGetCharArrayD" does not exist in MATLAB's workspace ! // // immediately return null ! // if (arrayD == null) return null; ! // ! // // convert double back to char ! // return double2String( arrayD ); ! //} *************** *** 885,912 **** // Convert an n*n double array to n*1 String vector ! private String[] double2String(double[][] d) ! { ! ! // Check if array is not empty ! if (d == null) ! { ! /* double[][] array is NULL */ ! return null; ! } ! ! String encodeS[]=new String[d.length]; // String vector ! ! // for all rows ! for (int n=0; n<d.length; n++){ ! byte b[] = new byte[d[n].length]; ! // convert row from double to byte ! for (int i=0; i<d[n].length ;i++) b[i]=(byte)d[n][i]; ! ! // convert byte to String ! try { encodeS[n] = new String(b, "UTF8");} ! catch (UnsupportedEncodingException e) {} ! } ! return encodeS; ! } // end double2String } // end class JMatLink --- 884,911 ---- // Convert an n*n double array to n*1 String vector ! // private String[] double2String(double[][] d) ! //{ ! // ! // // Check if array is not empty ! // if (d == null) ! // { ! // // double[][] array is NULL ! // return null; ! // } ! // ! // String encodeS[]=new String[d.length]; // String vector ! // ! // // for all rows ! // for (int n=0; n<d.length; n++){ ! // byte b[] = new byte[d[n].length]; ! // // convert row from double to byte ! // for (int i=0; i<d[n].length ;i++) b[i]=(byte)d[n][i]; ! // ! // // convert byte to String ! // try { encodeS[n] = new String(b, "UTF8");} ! // catch (UnsupportedEncodingException e) {} ! // } ! // return encodeS; ! //} // end double2String } // end class JMatLink Index: JMatLink.java =================================================================== RCS file: /cvsroot/jmatlink/jmatlink/src/jmatlink/JMatLink.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** JMatLink.java 27 Oct 2005 20:36:12 -0000 1.21 --- JMatLink.java 2 Nov 2005 18:44:06 -0000 1.22 *************** *** 25,29 **** // current version of JMatLink ! private final String VERSION = "JMatLink_V01_01_00"; /** This is the constructor for the JMatLink library. --- 25,29 ---- // current version of JMatLink ! private final String VERSION = "JMatLink_V1.2.0"; /** This is the constructor for the JMatLink library. *************** *** 46,49 **** --- 46,54 ---- /** Returns the current version of JMatLink * + * <p>E.g.:<br> + * <pre> + * JMatLink engine = new JMatLink(); + * System.out.println("version 0 "+ <b>engine.getVersion()</b>); + * </pre> * @return VERSION of JMatLink */ *************** *** 94,107 **** { int i=0; while (i<10) { if ((coreJMatLink.getThreadStatus() == CoreJMatLink.THREAD_RUNNING) || (coreJMatLink.getThreadStatus() == CoreJMatLink.THREAD_DEAD)) { coreJMatLink.engOpen(startCmdS); return; } ! System.out.println("J starting or dying"); i++; try { --- 99,118 ---- { int i=0; + + // try to start the engine 10 times while (i<10) { + // check if engine is running or dead, and then try to open a new engine connection if ((coreJMatLink.getThreadStatus() == CoreJMatLink.THREAD_RUNNING) || (coreJMatLink.getThreadStatus() == CoreJMatLink.THREAD_DEAD)) { + // thread is running or dead -> call engine open function coreJMatLink.engOpen(startCmdS); return; } ! // if this code part is reached the engine thread is starting or dying ! // -> wait some time and then check all over again ! if (debugB) System.out.println("J starting or dying"); i++; try { *************** *** 110,116 **** catch (InterruptedException e){} } throw(new JMatLinkException("engine still starting or dying")); - //coreJMatLink.engOpen(startCmdS); } --- 121,129 ---- catch (InterruptedException e){} } + + // if this part is reached the engine thread has been in a transition phase + // dying or starting for a very long period of time without completion throw(new JMatLinkException("engine still starting or dying")); } *************** *** 157,167 **** int i=0; while (i<10) { if ((coreJMatLink.getThreadStatus() == CoreJMatLink.THREAD_RUNNING) || (coreJMatLink.getThreadStatus() == CoreJMatLink.THREAD_DEAD)) return coreJMatLink.engOpenSingleUse(startCmdS); ! System.out.println("J starting or dying"); i++; try { --- 170,188 ---- int i=0; + + // try to start the engine 10 times while (i<10) { + // check if engine is running or dead, and then try to open a new engine connection if ((coreJMatLink.getThreadStatus() == CoreJMatLink.THREAD_RUNNING) || (coreJMatLink.getThreadStatus() == CoreJMatLink.THREAD_DEAD)) + { + // thread is running or dead -> call engine open function return coreJMatLink.engOpenSingleUse(startCmdS); + } ! // if this code part is reached the engine thread is starting or dying ! // -> wait some time and then check all over again ! if (debugB) System.out.println("J starting or dying"); i++; try { *************** *** 170,175 **** catch (InterruptedException e){} } throw(new JMatLinkException("engine still starting or dying")); ! } --- 191,199 ---- catch (InterruptedException e){} } + + // if this part is reached the engine thread has been in a transition phase + // dying or starting for a very long period of time without completion throw(new JMatLinkException("engine still starting or dying")); ! } *************** *** 230,237 **** ! /** * ! * @param epI ! * @param visB */ public void engSetVisible(long epI, boolean visB) --- 254,261 ---- ! /** Set the visibility of the Matlab window * ! * @param epI engine handle ! * @param visB desired visiblity true/false */ public void engSetVisible(long epI, boolean visB) *************** *** 241,248 **** ! /** * ! * @param epI ! * @return */ public boolean engGetVisible(long epI) --- 265,272 ---- ! /** return the visibility status of the Matlab window * ! * @param epI engine handle ! * @return visiblity true/false */ public boolean engGetVisible(long epI) *************** *** 424,431 **** ! // public void engPutArray( String arrayS, int[] valuesI ) ! // { ! // engPutArray( this.epI, arrayS, (double[])valuesI ); ! // } // public void engPutArray( String arrayS, long valuesI ) --- 448,455 ---- ! // public void engPutArray( String arrayS, int[] valuesI ) ! // { ! // engPutArray( this.epI, arrayS, (double[])valuesI ); ! // } // public void engPutArray( String arrayS, long valuesI ) |