示例#1
0
  public void test_equals() {
    Character ch1 = new Character('+');
    Character ch2 = new Character('+');
    Character ch3 = new Character('-');

    harness.check(!(!ch1.equals(ch2) || ch1.equals(ch3) || ch1.equals(null)), "test_equals - 1");
  }
  /**
   * Transforma a expressão com símbolos especiais para uma expressão equivalente com símbolos
   * primitivos Exemplo: 'a+' = 'aa*'
   *
   * @param expr
   * @return
   */
  public static String traduzirSimbolosEspeciais(String expr) {
    while (expr.indexOf("+") != -1) {
      int pos = expr.indexOf("+");

      String duplicate = expr.substring(pos - 1, pos);

      // Para expressões regulares do tipo '(ab)+', devemos duplicar todo o conteúdo dentro do
      // parêntese
      if (duplicate.equals(")")) {
        int depth = 0; // nível atual de parênteses
        for (int i = pos - 1; i >= 0; i--) {
          Character c = expr.charAt(i);
          if (c.equals(')')) {
            depth++;
          } else if (c.equals('(')) {
            depth--;
          }

          if (depth == 0) {
            duplicate = expr.substring(i, pos);
            break;
          }
        }
      }

      expr = expr.replaceFirst("\\+", duplicate + "*");
    }

    return expr;
  }
  /**
   * @param clazz the class to be handled (read from and wrote to)
   * @param file the file to be processed
   */
  public void handleConfig(Class<?> clazz, File file) {
    if (!hasRun) {
      hasRun = true;
      for (Field field : clazz.getDeclaredFields()) {
        for (Annotation annotation : field.getAnnotations()) {
          if (annotation.annotationType() == Config.String.class)
            handleString(clazz, field, (Config.String) annotation);
          else if (annotation.annotationType() == Config.Integer.class)
            handleInteger(clazz, field, (Config.Integer) annotation);
          else if (annotation.annotationType() == Config.Boolean.class)
            handleBoolean(clazz, field, (Config.Boolean) annotation);
          else if (annotation.annotationType() == Config.List.class)
            handleList(clazz, field, (Config.List) annotation);
          else if (annotation.annotationType() == Config.Map.class)
            handleMap(clazz, field, (Config.Map) annotation);
          else if (annotation.annotationType() == Config.Long.class)
            handleLong(clazz, field, (Config.Long) annotation);
          else if (annotation.annotationType() == Config.Float.class)
            handleFloat(clazz, field, (Config.Float) annotation);
          else if (annotation.annotationType() == Config.Double.class)
            handleDouble(clazz, field, (Config.Double) annotation);
          else if (annotation.annotationType() == Config.Character.class)
            handleCharacter(clazz, field, (Config.Character) annotation);
        }
      }
    }

    try (BufferedReader reader =
        new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"))) {
      String line;
      while ((line = reader.readLine()) != null) {
        if (line.contains("{")) {
          char[] chars = line.toCharArray();
          boolean hasNotEncounteredText = true;
          StringBuilder stringBuilder = new StringBuilder();
          for (Character character : chars) {
            if ((!character.equals(' ') && !character.equals('\t')) || hasNotEncounteredText) {
              hasNotEncounteredText = false;
              stringBuilder.append(character);
            } else if (character.equals(' ')) break;
          }
          categories
              .getOrDefault(stringBuilder.toString(), categories.get("General"))
              .read(clazz, reader);
        }
      }
    } catch (IOException ignored) {
    }

    StringBuilder stringBuilder = new StringBuilder();
    categories.values().forEach(category -> category.write(stringBuilder));
    String fileString = stringBuilder.toString();

    try (BufferedWriter writer =
        new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"))) {
      writer.append(fileString);
    } catch (IOException ignored) {
    }
  }
示例#4
0
  @Override
  public boolean equals(final Object obj) {
    if (this == obj) {
      return true;
    }
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }

    final CSVFormat other = (CSVFormat) obj;
    if (delimiter != other.delimiter) {
      return false;
    }
    if (quotePolicy != other.quotePolicy) {
      return false;
    }
    if (quoteChar == null) {
      if (other.quoteChar != null) {
        return false;
      }
    } else if (!quoteChar.equals(other.quoteChar)) {
      return false;
    }
    if (commentStart == null) {
      if (other.commentStart != null) {
        return false;
      }
    } else if (!commentStart.equals(other.commentStart)) {
      return false;
    }
    if (escape == null) {
      if (other.escape != null) {
        return false;
      }
    } else if (!escape.equals(other.escape)) {
      return false;
    }
    if (!Arrays.equals(header, other.header)) {
      return false;
    }
    if (ignoreSurroundingSpaces != other.ignoreSurroundingSpaces) {
      return false;
    }
    if (ignoreEmptyLines != other.ignoreEmptyLines) {
      return false;
    }
    if (recordSeparator == null) {
      if (other.recordSeparator != null) {
        return false;
      }
    } else if (!recordSeparator.equals(other.recordSeparator)) {
      return false;
    }
    return true;
  }
  public Boundary predict(Collection<Chunk> chunks) {
    if (chunks == null || chunks.size() < 2) return null;

    List<Chunk> sortedChunks = new LinkedList<Chunk>(chunks);
    Collections.sort(sortedChunks);

    int leftBoundaryWidth = 0;
    int rightBoundaryWidth = 0;

    boolean leftMatches = true;
    boolean rightMatches = true;

    Chunk chunk0 = sortedChunks.get(0);
    String whole = chunk0.getWhole();

    do {
      Character leftBoundaryChar = chunk0.getSymbolOutside(-leftBoundaryWidth - 1);
      Character rightBoundaryChar = chunk0.getSymbolOutside(rightBoundaryWidth + 1);

      if (leftBoundaryChar != null) {
        for (int i = 1; i < sortedChunks.size(); i++) {
          Chunk iChunk = sortedChunks.get(i);
          if (!leftBoundaryChar.equals(iChunk.getSymbolOutside(-leftBoundaryWidth - 1)))
            leftMatches = false;
        }
        if (leftMatches) {
          leftBoundaryWidth++;
        }
      } else {
        leftMatches = false;
      }

      if (rightBoundaryChar != null) {
        for (int i = 1; i < sortedChunks.size(); i++) {
          Chunk iChunk = sortedChunks.get(i);
          if (!rightBoundaryChar.equals(iChunk.getSymbolOutside(rightBoundaryWidth + 1)))
            rightMatches = false;
        }
        if (rightMatches) {
          rightBoundaryWidth++;
        }
      } else {
        rightMatches = false;
      }

      if (!leftMatches && !rightMatches && leftBoundaryWidth == 0 && rightBoundaryWidth == 0)
        return null;

    } while (leftMatches || rightMatches);

    String start =
        whole.substring(chunk0.getStartIndex() - leftBoundaryWidth, chunk0.getStartIndex());
    String end = whole.substring(chunk0.getEndIndex(), chunk0.getEndIndex() + rightBoundaryWidth);

    return new Boundary(start, end);
  }
示例#6
0
 private void process(Character command) {
   if (command.equals('L')) {
     turnLeft();
   } else if (command.equals('R')) {
     turnRight();
   } else if (command.equals('M')) {
     move();
   } else {
     throw new IllegalArgumentException("Speak in Mars language, please!");
   }
 }
 private static boolean checkWildcardCompatibility(String txt1, String txt2) {
   if (txt1.length() != txt2.length()) {
     return false;
   }
   for (int i = 0; i < txt1.length(); i++) {
     Character t1 = txt1.charAt(i);
     Character t2 = txt2.charAt(i);
     if (!(t1.equals('*') || t2.equals('*') || t1.equals(t2))) {
       return false;
     }
   }
   return true;
 }
  /**
   * Retorna em qual posição da expressão encontra-se o operador especificado, sem "entrar" em
   * parênteses Ou seja, sub-expressões dentro de parênteses não são consideradas pela busca Retorna
   * -1 caso o caracter não tenha sido encontrado
   *
   * @param expr
   * @param op
   * @return A primeira posição encontrada do operador op ou -1 caso não encontrado
   */
  public static int posOperador(String expr, Character op) {
    int nivel = 0; // Nível atual de parêntese
    int i = 0;
    for (Character e : expr.toCharArray()) {
      if (e.equals('(')) {
        nivel++;
      } else if (e.equals(')')) {
        nivel--;
      } else if (e.equals(op) && nivel == 0) {
        return i;
      }
      i++;
    }

    return -1;
  }
