Пример #1
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;
 }