public double doOperation() throws OperatorFailedException {
  CoalescentSimulator simulator=new CoalescentSimulator();
  List<TaxonList> taxonLists=new ArrayList<TaxonList>();
  double rootHeight=-1.0;
  double oldLikelihood=0.0;
  double newLikelihood=0.0;
  for (int i=0; i < xo.getChildCount(); i++) {
    final Object child=xo.getChild(i);
    if (child instanceof Tree) {
    }
 else     if (child instanceof TaxonList) {
      taxonLists.add((Taxa)child);
      break;
    }
  }
  try {
    Tree[] trees=new Tree[taxonLists.size()];
    for (int i=0; i < taxonLists.size(); i++) {
      trees[i]=simulator.simulateTree(taxonLists.get(i),demoModel);
    }
    oldLikelihood=coalescent.getLogLikelihood();
    SimpleTree simTree=simulator.simulateTree(trees,demoModel,rootHeight,trees.length != 1);
    treeModel.beginTreeEdit();
    treeModel.adoptTreeStructure(simTree);
    treeModel.endTreeEdit();
    newLikelihood=coalescent.getLogLikelihood();
  }
 catch (  IllegalArgumentException iae) {
    try {
      throw new XMLParseException(iae.getMessage());
    }
 catch (    XMLParseException e) {
      e.printStackTrace();
    }
  }
  return oldLikelihood - newLikelihood;
}

public double doOperation ( ) throws OperatorFailedException { CoalescentSimulator simulator = new CoalescentSimulator ( ) ; List < TaxonList > taxonLists = new ArrayList < TaxonList > ( ) ; double rootHeight = - 1.0 ; double oldLikelihood = 0.0 ; double newLikelihood = 0.0 ; for ( int i = 0 ; i < xo . getChildCount ( ) ; i ++ ) { final Object child = xo . getChild ( i ) ; if ( child instanceof Tree ) { } else if ( child instanceof TaxonList ) { taxonLists . add ( ( Taxa ) child ) ; break ; } } try { Tree [ ] trees = new Tree [ taxonLists . size ( ) ] ; for ( int i = 0 ; i < taxonLists . size ( ) ; i ++ ) { trees [ i ] = simulator . simulateTree ( taxonLists . get ( i ) , demoModel ) ; } oldLikelihood = coalescent . getLogLikelihood ( ) ; SimpleTree simTree = simulator . simulateTree ( trees , demoModel , rootHeight , trees . length != 1 ) ; treeModel . beginTreeEdit ( ) ; treeModel . adoptTreeStructure ( simTree ) ; treeModel . endTreeEdit ( ) ; newLikelihood = coalescent . getLogLikelihood ( ) ; } catch ( IllegalArgumentException iae ) { try { throw new XMLParseException ( iae . getMessage ( ) ) ; } catch ( XMLParseException e ) { e . printStackTrace ( ) ; } } return oldLikelihood - newLikelihood ; }
change the parameter and return the hastings ratio .
