| Modifier | Constructor and Description |
|---|---|
protected |
Node(ResourcePointer ptr,
boolean isBlockNode) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Node child)
Add the given
Node to our list of children. |
boolean |
canChain(Node node)
Checks whether this
Node can chain to the given node. |
Node |
chain(Node nextNode)
Chain to the given next
Node. |
java.util.List<Node> |
getChildren() |
Node |
getNextNode() |
ResourcePointer |
getPointer() |
boolean |
isBlockNode() |
abstract void |
render(CarrotEngine engine,
java.io.Writer writer,
Scope scope)
Render this node to the given
Writer. |
void |
renderChildren(CarrotEngine engine,
java.io.Writer writer,
Scope scope)
Render all of this
Node's children to the given Writer. |
protected Node(ResourcePointer ptr, boolean isBlockNode)
public void add(Node child)
Node to our list of children. Will only be called if isBlockNode() return true.child - The child Node to add.java.lang.IllegalStateException - if isBlockNode() returns false.@Nullable public java.util.List<Node> getChildren()
public boolean isBlockNode()
public boolean canChain(Node node)
Node can chain to the given node.node - The Node we want to check.public Node chain(Node nextNode)
Node. We save the given Node as our "next" node in the chain, and then
return it.java.lang.IllegalStateException - If you try to chain to a node where canChain(Node) returns false.@Nullable public Node getNextNode()
Node in this chain, if there is one.public ResourcePointer getPointer()
ResourcePointer that point to this Node's position in the resource. Useful for logging
errors and whatnot.public abstract void render(CarrotEngine engine, java.io.Writer writer, Scope scope) throws CarrotException, java.io.IOException
Writer.engine - The CarrotEngine we're running inside of.writer - The Writer to write this node to.scope - The current Scope, containing all our variables.CarrotException - if there's an error parsing or rendering the node.java.io.IOException - if there's an error writing to the Writer.public void renderChildren(CarrotEngine engine, java.io.Writer writer, Scope scope) throws CarrotException, java.io.IOException
Node's children to the given Writer.engine - The CarrotEngine we're running inside of.writer - The Writer to write this node to.scope - The current Scope, containing all our variables.CarrotException - if there's an error parsing or rendering the node.java.io.IOException - if there's an error writing to the Writer.