javaDSL簡單實(shí)現(xiàn)示例分享
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();
}
}
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)文章
Java之SpringBoot實(shí)現(xiàn)基本增刪改查(前后端分離版)
這篇文章主要介紹了Java中SpringBoot如何實(shí)現(xiàn)基本的增刪改查,前后端分離版,沒有和前端進(jìn)行聯(lián)系,感興趣的小伙伴可以借鑒閱讀本文2023-03-03關(guān)于使用ContextClassLoader遇到的問題
這篇文章主要介紹了關(guān)于使用ContextClassLoader遇到的問題,ContextClassLoader是通過Thread.currentThread().getContextClassLoader()返回該線程上下文的ClassLoader,需要的朋友可以參考下2023-10-10Java實(shí)現(xiàn)pdf轉(zhuǎn)圖片案例
這篇文章主要介紹了Java實(shí)現(xiàn)pdf轉(zhuǎn)圖片案例,按照步驟放置代碼,一步步完成該案例,將代碼部署便可,需要的朋友可以參考下2021-06-06Spring mvc AJAX技術(shù)實(shí)現(xiàn)原理解析
這篇文章主要介紹了Spring mvc AJAX技術(shù)實(shí)現(xiàn)原理解析,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-03-03