Coverage details for edu.uci.ics.jung.graph.predicates.TreePredicate

LineHitsSource
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 /*
11  * Created on May 9, 2004
12  */
13 package edu.uci.ics.jung.graph.predicates;
14  
15 import edu.uci.ics.jung.graph.*;
16 import edu.uci.ics.jung.graph.ArchetypeEdge;
17 import edu.uci.ics.jung.graph.DirectedEdge;
18 import edu.uci.ics.jung.graph.Graph;
19 import edu.uci.ics.jung.graph.impl.SparseTree;
20  
21  
22 /**
23  * @author danyelf
24  */
251public class TreePredicate extends EdgePredicate {
26  
27     /**
28      * Any edges added to this graph must go to a vertex where
29      *
30      * @see edu.uci.ics.jung.graph.predicates.EdgePredicate#evaluateEdge(edu.uci.ics.jung.graph.ArchetypeEdge)
31      */
32     public boolean evaluateEdge(ArchetypeEdge e) {
335        if (! Graph.DIRECTED_EDGE.evaluate(e) )
340            return false;
355        DirectedEdge de = (DirectedEdge) e;
365        Vertex dest = de.getDest();
375        if( dest.containsUserDatumKey(SparseTree.SPARSE_ROOT_KEY))
381            return false;
394        if ( dest.inDegree () > 0)
401            return false;
41  
423        Vertex src = de.getSource();
433        if( !src.containsUserDatumKey(SparseTree.IN_TREE_KEY))
441            return false;
452        return true;
46     }
47  
481    protected static TreePredicate instance = null;
49     
50     /**
51      * @return a <code>TreePredicate</code> instance
52      */
53     public static TreePredicate getInstance() {
541        if ( instance == null)
551            instance = new TreePredicate();
561        return instance;
57     }
58  
59 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.