package Object;
public class Graph{
int edge;
int area;
int girth;
public int getEdge() {
return edge;
}
public void setEdge(int edge) {
this.edge = edge;
}
public int getArea() {
return area;
}
public void setArea(int area) {
this.area = area;
}
public int getGirth() {
return girth;
}
public void setGirth(int girth) {
this.girth = girth;
}
@Override
public boolean equals(Object obj) { //改写equals
// TODO Auto-generated method stub
if(this==obj){
return true;
}if(obj instanceof Graph){
if(this.edge==edge){
return true;
}else if(this.girth==girth){
return true;
}else if(this.area==area){
return true;
}
}
return false;
}
public static void main(String[]args){
Graph g1=new Graph();
g1.setEdge(4);
g1.setGirth(16);
g1.setArea(16);
Graph g2 = new Graph();
g2.setEdge(3);
g2.setGirth(16);
g2.setArea(16);
System.out.println(g1.equals(g2));
}
}
int edge;
int area;
int girth;
public int getEdge() {
return edge;
}
public void setEdge(int edge) {
this.edge = edge;
}
public int getArea() {
return area;
}
public void setArea(int area) {
this.area = area;
}
public int getGirth() {
return girth;
}
public void setGirth(int girth) {
this.girth = girth;
}
@Override
public boolean equals(Object obj) { //改写equals
// TODO Auto-generated method stub
if(this==obj){
return true;
}if(obj instanceof Graph){
if(this.edge==edge){
return true;
}else if(this.girth==girth){
return true;
}else if(this.area==area){
return true;
}
}
return false;
}
public static void main(String[]args){
Graph g1=new Graph();
g1.setEdge(4);
g1.setGirth(16);
g1.setArea(16);
Graph g2 = new Graph();
g2.setEdge(3);
g2.setGirth(16);
g2.setArea(16);
System.out.println(g1.equals(g2));
}
}