attribute

fun <Node, T> attribute(f: Node.() -> T): Attribute<Node, T>

Defines an Attribute of type T for nodes of type Node. The value of the attribute for a given Node is determined by the function f.

Calls to f are cached, so there is at most one call to f for any given Node. If the value of the attribute for a Node is never requested, then there are no calls to f for that Node. Note that Node equality is determined by object identity, not Any.equals.

See also

Throws

if f(node) depends on f(node) for some node.