示例#9
0
  public static void main(String[] args) throws Exception {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

    // алфавит
    String abc = "абвгдеёжзийклмнопрстуфхцчшщъыьэюя";
    char[] abcArray = abc.toCharArray();

    ArrayList<Character> alphabet = new ArrayList<Character>();
    for (int i = 0; i < abcArray.length; i++) {
      alphabet.add(abcArray[i]);
    }

    // ввод строк
    ArrayList<String> list = new ArrayList<String>();
    for (int i = 0; i < 10; i++) {
      String s = reader.readLine();
      list.add(s.toLowerCase());
    }

    String s = "";
    for (int i = 0; i < list.size(); i++) s += list.get(i).toString();

    // бежим по массиву букв
    for (Character c1 : alphabet) {
      int count = 0;
      for (Character c2 : s.toCharArray()) // бежим по массиву строки
      {
        if (c2.equals(c1)) count++; // если символы совпадают, то счетчик +1
      }
      System.out.println(
          c1 + " " + count); // по окончании проверки печатаем и переходим к следующей букве
    }

    // напишите тут ваш код
  }
  /**
   * Move the cursor <i>where</i> characters, withough checking the current buffer.
   *
   * @see #where
   * @param where the number of characters to move to the right or left.
   */
  private final void moveInternal(final int where) throws IOException {
    // debug ("move cursor " + where + " ("
    // + buf.cursor + " => " + (buf.cursor + where) + ")");
    buf.cursor += where;

    char c;

    if (where < 0) {
      int len = 0;
      for (int i = buf.cursor; i < buf.cursor - where; i++) {
        if (buf.getBuffer().charAt(i) == '\t') len += TAB_WIDTH;
        else len++;
      }

      char cbuf[] = new char[len];
      Arrays.fill(cbuf, BACKSPACE);
      out.write(cbuf);

      return;
    } else if (buf.cursor == 0) {
      return;
    } else if (mask != null) {
      c = mask.charValue();
    } else {
      printCharacters(buf.buffer.substring(buf.cursor - where, buf.cursor).toCharArray());
      return;
    }

    // null character mask: don't output anything
    if (NULL_MASK.equals(mask)) {
      return;
    }

    printCharacters(c, Math.abs(where));
  }
示例#11
0
  public String modify() {
    // actually, uses just for account access reset
    DAO dao = new DAO();
    UserManagement userTmp = new UserManagement();
    UserManagement userToModify = new UserManagement();
    userTmp.setUserCode(userToModify.getUserCode());
    UserManagement userFromDB = new UserManagement();
    userFromDB =
        (UserManagement)
            dao.load(
                UserManagement.class,
                UserParamSearchBB.userManagementAPasser.getUserCode(),
                userTmp);
    if (userFromDB.getNbreSessionConnected() != 0) {

      BuildMessage.addMessage(
          null, "User activity detected: ", "  he can't be updated", FacesMessage.SEVERITY_ERROR);

      return null;
    }

    if (!(userName.length() > 0)) {

      BuildMessage.addMessage(
          null, "User validation: ", " User name is required", FacesMessage.SEVERITY_ERROR);
      return null;
    }

    if (ipAddress != null && ipAddress.trim() == "" && ipAddressMang.equals("Y")) {

      BuildMessage.addMessage(
          null, "IP management: ", " User IP address is required", FacesMessage.SEVERITY_ERROR);
      return null;
    }

    if (!(dateEndPass != null) && expirationMang.equals('Y')) {

      BuildMessage.addMessage(
          null,
          "Password management: ",
          " Expiry date for password is required",
          FacesMessage.SEVERITY_ERROR);
      return null;
    }

    buildUserWithoutPassword(userFromDB);

    dao.saveOrUpdate(userFromDB);
    // dao.delete(userFromDB.getUserHabilitationParams());
    returnMessageBeforeTrx(
        "userManagement",
        userFromDB.getUserCode(),
        userFromDB.getUserName(),
        dao.isSuccessOperation(),
        'U');
    dao.getSession().flush();
    UserParamSearchBB.actionDone = false;
    return null;
  }
