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 GeneralEdgeAcceptFilter

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

All Implemented Interfaces:
  Filter

Direct Known Subclasses:
  EdgePredicateFilter, WeightedEdgeGraphFilter

public abstract class GeneralEdgeAcceptFilter
extends Object
implements Filter

Abstract class that implements a generic filter for accepting arbitrary edges (and all vertices). To use it, subclass this and override `acceptEdge`. This is compatible with both `EfficientFilter`; in order to use it as such, make sure to label your class as an `EfficientFilter` with `implements EfficientFilter`.

## Sample code

     	// Returns a version of the graph that only has blue edges.
     	class OnlyBlueEdgeFilter extends GeneralEdgeAcceptFilter
     		implements EfficientFilter {

     		// BlueChecker is a helper class that I've implemented somewhere else
     		boolean acceptEdge( Edge e ) {
     			return BlueChecker.checkBlue( e );
     		}
     }

Author:
  danyelf

Constructor Summary
`GeneralEdgeAcceptFilter()`

Method Summary
`abstract boolean` | `acceptEdge(Edge edge)` Determines whether the current edge should be accepted into the Graph.
`UnassembledGraph` | `filter(Graph g)` Returns an `UnassembledGraph` with the subset of edges that pass `acceptEdge`.
`UnassembledGraph` | `filter(UnassembledGraph ug)` Returns an `UnassembledGraph` with the subset of edges that pass `acceptEdge`.

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

Methods inherited from interface edu.uci.ics.jung.graph.filters.Filter
`getName`

Constructor Detail

### GeneralEdgeAcceptFilter

    public GeneralEdgeAcceptFilter()

Method Detail

### acceptEdge

    public abstract boolean acceptEdge(Edge edge)

  Determines whether the current edge should be accepted into the Graph. User should override this method.

  Parameters:
    `edge` - the input edge that is being evaluated.
  Returns:
    whether the edge should be accepted or not

### filter

    public UnassembledGraph filter(Graph g)

  Returns an `UnassembledGraph` with the subset of edges that pass `acceptEdge`.

  Specified by:
    `filter` in interface `Filter`
  Parameters:
    `g` - A `Graph` to be filtered.
  Returns:
    An UnassembledGraph containing the subset of `g` that pass the filter.
  See Also:
    `Filter.filter(Graph)`

### filter

    public UnassembledGraph filter(UnassembledGraph ug)

  Returns an `UnassembledGraph` with the subset of edges that pass `acceptEdge`. This method is used only if this class implements `EfficientFilter`, and, in fact, it contains a runtime check to ensure that the subclass has been labelled correctly.

  Parameters:
    `ug` - An `UnassembledGraph` containing a subset of vertices and edges from an original graph.
  Returns:
    An UnassembledGraph containing the subset of `ug` that pass the filter.
  See Also:
    `EfficientFilter.filter(UnassembledGraph)`

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