Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.uci.ics.jung.graph.filters
Class SerialFilter

    java.lang.Object
      edu.uci.ics.jung.graph.filters.SerialFilter

All Implemented Interfaces:
  EfficientFilter, Filter

public class SerialFilter
extends Object
implements Filter, EfficientFilter

This is a generic filter that takes at least two other filters and runs them seially. That is, it filters first on F1, and then on F2. Note that it stores links to the filters; mutable filters therefore are at risk of causing odd side effects: ``

     		Filter f1 = new HeightFilter( "tall" );
     		Filter f2 = new ColorFilter("Green");
     		Filter serial = new SerialFilter( f1, f2 );
     		Graph tallGreen = serial.filter( graph ).assemble();
     		// this contains all tall, green things

     		f1.setHeight("short")
    		// careful, f1 is stored in serial!
     		Graph otherGreen = serial.filter( graph ).assemble();
     		// this now contains all short green things.

Author:
  danyelf

Constructor Summary
`SerialFilter()` Creates an empty list of filters.
`SerialFilter(Filter f1, Filter f2)` Small constructor for two filters.
`SerialFilter(List filters)` Constructor for an arbitrary list of filters.

Method Summary
`void` | `append(Filter f)` Adds a filter to the end of the sequence of filters.
`UnassembledGraph` | `filter(Graph g)` Runs through the sequence of filters, one at a time.
`UnassembledGraph` | `filter(UnassembledGraph g)` Runs through the sequence of filters, one at a time.
`String` | `getName()` Returns the name of the serial filter.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SerialFilter

    public SerialFilter(Filter f1,
                        Filter f2)

  Small constructor for two filters. Simply adds them in sequence. The first filter will be run on the graph before the second one.

Parameters:
  `f1` - The first filter.
  `f2` - The second filter.

### SerialFilter

    public SerialFilter(List filters)

  Constructor for an arbitrary list of filters. When `filter()` is called, will run through them from first to last.

### SerialFilter

    public SerialFilter()

  Creates an empty list of filters. By default, if `filter` is called, will return the original graph.

See Also:
  `TrivialFilter`

Method Detail

### getName

    public String getName()

  Returns the name of the serial filter.

  Specified by:
    `getName` in interface `Filter`
  Returns:
    A string that describes the filter.

### append

    public void append(Filter f)

  Adds a filter to the end of the sequence of filters. Thus, appended filters will be processed last in the sequence.

  Parameters:
    `f` - Adds the filter to the end of the list.

### filter

    public UnassembledGraph filter(Graph g)

  Runs through the sequence of filters, one at a time. Starts with the first filter in sequence and works forward. When the filter is able to be efficient, it does so.

  Specified by:
    `filter` in interface `Filter`
  Parameters:
    `g` - An input graph to be filtered.
  Returns:
    an `UnassembledGraph` that contains the subset of vertices and edges from `g` pass the filter.

### filter

    public UnassembledGraph filter(UnassembledGraph g)

  Runs through the sequence of filters, one at a time. Starts with the first filter in sequence and works forward. When the filter is able to be efficient, it does so.

  Specified by:
    `filter` in interface `EfficientFilter`
  Parameters:
    `g` - An unassembled graph to be filtered.
  Returns:
    an `UnassembledGraph` that contains the subset of vertices and edges from `ug` pass the filter.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD