calcite icon indicating copy to clipboard operation
calcite copied to clipboard

[CALCITE-3976] Generify the DefaultEdge class

Open liyafan82 opened this issue 5 years ago • 2 comments

Currently, the source and target fields of class DefaultEdge is Object. This makes it necessary for some casts in the code base. In addition, it does not enforce the assertion that in a graph, the vertices have the same type as sources and targes in the edges.

To solve the problem, we generify the DefaultEdge class with the type of the source/target vertices.

The benefits of generfication includes type safety: the above assertion can be enforced by the generified class. It also gives the compiler an opportunity to detect type related problems at compilation time. Without generification, some problems can only be detected at runtime, when a ClassCastException is thrown.

liyafan82 avatar May 07 '20 10:05 liyafan82

We also simplify the DefaultDirectedGraphBenchmark benchmark in this PR.

liyafan82 avatar May 07 '20 10:05 liyafan82

@vlsi @xndai dear reviewers, do you have any more comments for this PR?

liyafan82 avatar Jun 05 '20 07:06 liyafan82