/*.................................................................................................................*/
 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;
 }
Exemplo 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;
 }
Exemplo 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();
 }
Exemplo 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();
 }
Exemplo n.º 6
0
 /** queryies the user to choose a tree and returns an integer of the tree chosen */
 public int queryUserChoose(Taxa taxa, String forMessage) {
   int ic = MesquiteInteger.unassigned;
   int numBlocks = getNumberOfTreeBlocks(taxa);
   if (MesquiteInteger.isCombinable(numBlocks)) {
     String[] s = new String[numBlocks];
     for (int i = 0; i < numBlocks; i++) {
       s[i] = getTreeBlockNameString(taxa, i);
     }
     if (forMessage == null) {
       forMessage = "Choose tree block";
     }
     return ListDialog.queryList(
         containerOfModule(), "Choose tree block", forMessage, MesquiteString.helpString, s, 0);
   } else {
     if (forMessage == null) {
       forMessage = "Number of tree block to be used";
     }
     int r = MesquiteInteger.queryInteger(containerOfModule(), "Choose tree block", forMessage, 1);
     if (MesquiteInteger.isCombinable(r)) return MesquiteTree.toInternal(r);
     else return r;
   }
 }
Exemplo n.º 7
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;
 }