| Line | Hits | Source |
|---|---|---|
| 1 | /* | |
| 2 | * Copyright (c) 2003, the JUNG Project and the Regents of the University | |
| 3 | * of California | |
| 4 | * All rights reserved. | |
| 5 | * | |
| 6 | * This software is open-source under the BSD license; see either | |
| 7 | * "license.txt" or | |
| 8 | * http://jung.sourceforge.net/license.txt for a description. | |
| 9 | * | |
| 10 | * Created on Mar 9, 2004 | |
| 11 | */ | |
| 12 | package edu.uci.ics.jung.graph.predicates; | |
| 13 | ||
| 14 | import edu.uci.ics.jung.graph.ArchetypeGraph; | |
| 15 | import edu.uci.ics.jung.graph.ArchetypeVertex; | |
| 16 | ||
| 17 | /** | |
| 18 | * A predicate that tests to see whether a specified | |
| 19 | * vertex is currently part of a graph. May be used as | |
| 20 | * a constraint. <code>AbstractSparseGraph</code> | |
| 21 | * includes this vertex constraint by default. Should | |
| 22 | * not be used as a subset specification. | |
| 23 | * | |
| 24 | * @author Joshua O'Madadhain | |
| 25 | */ | |
| 26 | public class NotInGraphVertexPredicate extends VertexPredicate implements UncopyablePredicate | |
| 27 | { | |
| 28 | private ArchetypeGraph ag; | |
| 29 | private final static String message = "NotInGraphVertexPredicate: "; | |
| 30 | ||
| 31 | public NotInGraphVertexPredicate(ArchetypeGraph ag) | |
| 32 | 654 | { |
| 33 | 654 | this.ag = ag; |
| 34 | 654 | } |
| 35 | ||
| 36 | public String toString() | |
| 37 | { | |
| 38 | 3 | return message + ag; |
| 39 | } | |
| 40 | ||
| 41 | public boolean equals(Object o) | |
| 42 | { | |
| 43 | 0 | if (!(o instanceof NotInGraphVertexPredicate)) |
| 44 | 0 | return false; |
| 45 | 0 | return ((NotInGraphVertexPredicate)o).ag.equals(ag); |
| 46 | } | |
| 47 | ||
| 48 | public int hashCode() | |
| 49 | { | |
| 50 | 0 | return ag.hashCode(); |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * Returns <code>true</code> if this vertex is not currently | |
| 55 | * a member of any graph. | |
| 56 | */ | |
| 57 | public boolean evaluateVertex(ArchetypeVertex av) | |
| 58 | { | |
| 59 | 32384 | return (!ag.getVertices().contains(av) && (av.getGraph() == null)); |
| 60 | } | |
| 61 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |