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 8, 2004 | |
11 | */ | |
12 | package edu.uci.ics.jung.graph.predicates; | |
13 | ||
14 | import edu.uci.ics.jung.graph.ArchetypeEdge; | |
15 | import edu.uci.ics.jung.graph.ArchetypeGraph; | |
16 | ||
17 | /** | |
18 | * A predicate that tests to see whether a specified | |
19 | * edge is currently part of a graph. May be used as | |
20 | * a constraint. <code>AbstractSparseGraph</code> | |
21 | * includes this edge constraint by default. Should | |
22 | * not be used as a subset specification. | |
23 | * | |
24 | * @author Joshua O'Madadhain | |
25 | */ | |
26 | public class NotInGraphEdgePredicate extends EdgePredicate implements UncopyablePredicate | |
27 | { | |
28 | private ArchetypeGraph ag; | |
29 | private static final String message = "NotInGraphEdgePredicate: "; | |
30 | ||
31 | public NotInGraphEdgePredicate(ArchetypeGraph ag) | |
32 | 654 | { |
33 | 654 | this.ag = ag; |
34 | 654 | } |
35 | ||
36 | public String toString() | |
37 | { | |
38 | 1 | return message + ag; |
39 | } | |
40 | ||
41 | public boolean equals(Object o) | |
42 | { | |
43 | 0 | if (! (o instanceof NotInGraphEdgePredicate)) |
44 | 0 | return false; |
45 | 0 | return ((NotInGraphEdgePredicate)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 edge is not currently | |
55 | * part of graph <code>ag</code>. | |
56 | */ | |
57 | public boolean evaluateEdge(ArchetypeEdge e) | |
58 | { | |
59 | 148281 | return (!ag.getEdges().contains(e) && (e.getGraph() == null)); |
60 | } | |
61 | ||
62 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |