You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If VertexSpec were generalized in Graph it could be used for traversal methods as well. The general pattern for VertexSpec is name (map) {...}. This could also be used in traversal methods such as preorder. preorder A (colors) {...}.
NameSpec
When a property is missing from Graph a NameSpec should be returned. This will be used in the dsl to replace strings. Strings are not returned to prevent type issues and confusion.
ConfigSpec
When a method is missing in Graph a ConfigSpec` will be returned. This class should only contain a map and closure. The map will always contain an entry for name which contains the name of the missing method. Name can be overriden if the missing method is passed a map. The closure is what ever actions to take for the method.
Replacing VertexNameSpec
NameSpec will replace VertexNameSpec. This should be a drop in replacement.
graph.A returns a NameSpec with name == 'A'.
Using ConfigSpec with VertexSpec
When a vertex method is called and passed a ConfigSpec the method will need to convert it to a VertexSpec.
Using ConfigSpec with traversals
A traversal can take a root name, a map of colors and an action closure. Using a ConfigSpec with these methods would look like this.
graph {
breadthFirst A (colors) {
println it.name
}
}
The text was updated successfully, but these errors were encountered:
If VertexSpec were generalized in Graph it could be used for traversal methods as well. The general pattern for VertexSpec is
name (map) {...}
. This could also be used in traversal methods such aspreorder
.preorder A (colors) {...}
.NameSpec
When a property is missing from
Graph
aNameSpec
should be returned. This will be used in the dsl to replace strings. Strings are not returned to prevent type issues and confusion.ConfigSpec
When a method is missing in
Graph
a ConfigSpec` will be returned. This class should only contain a map and closure. The map will always contain an entry for name which contains the name of the missing method. Name can be overriden if the missing method is passed a map. The closure is what ever actions to take for the method.Replacing VertexNameSpec
NameSpec will replace
VertexNameSpec
. This should be a drop in replacement.graph.A
returns aNameSpec
withname == 'A'
.Using ConfigSpec with VertexSpec
When a vertex method is called and passed a
ConfigSpec
the method will need to convert it to a VertexSpec.Using ConfigSpec with traversals
A traversal can take a root name, a map of colors and an action closure. Using a ConfigSpec with these methods would look like this.
The text was updated successfully, but these errors were encountered: