| Line | Hits | Source |
|---|---|---|
| 1 | /* | |
| 2 | * Copyright (c) 2004, the JUNG Project and the Regents of the University of | |
| 3 | * California All rights reserved. | |
| 4 | * | |
| 5 | * This software is open-source under the BSD license; see either "license.txt" | |
| 6 | * or http://jung.sourceforge.net/license.txt for a description. | |
| 7 | * | |
| 8 | * Created on Jun 18, 2004 | |
| 9 | */ | |
| 10 | package edu.uci.ics.jung.graph.predicates; | |
| 11 | ||
| 12 | import edu.uci.ics.jung.graph.ArchetypeVertex; | |
| 13 | import edu.uci.ics.jung.graph.Vertex; | |
| 14 | import edu.uci.ics.jung.graph.predicates.VertexPredicate; | |
| 15 | ||
| 16 | /** | |
| 17 | * Evaluates to <code>true</code> if and only if | |
| 18 | * the specified vertex is a sink, i.e., has | |
| 19 | * no outgoing directed edges. | |
| 20 | * | |
| 21 | * @author Joshua O'Madadhain | |
| 22 | */ | |
| 23 | public class SinkVertexPredicate extends VertexPredicate | |
| 24 | { | |
| 25 | protected static SinkVertexPredicate instance; | |
| 26 | ||
| 27 | protected SinkVertexPredicate() | |
| 28 | { | |
| 29 | 0 | super(); |
| 30 | 0 | } |
| 31 | ||
| 32 | public static SinkVertexPredicate getInstance() | |
| 33 | { | |
| 34 | 0 | if (instance == null) |
| 35 | 0 | instance = new SinkVertexPredicate(); |
| 36 | 0 | return instance; |
| 37 | } | |
| 38 | ||
| 39 | /** | |
| 40 | * @see edu.uci.ics.jung.graph.predicates.VertexPredicate#evaluateVertex(edu.uci.ics.jung.graph.ArchetypeVertex) | |
| 41 | */ | |
| 42 | public boolean evaluateVertex(ArchetypeVertex arg0) | |
| 43 | { | |
| 44 | 0 | if (! (arg0 instanceof Vertex)) |
| 45 | 0 | return false; |
| 46 | ||
| 47 | 0 | return (((Vertex)arg0).outDegree() == 0); |
| 48 | } | |
| 49 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |