/**
  * Decodes a given String into a choice of the appropriate type. The String format to be passed
  * into this method is defined solely by the return result of the encodeChoice method. There is no
  * guarantee that the encoding is human readable, simply that the encoding is uniquely identifying
  * such that this method is capable of decoding the String into the choice object.
  *
  * @param persistentFormat The String which should be decoded to provide the choice of the
  *     appropriate type.
  * @return A choice object of the appropriate type that was encoded in the given String.
  */
 @Override
 public T decodeChoice(LoadContext context, String persistentFormat) {
   String choiceStr = persistentFormat;
   if (choiceActor instanceof CategorizedChooser) {
     return ((CategorizedChooser<T>) choiceActor).decodeChoice(choiceStr, category);
   }
   return choiceActor.decodeChoice(context, choiceStr);
 }
 /**
  * Encodes the given choice into a String sufficient to uniquely identify the choice. This may not
  * sufficiently encode to be stored into a file or format which restricts certain characters (such
  * as URLs), it simply encodes into an identifying String. There is no guarantee that this
  * encoding is human readable, simply that the encoding is uniquely identifying such that the
  * decodeChoice method of the PersistentTransitionChoice is capable of decoding the String into
  * the choice object.
  *
  * @param item The choice which should be encoded into a String sufficient to identify the choice.
  * @return A String sufficient to uniquely identify the choice.
  */
 @Override
 public String encodeChoice(T item) {
   return choiceActor.encodeChoice(item);
 }
 @Override
 public void removeChoice(PlayerCharacter pc, CDOMObject owner, T item) {
   choiceActor.removeChoice(pc, owner, item);
 }
 /**
  * Decodes a given String into a choice of the appropriate type. The String format to be passed
  * into this method is defined solely by the return result of the encodeChoice method. There is no
  * guarantee that the encoding is human readable, simply that the encoding is uniquely identifying
  * such that this method is capable of decoding the String into the choice object.
  *
  * @param persistenceFormat The String which should be decoded to provide the choice of the
  *     appropriate type.
  * @return A choice object of the appropriate type that was encoded in the given String.
  */
 @Override
 public T decodeChoice(LoadContext context, String persistenceFormat) {
   return choiceActor.decodeChoice(context, persistenceFormat);
 }
Example #5
0
 private void setChooserWanted(String name, boolean want) {
   for (int i = 0; i < choosers.size(); i++) {
     Chooser chooser = (Chooser) choosers.get(i);
     if (chooser.name.equals(name)) chooser.isWanted = want;
   }
 }