複製代碼代碼如下:
包com.vd.dsl;
導入靜態com.vd.dsl.graphbuilder。*;
公共類Main {
公共靜態void main(string [] args){
graph()。edge()。從(“ a”)。到(“ b”)。 printgraph();
}
}
複製代碼代碼如下:
包com.vd.dsl;
公共類邊緣{
私人頂點vertex;
私人頂點Tovertex;
public vertex getfromvertex(){
返回ververtex;
}
public void setfromvertex(vertex fevertex){
this.fromvertex = fevertex;
}
public vertex getToverTex(){
返回Tovertex;
}
public void steratovertex(vertex tovertex){
this.tovertex = tovertex;
}
public double double getaight(){
返回重量;
}
public void setWeight(雙重重量){
this.pewight =重量;
}
私人雙重重量;
公共邊緣(){
}
@Override
公共字符串tostring(){
返回ververtex.getLabel()+“ to”+
tovertex.getLabel() +“ with Weigth” +
此。
}
}