示例#12
0
  protected Token TrataOperadorRelacional() throws Exception {
    String op = "" + caracter;
    Token tk = null;
    switch (op) {
      case "<":
        lerCaracter();
        if (caracter.equals('=')) {
          op = op + caracter;
          token.add(new Token("<=", "smenorig"));
          tk = new Token("<=", "smenorig");
          lerCaracter();
        } else {
          token.add(new Token("<", "smenor"));
          tk = new Token("<", "smenor");
        }
        break;
      case ">":
        lerCaracter();
        if (caracter.equals('=')) {
          op = op + caracter;
          token.add(new Token(">=", "smaiorig"));
          tk = new Token(">=", "smaiorig");
          lerCaracter();
        } else {
          token.add(new Token(">", "smaior"));
          tk = new Token(">", "smaior");
        }
        break;
      case "=":
        token.add(new Token("=", "sig"));
        tk = new Token("=", "sig");
        lerCaracter();
        break;
      case "!":
        lerCaracter();
        if (caracter.equals('=')) {

          op = op + caracter;
          token.add(new Token("!=", "sdif"));
          tk = new Token("!=", "sdif");
          lerCaracter();
        } else break;
    }
    return tk;
  }
  @Override
  public void keyTyped(KeyEvent e) {
    Character c = e.getKeyChar();

    if (c.equals('\n') && charsRead == ID_LENGTH && !this.nid.equals("")) {
      nid = nid.substring(1, 9);

      addSubjectToAttendeeList(nid);
      card.updateModelViews();
    }

    if (c.equals(START_CHAR)) {
      enableRecorder();
      return;
    }

    // Not Recording Key Entries
    if (!this.recordingKeyEntry) {
      return;
    }

    // Error: ID too short
    if (c.equals(END_CHAR) && charsRead < ID_LENGTH) {
      disableRecroder();
      return;
    }

    // Error: id too long
    if (charsRead > ID_LENGTH) {
      disableRecroder();
      return;
    }

    // Valid: end valid length ID string
    if (c.equals(END_CHAR) && charsRead == ID_LENGTH) {
      disableRecroder();
      System.out.println(this.nid);
      // System.out.println(e.getSource().toString());
    }

    if (this.recordingKeyEntry) {
      this.nid = this.nid + c;
      ++charsRead;
    }
  }
示例#14
0
  private static Letter getLetterByName(Character name, List<Letter> letterList) {

    for (Letter letter : letterList) {
      if (name.equals(letter.getName())) {
        return letter;
      }
    }

    return null;
  }
示例#15
0
  /**
   * Verifies the consistency of the parameters and throws an IllegalStateException if necessary.
   *
   * @throws IllegalStateException
   */
  void validate() throws IllegalStateException {
    if (quoteChar != null && delimiter == quoteChar.charValue()) {
      throw new IllegalStateException(
          "The quoteChar character and the delimiter cannot be the same ('" + quoteChar + "')");
    }

    if (escape != null && delimiter == escape.charValue()) {
      throw new IllegalStateException(
          "The escape character and the delimiter cannot be the same ('" + escape + "')");
    }

    if (commentStart != null && delimiter == commentStart.charValue()) {
      throw new IllegalStateException(
          "The comment start character and the delimiter cannot be the same ('"
              + commentStart
              + "')");
    }

    if (quoteChar != null && quoteChar.equals(commentStart)) {
      throw new IllegalStateException(
          "The comment start character and the quoteChar cannot be the same ('"
              + commentStart
              + "')");
    }

    if (escape != null && escape.equals(commentStart)) {
      throw new IllegalStateException(
          "The comment start and the escape character cannot be the same ('" + commentStart + "')");
    }

    if (escape == null && quotePolicy == Quote.NONE) {
      throw new IllegalStateException("No quotes mode set but no escape character is set");
    }

    if (header != null) {
      final Set<String> set = new HashSet<String>(header.length);
      set.addAll(Arrays.asList(header));
      if (set.size() != header.length) {
        throw new IllegalStateException(
            "The header contains duplicate names: " + Arrays.toString(header));
      }
    }
  }
示例#16
0
文件: Main.java 项目: justam58/cs465
 public static String generateRandomSalt() {
   StringBuilder builder = new StringBuilder(saltLenth);
   for (int i = 0; i < saltLenth; i++) {
     Character c = availableChars.charAt(random.nextInt(availableChars.length()));
     while (c.equals('\\')) {
       c = availableChars.charAt(random.nextInt(availableChars.length()));
     }
     builder.append(c);
   }
   return builder.toString();
 }
