ConnectedToNodeFilter.java

  1. // $Id$
  2. /* ====================================================================
  3.  * Copyright (c) 2002-2003, Christophe Labouisse
  4.  * All rights reserved.
  5.  *
  6.  * Redistribution and use in source and binary forms, with or without
  7.  * modification, are permitted provided that the following conditions
  8.  * are met:
  9.  *
  10.  * 1. Redistributions of source code must retain the above copyright
  11.  *    notice, this list of conditions and the following disclaimer.
  12.  *
  13.  * 2. Redistributions in binary form must reproduce the above
  14.  *    copyright notice, this list of conditions and the following
  15.  *    disclaimer in the documentation and/or other materials provided
  16.  *    with the distribution.
  17.  *
  18.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19.  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  21.  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  22.  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  23.  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24.  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  25.  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  26.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  27.  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  28.  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  29.  * OF THE POSSIBILITY OF SUCH DAMAGE.
  30.  */

  31. package net.ggtools.grand.filters;

  32. import net.ggtools.grand.graph.ConnectedNodesFinder;
  33. import net.ggtools.grand.graph.LinkFinder;


  34. /**
  35.  * A graph filter returning all nodes connected to a specific node
  36.  * be it through forward or backward links (or both).
  37.  *
  38.  * @author Christophe Labouisse
  39.  */
  40. public class ConnectedToNodeFilter extends GraphWalkFilter
  41.     implements GraphFilter {

  42.     /**
  43.      * Field linkFinder.
  44.      */
  45.     private final LinkFinder linkFinder = new ConnectedNodesFinder();

  46.     /**
  47.      * Creates a new filter.
  48.      * @param nodeName node to search from.
  49.      */
  50.     public ConnectedToNodeFilter(final String nodeName) {
  51.         super(nodeName);
  52.     }

  53.     /**
  54.      * Method getLinkFinder.
  55.      * @return LinkFinder
  56.      * @see net.ggtools.grand.filters.GraphWalkFilter#getLinkFinder()
  57.      */
  58.     @Override
  59.     public final LinkFinder getLinkFinder() {
  60.         return linkFinder;
  61.     }
  62. }