source: branches/MetisMQI/src/main/java/weka/gui/graphvisualizer/GraphNode.java @ 30

Last change on this file since 30 was 29, checked in by gnappo, 14 years ago

Taggata versione per la demo e aggiunto branch.

File size: 2.5 KB
Line 
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 *    GraphNode.java
19 *    Copyright (C) 2003 University of Waikato, Hamilton, New Zealand
20 *
21 */
22
23package weka.gui.graphvisualizer;
24
25/**
26 * This class represents a node 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
32public class GraphNode extends Object implements GraphConstants {
33  /** ID and label for the node */
34  public String ID, lbl;
35  /** The outcomes for the given node */
36  public String [] outcomes;
37  /** probability table for each outcome given outcomes of parents, if any */
38  public double [][] probs;   //probabilities
39  /** The x and y position of the node */
40  public int x=0, y=0;
41  /** The indices of parent nodes */
42  public int [] prnts;       //parent nodes
43  /** The indices of nodes to which there are edges from this
44   * node, plus the type of edge */
45  public int [][] edges;
46  /**  Type of node. Default is Normal node type */
47  public int nodeType=NORMAL;
48 
49  /**
50   *  Constructor
51   *
52   */
53  public GraphNode(String id, String label) {
54    ID = id; lbl = label; nodeType=NORMAL;
55  }
56 
57  /**
58   *  Constructor
59   *
60   */
61  public GraphNode(String id, String label, int type ) {
62    ID = id; lbl = label; nodeType = type;
63  }
64 
65  /**
66   *  Returns true if passed in argument is an instance
67   *  of GraphNode and is equal to this node.
68   *  Implemented to enable the use of contains method
69   *  in Vector/FastVector class.
70   */
71  public boolean equals(Object n) {
72    if(n instanceof GraphNode && ((GraphNode) n).ID.equalsIgnoreCase(this.ID)) {
73      //System.out.println("returning true, n.ID >"+((GraphNode)n).ID+
74      //                   "< this.ID >"+this.ID+"<");
75      return true;
76    }
77    else
78      return false;
79  }
80} // GraphNode
Note: See TracBrowser for help on using the repository browser.