DBVIEW
src/org/dbview/db/structure/JgraphtTableToTableEdge.java
00001 /*
00002         DbView - Graph Visualization
00003     Copyright (C) 2012  Denis BEURIVE
00004 
00005     This program is free software: you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation, either version 3 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 package org.dbview.db.structure;
00020 
00021 import org.jgrapht.graph.DefaultEdge;
00022 
00023 /**
00024  * This class implements a specific type of edge for the library JgraphT.
00025  * @see http://www.jgrapht.org/
00026  * @author Denis Beurive
00027  */
00028 public class JgraphtTableToTableEdge extends DefaultEdge
00029 {
00030     /**
00031      * This value represents the version of the current class.
00032      * @remark Please note that this serial number is only important when the class is serialized, which is not the case here.
00033      *         It is defined in order to avoid waning messages during compilation.
00034      */
00035     private static final long serialVersionUID = 2L;
00036 
00037     /**
00038      * Build a new edge from a given table to a given table.
00039      * @remark Please note that this constructor can take any number of argument.
00040      *         You can add all properties you need in the edge.
00041      *         Edges are created explicitly:
00042      *         g.addEdge(table, target, new JgraphtEdge<Table>(...))
00043      */
00044     public JgraphtTableToTableEdge()
00045     {
00046         super();
00047     }
00048 
00049     /**
00050      * Return the starting point of the edge. This is a table.
00051      * @return The method returns the starting point of the edge.
00052      */
00053     public Table getSource() { return (Table)super.getSource(); }
00054 
00055     /**
00056      * Return the ending point of the edge. This is a table.
00057      * @return The method returns the ending point of the edge.
00058      */
00059     public Table getTarget() { return (Table)super.getTarget(); }
00060 
00061     /**
00062      * Return a textual representation of the edge.
00063      * @return The method returns a textual representation of the edge.
00064      */
00065     public String toString()
00066     {
00067         return this.getSource().getName() + " - " + this.getTarget().getName();
00068     }
00069 
00070 }