JAL-2872 Undid inference disabling (done in Jalview instead)
[jalview.git] / forester / java / src / org / forester / evoinference / matrix / character / BasicCharacterStateMatrix.java
index 7b1055f..573bab0 100644 (file)
@@ -26,6 +26,7 @@
 package org.forester.evoinference.matrix.character;
 
 import java.io.IOException;
+import java.io.StringWriter;
 import java.io.Writer;
 import java.util.HashMap;
 import java.util.List;
@@ -120,6 +121,7 @@ public class BasicCharacterStateMatrix<S> implements CharacterStateMatrix<S> {
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public boolean equals( final Object o ) {
         if ( this == o ) {
             return true;
@@ -216,6 +218,7 @@ public class BasicCharacterStateMatrix<S> implements CharacterStateMatrix<S> {
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public S getState( final int identifier_index, final int character_index ) {
         return ( S ) _states[ identifier_index ][ character_index ];
     }
@@ -311,6 +314,19 @@ public class BasicCharacterStateMatrix<S> implements CharacterStateMatrix<S> {
         }
         setState( _identifier_index_map.get( identifier ), _character_index_map.get( character ), state );
     }
+    
+    
+    public String toString() {
+        StringWriter w = new StringWriter();
+        try {
+            toForester( w );
+        }
+        catch ( IOException e ) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        return w.toString();
+    }
 
     private void toForester( final Writer writer ) throws IOException {
         final int longest = getLengthOfLongestState() + 5;
@@ -395,10 +411,7 @@ public class BasicCharacterStateMatrix<S> implements CharacterStateMatrix<S> {
         }
     }
 
-    //TODO
-    //to format for microarray-style clustering
-    // states are ints in this case
-    //TODO
+   
     @Override
     public void toWriter( final Writer writer ) throws IOException {
         toForester( writer );