欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

javaDSL簡單實(shí)現(xiàn)示例分享

 更新時(shí)間:2014年03月06日 10:09:04   作者:  
DSL領(lǐng)域定義語言,用來描述特定領(lǐng)域的特定表達(dá)。比如畫圖從起點(diǎn)到終點(diǎn);路由中的從A到B。這是關(guān)于畫圖的一個(gè)簡單實(shí)現(xiàn)

復(fù)制代碼 代碼如下:

package com.vd.dsl;
import static com.vd.dsl.GraphBuilder.*;
public class Main {
 public static void main(String[] args) {
  Graph().edge().from("a").to("b").weigth(20.0).edge().from("b").to("c").weigth(10.0).printGraph();
 }
}

復(fù)制代碼 代碼如下:

package com.vd.dsl;

public class Edge {
 private Vertex fromVertex;
 private Vertex toVertex;
 public Vertex getFromVertex() {
  return fromVertex;
 }
 public void setFromVertex(Vertex fromVertex) {
  this.fromVertex = fromVertex;
 }
 public Vertex getToVertex() {
  return toVertex;
 }
 public void setToVertex(Vertex toVertex) {
  this.toVertex = toVertex;
 }
 public Double getWeight() {
  return weight;
 }
 public void setWeight(Double weight) {
  this.weight = weight;
 }
 private Double weight;
 public Edge() {

 }
 @Override
 public String toString() {
  return fromVertex.getLabel()+ " to "+
   toVertex.getLabel() + "with weigth "+
   this.weight;
 }
}

相關(guān)文章

最新評(píng)論