コード例 #1
0
 /*.................................................................................................................*/
 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);
 }
コード例 #2
0
 /*.................................................................................................................*/
 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);
 }
コード例 #3
0
 /*.................................................................................................................*/
 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);
 }
コード例 #4
0
 /** 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;
 }
コード例 #5
0
 /*.................................................................................................................*/
 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;
 }
コード例 #6
0
 public String getNameAndParameters() {
   return characterSourceTask.getNameAndParameters();
 }
コード例 #7
0
 public String getParameters() {
   if (characterSourceTask == null) return null;
   return characterSourceTask.getName() + " (" + characterSourceTask.getParameters() + ")";
 }
コード例 #8
0
 public void prepareItemColors(Taxa taxa) {
   if (characterSourceTask != null) characterSourceTask.prepareItemColors(taxa);
 }
コード例 #9
0
 public Color getItemColor(Taxa taxa, int ic) {
   if (characterSourceTask != null) return characterSourceTask.getItemColor(taxa, ic);
   return null;
 }
コード例 #10
0
 public double getItemWeight(Taxa taxa, int ic) {
   if (characterSourceTask != null) return characterSourceTask.getItemWeight(taxa, ic);
   return MesquiteDouble.unassigned;
 }
コード例 #11
0
 public boolean itemsHaveWeights(Taxa taxa) {
   if (characterSourceTask != null) return characterSourceTask.itemsHaveWeights(taxa);
   return false;
 }
コード例 #12
0
 public void setEnableWeights(boolean enable) {
   if (characterSourceTask != null) characterSourceTask.setEnableWeights(enable);
 }
コード例 #13
0
 public Selectionable getSelectionable() {
   if (characterSourceTask != null) return characterSourceTask.getSelectionable();
   else return null;
 }
コード例 #14
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) {
   characterSourceTask.initialize(taxa);
 }