Node

public class Node

A single AST node within a Coco model.

Fields

client

protected final APIClient client

opaqueValue

protected long opaqueValue

Constructors

Node

protected Node(APIClient client)

Internal constructor

Methods

componentKind

public io.cocotec.coco.platform.coco.ComponentKind componentKind()

Whether this is an encapsulating/external/state machine component

enclosingDecl

public io.cocotec.coco.platform.coco.Node enclosingDecl()

Returns the node corresponding to the enclosing declaration, if known

equals

public boolean equals(Object other)

fromProtobuf

public static Node fromProtobuf(APIClient client, Out.CocoNode inputValue)

Internal constructor

getHandle

public final long getHandle()

getOpaqueValue

public final long getOpaqueValue()

hashCode

public int hashCode()

isValid

public boolean isValid()

Whether this points to a genuine AST node or is a de facto null pointer

name

public String name()

If this is a value declaration, then the name of the node, otherwise an empty string.

nodeKind

public io.cocotec.coco.platform.coco.NodeKind nodeKind()

The underlying AST node kind - NB these are not stable and subject to change

prettyPrint

public String prettyPrint()

Pretty prints a representation of this node.

prettyPrint

public String prettyPrint(String formatSpecification)

Pretty prints a representation of this node, applying the Coco formatter to the result.

Parameters:
  • formatSpecification – A json dictionary giving the coco-format options.