<commit_before>package baseCodeTest.gui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.UIManager;

import baseCode.gui.JMatrixDisplay;

/**
 * This is an example of how you'd display a microarray.
 * 
 * @author <NAME>
 * @version $Id$
 */
public class MatrixDisplayApp {
   boolean packFrame = false;

   //Construct the application
   public MatrixDisplayApp( String inDataFilename, String outPngFilename ) {

      JFrame frame = new JFrame();
      frame.getContentPane().setLayout( new BorderLayout() );
      frame.setSize( new Dimension( 600, 550 ) );
      frame.setTitle( "Eisen Plot" );

      //
      // Here is an example of how you'd display a matrix of doubles
      // visually with colors
      //
      JMatrixDisplay matrixDisplay = null;
      try {
         matrixDisplay = new JMatrixDisplay( inDataFilename );
      } catch ( java.io.IOException e ) {
         System.err.println( "Unable to open file " + inDataFilename );
         return;
      }

      matrixDisplay.setLabelsVisible( true );

      try {
         boolean showLabels = true;

         matrixDisplay.saveImage( outPngFilename, showLabels );
      } catch ( java.io.IOException e ) {
         System.err.println( "Unable to save screenshot to file "
               + outPngFilename );
         return;
      }

      frame.getContentPane().add( matrixDisplay, BorderLayout.CENTER );

      //Validate frames that have preset sizes
      //Pack frames that have useful preferred size info, e.g. from their
      // layout
      if ( packFrame ) {
         frame.pack();
      } else {
         frame.validate();
      }
      //Center the window
      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
      Dimension frameSize = frame.getSize();
      if ( frameSize.height > screenSize.height ) {
         frameSize.height = screenSize.height;
      }
      if ( frameSize.width > screenSize.width ) {
         frameSize.width = screenSize.width;
      }
      frame.setLocation( ( screenSize.width - frameSize.width ) / 2,
            ( screenSize.height - frameSize.height ) / 2 );
      frame.setVisible( true );

      // toggle between standardized and not a few times
      boolean isShowingStandardized = matrixDisplay.getStandardizedEnabled();
      for ( int i = 0; i < 5; i++ ) {
         try {
            Thread.sleep( 1000 );
            isShowingStandardized = !isShowingStandardized;
            matrixDisplay.setStandardizedEnabled( isShowingStandardized );
            matrixDisplay.repaint();
         } catch ( InterruptedException e ) {
         }
      }
   }

   //Main method: args[0] can contain the name of the data file
   public static void main( String[] args ) {
      try {
         UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
      } catch ( Exception e ) {
         e.printStackTrace();
      }
      if ( args.length > 1 ) {
         new MatrixDisplayApp( args[0], args[1] );
      } else {
         System.err
               .println( "Please specify dataFilename and outPngFilename by passing them as program arguments" );
      }
   }
}<commit_msg>no message<commit_after>package baseCodeTest.gui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.UIManager;

import baseCode.gui.JMatrixDisplay;
import baseCode.gui.ColorMap;

/**
 * This is an example of how you'd display a microarray.
 * 
 * @author <NAME>
 * @version $Id$
 */
public class MatrixDisplayApp {
   boolean packFrame = false;

   //Construct the application
   public MatrixDisplayApp( String inDataFilename, String outPngFilename ) {

      JFrame frame = new JFrame();
      frame.getContentPane().setLayout( new BorderLayout() );
      frame.setSize( new Dimension( 600, 550 ) );
      frame.setTitle( "Eisen Plot" );

      //
      // Here is an example of how you'd display a matrix of doubles
      // visually with colors
      //
      JMatrixDisplay matrixDisplay = null;
      try {
         matrixDisplay = new JMatrixDisplay( inDataFilename );
      } catch ( java.io.IOException e ) {
         System.err.println( "Unable to open file " + inDataFilename );
         return;
      }

      matrixDisplay.setLabelsVisible( true );

      try {
         boolean showLabels = true;

         matrixDisplay.saveImage( outPngFilename, showLabels );
      } catch ( java.io.IOException e ) {
         System.err.println( "Unable to save screenshot to file "
               + outPngFilename );
         return;
      }

      frame.getContentPane().add( matrixDisplay, BorderLayout.CENTER );

      //Validate frames that have preset sizes
      //Pack frames that have useful preferred size info, e.g. from their
      // layout
      if ( packFrame ) {
         frame.pack();
      } else {
         frame.validate();
      }
      //Center the window
      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
      Dimension frameSize = frame.getSize();
      if ( frameSize.height > screenSize.height ) {
         frameSize.height = screenSize.height;
      }
      if ( frameSize.width > screenSize.width ) {
         frameSize.width = screenSize.width;
      }
      frame.setLocation( ( screenSize.width - frameSize.width ) / 2,
            ( screenSize.height - frameSize.height ) / 2 );
      frame.setVisible( true );
      
      matrixDisplay.setStandardizedEnabled( true );

      // use the green-red color map
      try {
         matrixDisplay.setColorMap( ColorMap.GREENRED_COLORMAP );
      }
      catch( IllegalArgumentException e ) {}
      
      matrixDisplay.setStandardizedEnabled( false );
      
      
//      for ( int i = 0; i < 5; i++ ) {
//         try {
//            Thread.sleep( 1000 );
//            isShowingStandardized = !isShowingStandardized;
//            matrixDisplay.setStandardizedEnabled( isShowingStandardized );
//            matrixDisplay.repaint();
//         } catch ( InterruptedException e ) {
//         }
//      }
   }

   //Main method: args[0] can contain the name of the data file
   public static void main( String[] args ) {
      try {
         UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
      } catch ( Exception e ) {
         e.printStackTrace();
      }
      if ( args.length > 1 ) {
         new MatrixDisplayApp( args[0], args[1] );
      } else {
         System.err
               .println( "Please specify dataFilename and outPngFilename by passing them as program arguments" );
      }
   }
}
{'fraction_non_alphanumeric': 0.10089110406283039, 'fraction_numerical': 0.005437245129134572, 'mean_word_length': 2.194404245055475, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4142526', 'n_tokens_mistral': 1861, 'n_tokens_neox': 1808, 'n_words': 487}