in progress
authorcmzmasek <cmzmasek@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Mon, 21 May 2012 03:17:52 +0000 (03:17 +0000)
committercmzmasek <cmzmasek@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Mon, 21 May 2012 03:17:52 +0000 (03:17 +0000)
forester/java/src/org/forester/archaeopteryx/tools/PhylogeneticInferrer.java
forester/java/src/org/forester/archaeopteryx/tools/ProcessPool.java

index 7e0ec77..4f17c69 100644 (file)
@@ -64,7 +64,7 @@ public class PhylogeneticInferrer implements Runnable {
     private final MainFrameApplication         _mf;
     private final PhylogeneticInferenceOptions _options;
     private final List<Sequence>               _seqs;
-    private final boolean DEBUG = true;
+    private final boolean                      DEBUG           = true;
     public final static String                 MSA_FILE_SUFFIX = ".aln";
     public final static String                 PWD_FILE_SUFFIX = ".pwd";
 
@@ -89,9 +89,9 @@ public class PhylogeneticInferrer implements Runnable {
     private Msa inferMsa() throws IOException, InterruptedException {
         final File temp_seqs_file = File.createTempFile( "__msa__temp__", ".fasta" );
         if ( DEBUG ) {
-        System.out.println();
-        System.out.println( "temp file: " + temp_seqs_file );
-        System.out.println();
+            System.out.println();
+            System.out.println( "temp file: " + temp_seqs_file );
+            System.out.println();
         }
         //final File temp_seqs_file = new File( _options.getTempDir() + ForesterUtil.FILE_SEPARATOR + "s.fasta" );
         final BufferedWriter writer = new BufferedWriter( new FileWriter( temp_seqs_file ) );
@@ -170,7 +170,7 @@ public class PhylogeneticInferrer implements Runnable {
                                                "Failed to Calculate MSA",
                                                JOptionPane.ERROR_MESSAGE );
                 if ( DEBUG ) {
-                e.printStackTrace();
+                    e.printStackTrace();
                 }
                 return;
             }
@@ -183,7 +183,7 @@ public class PhylogeneticInferrer implements Runnable {
                                                "Unexpected Exception During MSA Calculation",
                                                JOptionPane.ERROR_MESSAGE );
                 if ( DEBUG ) {
-                e.printStackTrace();
+                    e.printStackTrace();
                 }
                 return;
             }
@@ -197,8 +197,8 @@ public class PhylogeneticInferrer implements Runnable {
                 return;
             }
             if ( DEBUG ) {
-            System.out.println( msa.toString() );
-            System.out.println( MsaMethods.calcBasicGapinessStatistics( msa ).toString() );
+                System.out.println( msa.toString() );
+                System.out.println( MsaMethods.calcBasicGapinessStatistics( msa ).toString() );
             }
             final MsaMethods msa_tools = MsaMethods.createInstance();
             if ( _options.isExecuteMsaProcessing() ) {
@@ -216,9 +216,9 @@ public class PhylogeneticInferrer implements Runnable {
                 }
             }
             if ( DEBUG ) {
-            System.out.println( msa_tools.getIgnoredSequenceIds() );
-            System.out.println( msa.toString() );
-            System.out.println( MsaMethods.calcBasicGapinessStatistics( msa ).toString() );
+                System.out.println( msa_tools.getIgnoredSequenceIds() );
+                System.out.println( msa.toString() );
+                System.out.println( MsaMethods.calcBasicGapinessStatistics( msa ).toString() );
             }
             _msa = msa;
         }
index 0c4ed99..0e58ca2 100644 (file)
@@ -30,6 +30,7 @@ import java.util.List;
 \r
 public class ProcessPool {\r
 \r
+    private final static boolean                   DEBUG      = true;\r
     final static private ArrayList<ProcessRunning> _processes = new ArrayList<ProcessRunning>();\r
 \r
     public synchronized ProcessRunning getProcessByIndex( final int i ) {\r
@@ -53,15 +54,22 @@ public class ProcessPool {
         final ProcessRunning p = ProcessRunning.createInstance( name );\r
         final int id = p.getId();\r
         if ( getProcessById( id ) != null ) {\r
-            throw new IllegalStateException( "process with id " + id + "already exists" );\r
+            throw new IllegalStateException( " process with id " + id + "already exists" );\r
         }\r
         getProcesses().add( p );\r
+        if ( DEBUG ) {\r
+            System.out.println( "added: " + p );\r
+        }\r
         return id;\r
     }\r
 \r
     public synchronized boolean removeProcess( final int id ) {\r
         final int i = getProcessIndexById( id );\r
         if ( i >= 0 ) {\r
+            if ( DEBUG ) {\r
+                final ProcessRunning p = getProcessById( id );\r
+                System.out.println( " removing: " + p );\r
+            }\r
             getProcesses().remove( i );\r
             return true;\r
         }\r