Example #1
0
  /**
   * Get a single Interval from the information in this node If the key/timestamp pair cannot be
   * found, we return null.
   *
   * @param key The attribute quark to look for
   * @param t The timestamp
   * @return The Interval containing the information we want, or null if it wasn't found
   * @throws TimeRangeException If 't' is invalid
   */
  public HTInterval getRelevantInterval(int key, long t) throws TimeRangeException {
    fRwl.readLock().lock();
    try {
      for (int i = getStartIndexFor(t); i < fIntervals.size(); i++) {
        HTInterval curInterval = fIntervals.get(i);
        if (curInterval.getAttribute() == key
            && curInterval.getStartTime() <= t
            && curInterval.getEndTime() >= t) {
          return curInterval;
        }
      }

      /* We didn't find the relevant information in this node */
      return null;

    } finally {
      fRwl.readLock().unlock();
    }
  }