示例#17
0
 Character[] orderArray1(Character[] ordering, Character[] input) {
   Collection<Character> results = new ArrayList<>();
   for (Character c1 : ordering) {
     for (Character c2 : input) {
       if (c2.equals(c1)) {
         results.add(c1);
       }
     }
   }
   return results.toArray(new Character[results.size()]);
 }
 private Boolean esParentesisRedundante(String criterio) {
   Character c;
   Stack<Character> pila = new Stack<Character>();
   for (Integer i = 0; i < criterio.length(); i++) {
     c = criterio.charAt(i);
     if (c.equals('(')) {
       pila.push(c);
     }
     if (c.equals(')')) {
       if (!pila.empty()) {
         pila.pop();
       } else {
         return false;
       }
     }
   }
   if (pila.empty()) {
     return true;
   } else {
     return false;
   }
 }
 private String getDelimiter(String text) {
   if (StringUtils.contains(text, "//") && StringUtils.indexOf(text, "//") == 0) {
     Character delimiterDummy = text.charAt(2);
     int end;
     for (end = 2; end < text.length(); end++) {
       Character currItem = text.charAt(end);
       if (!currItem.equals(delimiterDummy)) {
         break;
       }
     }
     return text.substring(2, end);
   }
   return null;
 }
示例#20
0
  protected Token TrataAtribuicao() throws Exception {

    lerCaracter();
    Token tk;
    if (caracter.equals('=')) {
      token.add(new Token(":=", "satribuicao"));
      tk = new Token(":=", "satribuicao");
      lerCaracter();
    } else {
      token.add(new Token(":", "sdoispontos"));
      tk = new Token(":", "sdoispontos");
    }
    return tk;
  }
示例#21
0
 private boolean verificarCadena(char[] evaluar) {
   boolean stay = true;
   for (int i = 0; i < evaluar.length; i++) {
     for (Character c : alfabeto) {
       if (c.equals(evaluar[i])) {
         stay = true;
         break;
       } else {
         stay = false;
       }
     }
   }
   return stay;
 }
示例#22
0
  protected Token TrataPontuacao() throws Exception {
    String op = "" + caracter;
    Token tk = null;
    switch (op) {
      case ".":
        token.add(new Token(op, "sponto"));
        tk = new Token(op, "sponto");
        break;

      case ";":
        token.add(new Token(op, "sponto_virgula"));
        tk = new Token(op, "sponto_virgula");
        this.flag_pontovirgula = true;
        break;

      case ",":
        token.add(new Token(op, "svirgula"));
        tk = new Token(op, "svirgula");
        break;

      case "(":
        token.add(new Token(op, "sabre_parenteses"));
        tk = new Token(op, "sabre_parenteses");
        break;

      case ")":
        token.add(new Token(op, "sfecha_parenteses"));
        tk = new Token(op, "sfecha_parenteses");
        break;
    }
    lerCaracter();
    /*
    if(this.flag_pontovirgula == true && !caracter.equals('\n') || !caracter.equals('\r')){
        System.out.println("Erro Ponto e Virgula");
        System.exit(-1);
    }
    else{
        this.flag_pontovirgula = false;
    }
    */
    if (caracter.equals('"')) {
      lerCaracter();
    }

    return tk;
  }
  private Map<Integer, Integer> obtenerPosicionesParentesisExternos(String expresion) {
    Map<Integer, Integer> result = new HashMap<Integer, Integer>();

    if (expresion.isEmpty()) return result;

    List<Integer> pilaParentesis = new ArrayList<Integer>();
    Character c;
    for (Integer i = 0; i < expresion.length(); i++) {
      c = expresion.charAt(i);
      if (c.equals('(')) pilaParentesis.add(i);
      if (c.equals(')')) {
        if (pilaParentesis.size() == 1) result.put(pilaParentesis.get(0), i);

        pilaParentesis.remove(pilaParentesis.size() - 1);
      }
    }

    return result;
  }
