[4] | 1 | /* |
---|
| 2 | * This program is free software; you can redistribute it and/or modify |
---|
| 3 | * it under the terms of the GNU General Public License as published by |
---|
| 4 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 5 | * (at your option) any later version. |
---|
| 6 | * |
---|
| 7 | * This program is distributed in the hope that it will be useful, |
---|
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 10 | * GNU General Public License for more details. |
---|
| 11 | * |
---|
| 12 | * You should have received a copy of the GNU General Public License |
---|
| 13 | * along with this program; if not, write to the Free Software |
---|
| 14 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
| 15 | */ |
---|
| 16 | |
---|
| 17 | /* |
---|
| 18 | * GraphEdge.java |
---|
| 19 | * Copyright (C) 2003 University of Waikato, Hamilton, New Zealand |
---|
| 20 | * |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | package weka.gui.graphvisualizer; |
---|
| 24 | |
---|
| 25 | /** |
---|
| 26 | * This class represents an edge in the graph |
---|
| 27 | * |
---|
| 28 | * @author Ashraf M. Kibriya (amk14@cs.waikato.ac.nz) |
---|
| 29 | * @version $Revision: 4995 $ - 23 Apr 2003 - Initial version (Ashraf M. Kibriya) |
---|
| 30 | */ |
---|
| 31 | public class GraphEdge extends Object { |
---|
| 32 | |
---|
| 33 | /** The index of source node in Nodes vector */ |
---|
| 34 | public int src; |
---|
| 35 | /** The index of target node in Nodes vector */ |
---|
| 36 | public int dest; |
---|
| 37 | /** The type of Edge */ |
---|
| 38 | public int type; |
---|
| 39 | /** Label of source node */ |
---|
| 40 | public String srcLbl; |
---|
| 41 | /** Label of target node */ |
---|
| 42 | public String destLbl; |
---|
| 43 | |
---|
| 44 | public GraphEdge(int s, int d, int t) { |
---|
| 45 | src=s; dest=d; type=t; |
---|
| 46 | srcLbl = null; destLbl = null; |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | public GraphEdge(int s, int d, int t, String sLbl, String dLbl) { |
---|
| 50 | src=s; dest=d; type=t; |
---|
| 51 | srcLbl = sLbl; destLbl = dLbl; |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | public String toString() { |
---|
| 55 | return ("("+src+","+dest+","+type+")"); |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | public boolean equals(Object e) { |
---|
| 59 | if( e instanceof GraphEdge && |
---|
| 60 | ((GraphEdge)e).src==this.src && |
---|
| 61 | ((GraphEdge)e).dest==this.dest && |
---|
| 62 | ((GraphEdge)e).type==this.type) |
---|
| 63 | return true; |
---|
| 64 | else |
---|
| 65 | return false; |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | } // GraphEdge |
---|