/*.................................................................................................................*/
 public Object doCommand(String commandName, String arguments, CommandChecker checker) {
   if (checker.compare(
       this.getClass(),
       "Sets the number of trees included in each tree block",
       "[number of trees]",
       commandName,
       "setNumberTrees")) {
     MesquiteInteger pos = new MesquiteInteger(0);
     int newNum = MesquiteInteger.fromFirstToken(arguments, pos);
     if (!MesquiteInteger.isCombinable(newNum))
       newNum =
           MesquiteInteger.queryInteger(
               containerOfModule(),
               "Set Number of Trees",
               "Number of Trees:",
               numTrees,
               0,
               MesquiteInteger.infinite);
     if (newNum > 0 && newNum != numTrees) {
       numTrees = newNum;
       parametersChanged();
     }
   } else if (checker.compare(
       this.getClass(),
       "Returns the module supplying trees",
       "[name of module]",
       commandName,
       "getTreeFiller")) {
     return fillerTask;
   } else return super.doCommand(commandName, arguments, checker);
   return null;
 }
Ejemplo n.º 2
0
 /*.................................................................................................................*/
 public boolean startJob(String arguments, Object condition, boolean hiredByName) {
   if (!MesquiteThread.isScripting()) {
     int s =
         MesquiteInteger.queryInteger(
             containerOfModule(),
             "Number of taxa to exclude",
             "Enter the number of randomly chosen taxa to exclude",
             numExcluded);
     if (MesquiteInteger.isCombinable(s)) numExcluded = s;
     else return false;
   }
   addMenuItem("Number of Taxa Excluded...", makeCommand("setNumberExcluded", this));
   return true;
 }
Ejemplo n.º 3
0
 /**
  * Called to provoke any necessary initialization. This helps prevent the module's intialization
  * queries to the user from happening at inopportune times (e.g., while a long chart calculation
  * is in mid-progress)
  */
 public void initialize(Taxa taxa) {
   setPreferredTaxa(taxa);
   fillerTask.initialize(taxa);
   if (!fillerTask.hasLimitedTrees(taxa)) {
     if (!MesquiteThread.isScripting() && !nTreesSet) {
       int n =
           MesquiteInteger.queryInteger(
               containerOfModule(),
               "Trees per block?",
               "How many trees to include per tree block?",
               numTrees);
       if (MesquiteInteger.isCombinable(n) && n > 0) numTrees = n;
       nTreesSet = true;
     }
   }
   ntreesItem.setEnabled(!fillerTask.hasLimitedTrees(taxa));
   MesquiteTrunk.resetMenuItemEnabling();
 }
Ejemplo n.º 4
0
 /*.................................................................................................................*/
 public Object doCommand(String commandName, String arguments, CommandChecker checker) {
   if (checker.compare(
       this.getClass(),
       "Sets the number of trees included in each tree block",
       "[number of trees]",
       commandName,
       "setNumberTrees")) {
     MesquiteInteger pos = new MesquiteInteger(0);
     int newNum = MesquiteInteger.fromFirstToken(arguments, pos);
     if (!MesquiteInteger.isCombinable(newNum))
       newNum =
           MesquiteInteger.queryInteger(
               containerOfModule(),
               "Set Number of Trees",
               "Number of Trees:",
               numTrees,
               0,
               MesquiteInteger.infinite);
     if (newNum > 0 && newNum != numTrees) {
       numTrees = newNum;
       parametersChanged();
     }
   } else if (checker.compare(
       this.getClass(),
       "Sets the module supplying trees",
       "[name of module]",
       commandName,
       "setTreeFiller")) {
     TreeBlockFiller temp =
         (TreeBlockFiller)
             replaceEmployee(
                 TreeBlockFiller.class, arguments, "Source of trees for tree blocks", fillerTask);
     if (temp != null) {
       fillerTask = temp;
       initialize(preferredTaxa);
       parametersChanged(); // ?
     }
     return temp;
   } else return super.doCommand(commandName, arguments, checker);
   return null;
 }
 /**
  * Called to provoke any necessary initialization. This helps prevent the module's intialization
  * queries to the user from happening at inopportune times (e.g., while a long chart calculation
  * is in mid-progress)
  */
 public void initialize(Taxa taxa) {
   setPreferredTaxa(taxa);
   fillerTask.initialize(taxa);
   if (!fillerTask.hasLimitedTrees(taxa)) {
     if (!MesquiteThread.isScripting() && !nTreesSet) {
       int n =
           MesquiteInteger.queryInteger(
               containerOfModule(),
               "Trees per block?",
               "How many trees to include per tree block?",
               numTrees);
       if (MesquiteInteger.isCombinable(n) && n > 0) numTrees = n;
       nTreesSet = true;
     }
   }
   if (enableNumTreesChoice() && ntreesItem == null)
     ntreesItem = addMenuItem("Number of Trees...", makeCommand("setNumberTrees", this));
   if (ntreesItem != null && fillerTask != null)
     ntreesItem.setEnabled(!fillerTask.hasLimitedTrees(taxa));
   MesquiteTrunk.resetMenuItemEnabling();
 }
Ejemplo n.º 6
0
 /*.................................................................................................................*/
 public Object doCommand(String commandName, String arguments, CommandChecker checker) {
   if (checker.compare(
       this.getClass(),
       "Sets the number of randomly chosen taxa to exclude",
       "[number]",
       commandName,
       "setNumberExcluded")) {
     int s = MesquiteInteger.fromString(parser.getFirstToken(arguments));
     if (!MesquiteInteger.isCombinable(s)) {
       s =
           MesquiteInteger.queryInteger(
               containerOfModule(),
               "Number of taxa to exclude",
               "Enter the number of randomly chosen taxa to exclude",
               numExcluded);
     }
     if (MesquiteInteger.isCombinable(s)) {
       numExcluded = s;
       parametersChanged();
     }
   } else return super.doCommand(commandName, arguments, checker);
   return null;
 }