复制代码代码如下:
パッケージcom.vd.dsl;
static com.vd.dsl.graphbuilder。*;
パブリッククラスメイン{
public static void main(string [] args){
graph()。edge()。from( "a")。to( "b")。weigth(20.0).eded()。 printgraph();
}
}
复制代码代码如下:
パッケージcom.vd.dsl;
パブリッククラスエッジ{
Private Vertex fromvertex;
private Vertex Tovertex;
public vertex getFromBertEx(){
fromvertexから戻ります。
}
public void setfromfertex(vertex fromeverex){
this.fromvertex = fromvertex;
}
public vertex getToverTex(){
tovertexを返します。
}
public void stovertex(頂点tovertex){
this.tovertex = tovertex;
}
public double getWeight(){
重量を返します。
}
public void setweight(double weight){
this.weight = weight;
}
プライベートダブルウェイト;
パブリックエッジ(){
}
@オーバーライド
public string toString(){
fromvertex.getLabel()+ "to"+を返します
tovertex.getLabel() + "Weigth" +
this.weight;
}
}