/*.................................................................................................................*/
 public String getCharacterName(Taxa taxa, int ic) {
   CharacterObedSource oldSource = characterSourceTask;
   String name = characterSourceTask.getCharacterName(taxa, ic);
   if (oldSource
       == characterSourceTask) // i.e., old source hasn't quit and been replaced during above call!
   return name;
   return characterSourceTask.getCharacterName(taxa, ic);
 }
 /*.................................................................................................................*/
 public CharacterDistribution getCharacter(Taxa taxa, int ic) {
   CharacterObedSource oldSource = characterSourceTask;
   CharacterDistribution matrix = characterSourceTask.getCharacter(taxa, ic);
   if (oldSource
       == characterSourceTask) // i.e., old source hasn't quit and been replaced during above call!
   return matrix;
   return characterSourceTask.getCharacter(taxa, ic);
 }
 /*.................................................................................................................*/
 public int getNumberOfCharacters(Taxa taxa) {
   CharacterObedSource oldSource = characterSourceTask;
   int num = characterSourceTask.getNumberOfCharacters(taxa);
   if (oldSource
       == characterSourceTask) // i.e., old source hasn't quit and been replaced during above call!
   return num;
   return characterSourceTask.getNumberOfCharacters(taxa);
 }
 /** condition passed to this module must be subclass of CharacterState */
 public boolean startJob(String arguments, Object condition, boolean hiredByName) {
   hiringCondition = condition;
   String exp, mexp;
   if (getExplanationByWhichHired() != null) {
     exp = getExplanationByWhichHired();
     mexp = exp;
   } else {
     exp = "Source of Characters  (for " + getEmployer().getName() + ")";
     mexp = exp;
   }
   MesquiteModuleInfo mmi =
       MesquiteTrunk.mesquiteModulesInfoVector.findModule(
           mesquite.charMatrices.StoredCharacters.StoredCharacters.class);
   if (mmi != null && !mmi.isCompatible(condition, getProject(), this)) {
     if (!MesquiteDialog.useWizards) {
       exp +=
           "\n\nNOTE: The choice Stored Characters does not appear because there are no appropriate matrices currently defined and stored in the data file or project.  ";
     }
   } else if (CharacterSource.useStoredAsDefault()) {
     characterSourceTask =
         (CharacterObedSource)
             hireNamedEmployee(
                 CharacterObedSource.class,
                 "#mesquite.charMatrices.StoredCharacters.StoredCharacters",
                 condition);
   }
   if (characterSourceTask == null) {
     if (arguments == null) arguments = MesquiteThread.retrieveAndDeleteHint(this);
     if (arguments != null)
       characterSourceTask =
           (CharacterObedSource)
               hireNamedEmployee(CharacterObedSource.class, arguments, condition);
     if (characterSourceTask == null) {
       if (condition != null)
         characterSourceTask =
             (CharacterObedSource)
                 hireCompatibleEmployee(CharacterObedSource.class, condition, exp);
       else
         characterSourceTask = (CharacterObedSource) hireEmployee(CharacterObedSource.class, exp);
     }
   }
   if (characterSourceTask == null)
     return sorry(getName() + " couldn't start because no source of characters was obtained.");
   charSourceName = new MesquiteString(characterSourceTask.getName());
   cstC = makeCommand("setCharacterSource", this);
   characterSourceTask.setHiringCommand(cstC);
   if (numModulesAvailable(CharacterObedSource.class) > 1) {
     mss = addSubmenu(null, mexp, cstC, CharacterObedSource.class);
     mss.setNameHolder(this);
     if (condition != null) mss.setCompatibilityCheck(hiringCondition);
     mss.setSelected(charSourceName);
   }
   return true;
 }
 /*.................................................................................................................*/
 public Object doCommand(String commandName, String arguments, CommandChecker checker) {
   if (checker.compare(
       this.getClass(),
       "Sets module supplying characters",
       "[name of module]",
       commandName,
       "setCharacterSource")) {
     CharacterObedSource newCharacterSourceTask;
     if (hiringCondition != null)
       newCharacterSourceTask =
           (CharacterObedSource)
               replaceCompatibleEmployee(
                   CharacterObedSource.class,
                   arguments,
                   characterSourceTask,
                   hiringCondition); // , "Source of characters"
     else
       newCharacterSourceTask =
           (CharacterObedSource)
               replaceEmployee(
                   CharacterObedSource.class,
                   arguments,
                   "Source of characters",
                   characterSourceTask);
     if (newCharacterSourceTask != null) {
       characterSourceTask = newCharacterSourceTask;
       characterSourceTask.setHiringCommand(cstC);
       charSourceName.setValue(characterSourceTask.getName());
       resetContainingMenuBar();
       parametersChanged();
       return characterSourceTask;
     } else {
       discreetAlert(
           "Unable to activate character source \""
               + arguments
               + "\"  for use by "
               + employer.getName());
     }
   } else if (characterSourceTask != null) { // todo: temporary, for snapshot conversions
     return characterSourceTask.doCommand(commandName, arguments, checker);
   } else return super.doCommand(commandName, arguments, checker);
   return null;
 }
 public String getNameAndParameters() {
   return characterSourceTask.getNameAndParameters();
 }
 public String getParameters() {
   if (characterSourceTask == null) return null;
   return characterSourceTask.getName() + " (" + characterSourceTask.getParameters() + ")";
 }
 public void prepareItemColors(Taxa taxa) {
   if (characterSourceTask != null) characterSourceTask.prepareItemColors(taxa);
 }
 public Color getItemColor(Taxa taxa, int ic) {
   if (characterSourceTask != null) return characterSourceTask.getItemColor(taxa, ic);
   return null;
 }
 public double getItemWeight(Taxa taxa, int ic) {
   if (characterSourceTask != null) return characterSourceTask.getItemWeight(taxa, ic);
   return MesquiteDouble.unassigned;
 }
 public boolean itemsHaveWeights(Taxa taxa) {
   if (characterSourceTask != null) return characterSourceTask.itemsHaveWeights(taxa);
   return false;
 }
 public void setEnableWeights(boolean enable) {
   if (characterSourceTask != null) characterSourceTask.setEnableWeights(enable);
 }
 public Selectionable getSelectionable() {
   if (characterSourceTask != null) return characterSourceTask.getSelectionable();
   else 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) {
   characterSourceTask.initialize(taxa);
 }