View Javadoc

    1   /* LongSet
    2    *
    3    * $Id: LongFPSet.java 3437 2005-05-06 02:49:04Z stack-sf $
    4    *
    5    * Created on Oct 19, 2003
    6    *
    7    * Copyright (C) 2003 Internet Archive.
    8    *
    9    * This file is part of the Heritrix web crawler (crawler.archive.org).
    10   *
    11   * Heritrix is free software; you can redistribute it and/or modify
    12   * it under the terms of the GNU Lesser Public License as published by
    13   * the Free Software Foundation; either version 2.1 of the License, or
    14   * any later version.
    15   *
    16   * Heritrix is distributed in the hope that it will be useful,
    17   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    18   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    19   * GNU Lesser Public License for more details.
    20   *
    21   * You should have received a copy of the GNU Lesser Public License
    22   * along with Heritrix; if not, write to the Free Software
    23   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    24   */
    25  package org.archive.util.fingerprint;
    26
    27  /***
    28   * Set for holding primitive long fingerprints.
    29   *
    30   * @author Gordon Mohr
    31   */
    32  public interface LongFPSet {
    33      /***
    34       * Add a fingerprint to the set.  Note that subclasses can implement
    35       * different policies on how to add - some might grow the available space,
    36       * others might implement some type of LRU caching.
    37       *
    38       * In particular, you cannot on the {@link #count()} method returning
    39       * 1 greater than before the addition.
    40       *
    41       * @param l the fingerprint to add
    42       * @return <code>true</code> if set has changed with this addition
    43       */
    44      boolean add(long l);
    45
    46      /***
    47       *  Does this set contain a given fingerprint.
    48       * @param l the fingerprint to check for
    49       * @return <code>true</code> if the fingerprint is in the set
    50       */
    51      boolean contains(long l);
    52
    53      /***
    54       *  Remove a fingerprint from the set, if it is there
    55       * @param l the fingerprint to remove
    56       * @return <code>true</code> if we removed the fingerprint
    57       */
    58      boolean remove(long l);
    59
    60      /*** get the number of elements in the Set
    61       * @return the number of elements in the Set
    62       */
    63      long count();
    64
    65      /***
    66       * Do a contains() check that doesn't require laggy
    67       * activity (eg disk IO). If this returns true,
    68       * fp is definitely contained; if this returns
    69       * false, fp  *MAY* still be contained -- must use
    70       * full-cost contains() to be sure.
    71       *
    72       * @param fp the fingerprint to check for
    73       * @return <code>true</code> if contains the fingerprint
    74       */
    75      boolean quickContains(long fp);
    76  }