View Javadoc

1   /* -------------------------------------------------------------------
2    * Java source file for the class Edge
3    * 
4    * Copyright (c), 2003, Masahiro Takatsuka.
5    * All Rights Researved.
6    * 
7    * Original Author: Masahiro Takatsuka (masa@jbeans.net)
8    * $Author: takatsukam $
9    * 
10   * $Date: 2004/03/03 11:53:06 $
11   * 
12   * $Id: Edge.java,v 1.3 2004/03/03 11:53:06 takatsukam Exp $
13   * 
14   * Reference:		Document no:
15   * ___				___
16   * 
17   * To Do:
18   * ___
19   * 
20  ------------------------------------------------------------------- */
21  
22  /* --------------------------- Package ---------------------------- */
23  package net.jbeans.j3d.modeler.geometry.util;
24  
25  /* ------------------ Import classes (packages) ------------------- *//package-summary/html">class="comment"> ------------------ Import classes (packages) ------------------- *//package-summary.html">class="comment">/* ------------------ Import classes (packages) ------------------- *//package-summary.html">class="comment"> ------------------ Import classes (packages) ------------------- */
26  // import foo.*;
27  
28  /*====================================================================
29                       Implementation of class Edge                     
30  ====================================================================*/
31  /***
32   * generally describe Edge in here
33   * 
34   * @version $Revision: 1.3 $
35   * @author Masahiro Takatsuka (masa@jbeans.net)
36   */
37  
38  class Edge {
39  	private static final int HASHCONST = 0xedcba987;
40  	
41  	int v1;
42  	int v2;
43  	
44  	Edge() {
45  		super();
46  	}
47  
48  	Edge(int i, int j) {
49  		this.v1 = i;
50  		this.v2 = j;
51  	}
52  
53  	Edge(Edge edge) {
54  		this.v1 = edge.v1;
55  		this.v2 = edge.v2;
56  	}
57  
58  	void set(int i, int j) {
59  		this.v1 = i;
60  		this.v2 = j;
61  	}
62  	
63  	public boolean equals(Object obj) {
64  		if (!(obj instanceof Edge)){
65  			return false;
66  		} else {
67  			Edge edge = (Edge) obj;
68  			return this.v1 == edge.v1 && this.v2 == edge.v2;
69  		}
70  	}
71  
72  	public int hashCode() {
73  		return this.v1 * 0xedcba987 << 2 ^ this.v2 * 0xedcba987;
74  	}
75  
76  	public String toString() {
77  		return "(" + this.v1 + ", " + this.v2 + ")";
78  	}
79  }