Esempio n. 1
0
  // Store Line of dialog
  private void storeLine(String line) {
    // Split line so character name and dialog are seperated.
    String[] splitLine = line.split("\t", 2);

    if (splitLine.length < 2) {
      return;
    }

    String character = splitLine[0].toLowerCase(); // Store character name
    character =
        updateName(
            character); // Check to see if name needs to be changed (eg. "inez" is also = "mrs.
                        // wong")

    // Add character to episode (unless is a background character)
    if (!isBackgroundCharacter(character)) {

      int i = findCharacter(character);

      if (i < 0) { // If chracter does not exist
        Character chr =
            new Character(character, GLOBAL.COLORS.getNextColor()); // make a new Character object
        chr.addAppearence(
            ALL_CHARACTERS
                .get(lastCharacter)
                .getName()); // Add the previous Character to its HashMap

        ALL_CHARACTERS.add(chr); // Add Character object to ArrayList
        ep.addCharacter(chr); // Add Character object to Episode

        lastCharacter = ALL_CHARACTERS.size() - 1; // Store index of this Character
      } else { // Add Character object to Episode
        ALL_CHARACTERS.get(i).addAppearence(ALL_CHARACTERS.get(lastCharacter).getName());
        ep.addCharacter(ALL_CHARACTERS.get(i));
        lastCharacter = i; // Store index of this Character
      }

      // Determine if current line is a catchphrase of character
      findCatchphrase(character, splitLine[1]);
    }
  }
Esempio n. 2
0
 // Create characters that have catchprases
 //	This is opposed to all other characters created dynamically (when parsing transcripts).
 //		& allows for phrases.txt to be parsed before the transcripts.
 private void createCatchphraseCharacters() {
   for (int x = 0; x < phraseChars.length; ++x) {
     ALL_CHARACTERS.add(new Character(phraseChars[x], GLOBAL.COLORS.getNextColor()));
   }
 }