org.jruby.ast
Class ListNode

java.lang.Object
  extended byorg.jruby.ast.Node
      extended byorg.jruby.ast.ListNode
All Implemented Interfaces:
InstructionContext, ISourcePositionHolder, java.io.Serializable
Direct Known Subclasses:
ArrayNode, BlockNode, DRegexpNode, DStrNode, DSymbolNode, DXStrNode

public class ListNode
extends Node

All Nodes which have a list representation inherit this. This is also used as generic container for additional information that is not directly evaluated. In particular, f_arg production rule uses this to capture arg information for the editor projects who want position info saved.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jruby.ast.Node
instruction, nodeId
 
Constructor Summary
ListNode(ISourcePosition position)
           
ListNode(ISourcePosition position, int id)
           
ListNode(ISourcePosition position, int id, Node firstNode)
          Create a new ListNode.
 
Method Summary
 Instruction accept(NodeVisitor visitor)
           
 ListNode add(Node node)
           
 ListNode addAll(ListNode other)
          Add all elements in other list to this list node.
 ListNode addAll(Node other)
          Add other element to this list
 java.util.List childNodes()
           
 Node get(int idx)
           
 Node getLast()
           
 ListNode prepend(Node node)
           
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class org.jruby.ast.Node
addComment, addComments, createList, createList, createList, createList, getComments, getNodeName, getPosition, getPositionIncludingComments, hasComments, setPosition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ListNode

public ListNode(ISourcePosition position,
                int id,
                Node firstNode)
Create a new ListNode.

Parameters:
id - type of listnode
firstNode - first element of the list

ListNode

public ListNode(ISourcePosition position,
                int id)

ListNode

public ListNode(ISourcePosition position)
Method Detail

add

public ListNode add(Node node)

prepend

public ListNode prepend(Node node)

size

public int size()

addAll

public ListNode addAll(ListNode other)
Add all elements in other list to this list node.

Parameters:
other - list which has elements
Returns:
this instance for method chaining

addAll

public ListNode addAll(Node other)
Add other element to this list

Parameters:
other - list which has elements
Returns:
this instance for method chaining

getLast

public Node getLast()

toString

public java.lang.String toString()
Overrides:
toString in class Node

childNodes

public java.util.List childNodes()
Specified by:
childNodes in class Node

accept

public Instruction accept(NodeVisitor visitor)
Specified by:
accept in class Node

get

public Node get(int idx)


Copyright © 2002-2007 JRuby Team. All Rights Reserved.