/*
 * Hanoi.java
 *
 * Created on 11 de Outubro de 2006, 01:52
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package towersofhanoi;

import utils.*;

/**
 *
 * @author ismael
 */
public class Hanoi {  
  /**
   * @param args the command line arguments
   */
  public static void main(String[] args) {
    // TODO code application logic here
    if( args.length != 2) {
      System.out.println("Sintaxe: java " + Hanoi.class.getName() + " nrDisks seq|par|sync" );
      System.exit(1);
    }
    int nrDisks = Integer.parseInt(args[0]);
    
    ExecutionModel exec = null;
    if( args[1].toLowerCase().equals("seq") ) {
      System.out.println("=> ExecSeq ");
      exec = new ExecSeq(nrDisks);
    } else if( args[1].toLowerCase().equals("par") ){
      System.out.println("=> ExecParallel ");
      exec = new ExecParallel(nrDisks);
    } else if( args[1].toLowerCase().equals("sync") ){
      System.out.println("=> ExecParallelSync ");
      exec = new ExecParallelSync(nrDisks);
    }
    exec.pre();
    exec.doit();
    exec.cleanup();
  }
}