KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgrapht > GraphMapping


1 /* ==========================================
2  * JGraphT : a free Java graph-theory library
3  * ==========================================
4  *
5  * Project Info: http://jgrapht.sourceforge.net/
6  * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7  *
8  * (C) Copyright 2003-2006, by Barak Naveh and Contributors.
9  *
10  * This library is free software; you can redistribute it and/or modify it
11  * under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation; either version 2.1 of the License, or
13  * (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18  * License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this library; if not, write to the Free Software Foundation,
22  * Inc.,
23  * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
24  */

25 /* -----------------
26  * GraphMapping.java
27  * -----------------
28  * (C) Copyright 2005-2006, by Assaf Lehr and Contributors.
29  *
30  * Original Author: Assaf Lehr
31  * Contributor(s): John V. Sichi
32  *
33  * Changes
34  * -------
35  */

36 package org.jgrapht;
37
38 /**
39  * GraphMapping represents a bidirectional mapping between two graphs (called
40  * graph1 and graph2), which allows the caller to obtain the matching vertex or
41  * edge in either direction, from graph1 to graph2, or from graph2 to graph1. It
42  * does not have to always be a complete bidirectional mapping (it could return
43  * null for some lookups).
44  *
45  * @author Assaf Lehr
46  * @since Jul 30, 2005
47  */

48 public interface GraphMapping<V, E>
49 {
50
51     //~ Methods ---------------------------------------------------------------
52

53     /**
54      * Gets the mapped value where the key is <code>vertex</code>
55      *
56      * @param vertex vertex in one of the graphs
57      * @param forward if true, uses mapping from graph1 to graph2; if false, use
58      * mapping from graph2 to graph1
59      *
60      * @return corresponding vertex in other graph, or null if none
61      */

62     public V getVertexCorrespondence(V vertex, boolean forward);
63
64     /**
65      * Gets the mapped value where the key is <code>edge</code>
66      *
67      * @param edge edge in one of the graphs
68      * @param forward if true, uses mapping from graph1 to graph2; if false, use
69      * mapping from graph2 to graph1
70      *
71      * @return corresponding edge in other graph, or null if none
72      */

73     public E getEdgeCorrespondence(E edge, boolean forward);
74 }
75
Popular Tags