示例#24
0
  /** Test whether transitions are equal. */
  public static boolean transitionsEqual(Transition t1, Transition t2) {
    String name1 = t1.getDestination().getName();
    String name2 = t2.getDestination().getName();

    Character outchar1 = t1.getOutputCharacter();
    Character outchar2 = t2.getOutputCharacter();

    boolean outchars_equal;
    if (outchar1 == null) {
      outchars_equal = outchar2 == null;
    } else {
      outchars_equal = outchar1.equals(outchar2);
    }

    return name1.equals(name2)
        && t1.getInputCharacters().equals(t2.getInputCharacters())
        && outchars_equal
        && t1.getMovement() == t2.getMovement();
  }
示例#25
0
 /**
  * 读取一项数据
  *
  * @param ends 结束符, 默认' ', '\r', '\n'
  * @return
  * @throws IOException
  */
 public String readItem(char... ends) throws IOException {
   StringBuilder sb = new StringBuilder();
   while (true) {
     switch (peek()) {
       case ' ':
       case '\r':
       case '\n':
       case -1:
         return sb.toString();
       default:
         for (Character c : ends) {
           if (c.equals(peek())) {
             return sb.toString();
           }
         }
         sb.append((char) poll());
     }
   }
 }
示例#26
0
  public static boolean isPalindrom(String theString) {
    int stringLength, div2Length;
    int i, j;

    Stack aStack = new Stack();

    stringLength = theString.length();
    div2Length = stringLength / 2;
    for (i = 0; i < div2Length; i++) {
      Character C = new Character(theString.charAt(i));
      aStack.push(C);
    }
    if (stringLength % 2 != 0) i++;

    for (j = i; j < stringLength; j++) {
      Character C = new Character(theString.charAt(j));
      if (!(C.equals(aStack.pop()))) return false;
    }
    return true;
  }
示例#27
0
  // It is a short program, and every word is important for its correctness
  public static boolean is_valid_parentheses(final String input) {
    assert input != null;

    HashMap<Character, Character> charMap = new HashMap<Character, Character>();
    charMap.put('{', '}');
    charMap.put('[', ']');
    charMap.put('(', ')');

    Stack<Character> st = new Stack<Character>();
    for (Character ch : input.toCharArray()) {
      if (charMap.containsKey(ch)) {
        st.push(ch);
      } else if (charMap.containsValue(ch)) {
        if (!st.empty() && ch.equals(charMap.get(st.peek()))) {
          st.pop();
        }
      }
    }
    return st.empty();
  }
示例#28
0
  public Character lerCaracter() throws Exception {
    // this.caracter = memory[cont];
    int r;

    if ((r = in.read()) != -1) {

      caracter = (char) r;
      if (caracter.equals('}') && flag == 0) {
        System.out.println("erro lexico: fecha parentesis");
        System.exit(-1);
      }
      cont++;

    } else {
      System.out.println("*****  End of File!!!!  *****");
      // System.exit(-1);
    }

    return caracter;
  }
  public String rewrite(String query) throws SQLException {
    if (query == null) {
      throw new IllegalArgumentException("You must specify specify a 'query'.");
    }

    State state = new State(query);
    for (state.cursor = 0; state.cursor < query.length(); state.cursor++) {
      char currentCharacter = query.charAt(state.cursor);

      switch (currentCharacter) {
        case '\'':
        case '\"':
        case '`':
          Character onStack = state.stack.peekFirst();
          if (onStack != null && onStack.equals(currentCharacter)) {
            state.stack.removeFirst();
          } else {
            state.stack.addFirst(currentCharacter);
          }
          processWordStartOrMiddle(state);
          break;
        case ' ':
        case ',':
        case ';':
          if (state.stack.isEmpty()) {
            processWordEnding(state);
          }
          processWordStartOrMiddle(state);
          break;
        default:
          processWordStartOrMiddle(state);
          break;
      }
    }

    processWordEnding(state);

    return state.output.toString();
  }
示例#30
0
  private final char getRandomBase(Character toExclude) {
    Character result = null;

    while (result == null) {
      double base = this.randGenerator.nextDouble();
      if (base < 0.25) {
        result = 'A';
      } else if (base < 0.5) {
        result = 'C';
      } else if (base < 0.75) {
        result = 'G';
      } else {
        result = 'T';
      }

      if (toExclude != null && toExclude.equals(result)) {
        result = null;
      }
    }

    return result;
  }