edge.java
来自「Specification File adjacencyListGragh 」· Java 代码 · 共 52 行
JAVA
52 行
package adjacencyListGragh;
/* It is a Directed Edge class,
* because the edge is distinguish
* it is easy to code*/
public class Edge {
private Vertex origin;
private Vertex destiny;
private Object element;
public boolean printed = false;
public Edge(){
this.origin = null;
this.destiny = null;
this.element = null;
}
public Edge(Object element){
this.origin = null;
this.destiny = null;
this.element = element;
}
public Edge(Vertex origin, Vertex destiny){
this.origin = origin;
this.destiny = destiny;
this.element = null;
}
public Edge(Vertex origin, Vertex destiny, Object element){
this.origin = origin;
this.destiny = destiny;
this.element = element;
}
public Vertex getOriginVertex(){
return this.origin;
}
public void setOriginVertex(Vertex origin){
this.origin = origin;
}
public Vertex getDestinyVertex(){
return this.destiny;
}
public void setDestinyVertex(Vertex destiny){
this.destiny = destiny;
}
public Object getElement(){
return this.element;
}
public void setElement(Object element){
this.element = element;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?