/**
   * Called by {@link #checkCache(boolean, boolean)} for every line in the cache file to validate
   * the contents of the specified {@link Term}
   *
   * @param key
   * @param t
   * @param print
   * @return
   */
  boolean checkTerm(String key, Term t, boolean print) {
    Fingerprint fp = t.getFingerprint();
    if (fp == null) {
      if (print) {
        LOGGER.debug("\tkey: " + key + ", missing fingerprint");
      }
      return false;
    }

    int[] pos = fp.getPositions();
    if (pos == null) {
      if (print) {
        LOGGER.debug("\tkey: " + key + ", has null positions");
      }
      return false;
    }

    if (pos.length < 1) {
      if (print) {
        LOGGER.debug("\tkey: " + key + ", had empty positions");
      }
      return false;
    }

    int sdrLen = pos.length;
    if (print) {
      LOGGER.debug("\tkey: " + key + ", term len: " + sdrLen);
    }

    return true;
  }
  /**
   * Returns a {@link Fingerprint} for the specified term.
   *
   * @param term
   * @return
   */
  Fingerprint getFingerprint(String term) {
    try {
      Term t = cache.get(term) == null ? getTerms(term, true).get(0) : cache.get(term);

      if (!checkTerm(t.getTerm(), t, true)) {
        throw new IllegalStateException("Checkterm failed: " + t.getTerm());
      }

      cache.put(t.getTerm(), t);

      return t.getFingerprint();
    } catch (Exception e) {
      LOGGER.debug("Problem retrieving fingerprint for term: " + term);
    }

    return null;
  }