/** * 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 the SDR which is the sparse integer array representing the specified term. * * @param fp * @return */ int[] getFingerprintSDR(Fingerprint fp) { return fp.getPositions(); }