net.percederberg.mib.asn1.node
Class Production

java.lang.Object
  |
  +--net.percederberg.mib.asn1.node.Node
        |
        +--net.percederberg.mib.asn1.node.Production
All Implemented Interfaces:
NodeConstants, Switchable

public class Production
extends Node

This class represents a production node in the parse tree. A production node is equivalent to a grammar rule (or production), sometimes also referred to as a syntesized node.

Version:
1.3
Author:
Per Cederberg, per@percederberg.net

Field Summary
 
Fields inherited from class net.percederberg.mib.asn1.node.Node
kind
 
Fields inherited from interface net.percederberg.mib.asn1.node.NodeConstants
ALPHABETCONSTRAINT, ANYTYPE, ASSIGNMENT, ASSIGNMENTLIST, BINARYSTRING, BITSTRINGTYPE, BOOLEANVALUE, BUILTINTYPE, BUILTINVALUE, CHARSTRING, CHOICETYPE, CLASS, CLASSNUMBER, COMPLIANCEGROUP, COMPLIANCEOBJECT, CONSTRAINT, CONSTRAINTLIST, DEFINEDMACRONAME, DEFINEDMACROTYPE, DEFINEDTYPE, DEFINEDVALUE, ELEMENTTYPE, ELEMENTTYPELIST, ENUMERATEDTYPE, EOF, EXPORTS, HEXSTRING, IDENTIFIER, IMPORTS, INTEGERTYPE, LOWERENDPOINT, MACROBODY, MACRODEFINITION, MACROREFERENCE, MODULEBODY, MODULEDEFINITION, MODULEIDENTIFIER, MODULEREFERENCE, NAMEANDNUMBERFORM, NAMEDBIT, NAMEDBITS, NAMEDNUMBER, NAMEDNUMBERLIST, NAMEDTYPE, NAMEDVALUE, NULLVALUE, NUMBER, OBJECTIDENTIFIERVALUE, OBJIDCOMPONENT, OBJIDCOMPONENTLIST, productionNodeName, SELECTIONTYPE, SEQUENCEOFTYPE, SEQUENCETYPE, SETOFTYPE, SETTYPE, SIGNEDNUMBER, SIZECONSTRAINT, SKIPTOEND, SNMPACCESSPART, SNMPAGENTCAPABILITIESMACROTYPE, SNMPCOMPLIANCEPART, SNMPCONTACTPART, SNMPCREATIONPART, SNMPDEFVALPART, SNMPDESCRPART, SNMPDISPLAYPART, SNMPENTERPRISEPART, SNMPINDEXPART, SNMPMANDATORYPART, SNMPMODULECOMPLIANCEMACROTYPE, SNMPMODULEIDENTITYMACROTYPE, SNMPMODULEPART, SNMPMODULESUPPORTPART, SNMPNOTIFICATIONGROUPMACROTYPE, SNMPNOTIFICATIONSPART, SNMPNOTIFICATIONTYPEMACROTYPE, SNMPOBJECTGROUPMACROTYPE, SNMPOBJECTIDENTITYMACROTYPE, SNMPOBJECTSPART, SNMPOBJECTTYPEMACROTYPE, SNMPORGANIZATIONPART, SNMPPRODUCTRELEASEPART, SNMPREFERPART, SNMPREVISIONPART, SNMPSTATUSPART, SNMPSYNTAXPART, SNMPTEXTUALCONVENTIONMACROTYPE, SNMPTRAPTYPEMACROTYPE, SNMPUNITSPART, SNMPUPDATEPART, SNMPVARIATIONPART, SNMPVARPART, SNMPWRITESYNTAXPART, SPECIALREALVALUE, START, STRINGTYPE, SYMBOL, SYMBOLLIST, SYMBOLSFROMMODULE, SYMBOLSFROMMODULELIST, TABSENT, TACCESS, TAG, TAGDEFAULT, TAGENT_CAPABILITIES, TAGGEDTYPE, TANY, TAPPLICATION, TASSIGN, TAUGMENTS, TBAR, TBEGIN, TBINSTRING, TBIT, TBITS, TBOOLEAN, TBY, TCHOICE, TCOMMA, TCOMPONENT, TCOMPONENTS, TCONTACT_INFO, TCREATION_REQUIRES, TCSTRING, TDEFAULT, TDEFINED, TDEFINITIONS, TDEFVAL, TDESCRIPTION, TDISPLAY_HINT, TDOT, TEND, TENTERPRISE, TENUMERATED, TEXPLICIT, TEXPORTS, TFALSE, TFROM, TGROUP, THEXSTRING, TIDENT, TIDENTIFIER, TIMPLICIT, TIMPLIED, TIMPORTS, TINCLUDES, TINDEX, TINTEGER, TLAST_UPDATED, TLEFTBRACE, TLEFTBRACKET, TLEFTPAREN, TLESSTHAN, TMACRO, TMANDATORY_GROUPS, TMAX, TMAX_ACCESS, TMIN, TMIN_ACCESS, TMINUS, TMINUS_INFINITY, TMODULE, TMODULE_COMPLIANCE, TMODULE_IDENTITY, TNOTIFICATION_GROUP, TNOTIFICATION_TYPE, TNOTIFICATIONS, TNULL, TNUMBER, TOBJECT, TOBJECT_GROUP, TOBJECT_IDENTITY, TOBJECT_TYPE, TOBJECTS, TOCTET, TOF, tokenNodeName, TOPTIONAL, TORGANIZATION, TPLUS_INFINITY, TPRESENT, TPRIVATE, TPRODUCT_RELEASE, TREAL, TREFERENCE, TREVISION, TRIGHTBRACE, TRIGHTBRACKET, TRIGHTPAREN, TSEMI_COLON, TSEQUENCE, TSET, TSIZE, TSTATUS, TSTRING, TSUPPORTS, TSYNTAX, TTAGS, TTEXTUAL_CONVENTION, TTRAP_TYPE, TTRUE, TUNITS, TUNIVERSAL, TVARIABLES, TVARIATION, TWITH, TWRITE_SYNTAX, TYPE, TYPEASSIGNMENT, TYPEORBITS, TYPEORVALUE, TYPEORVALUELIST, TYPEREFERENCE, UPPERENDPOINT, VALUE, VALUEASSIGNMENT, VALUECONSTRAINT, VALUELIST, VALUERANGE, VARTYPES
 
Constructor Summary
Production(int kind)
          Create a new node without children or parent.
Production(int kind, Node parent)
          Create a new node with the given parent, but without children.
 
Method Summary
 void addChild(Node child)
          Adds a child to the node.
 Node childAfter(Node child)
          Returns the child coming after the given child.
 Node childAt(int index)
          Returns a child with the given index.
 Node childOfType(int type)
          Returns the first child of the given type.
 int children()
          Returns the number of children to the current node.
 int childrenOfType(int type)
          Returns the number of children of a given type to the current node.
 int firstColumn()
          Finds the first column for the node.
 int firstLine()
          Finds the first line for the node.
 int lastColumn()
          Finds the last column for the node.
 int lastLine()
          Finds the last line for the node.
 
Methods inherited from class net.percederberg.mib.asn1.node.Node
apply, getParent, isAncestor, isParent, isType, setParent, toName, toName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Production

public Production(int kind)
Create a new node without children or parent.

Parameters:
kind - the kind of node (a node constant value)

Production

public Production(int kind,
                  Node parent)
Create a new node with the given parent, but without children.

Parameters:
kind - the kind of node
parent - the node parent
Method Detail

addChild

public void addChild(Node child)
Adds a child to the node. The child will be added last, i.e. as the rightmost child.

Parameters:
child - the child to add

childAfter

public Node childAfter(Node child)
Returns the child coming after the given child.

Overrides:
childAfter in class Node
Parameters:
child - a child node
Returns:
the next child, or null if no next child

childAt

public Node childAt(int index)
Returns a child with the given index.

Overrides:
childAt in class Node
Parameters:
index - a child index, from 0 to children() - 1
Returns:
a child node, or null

childOfType

public Node childOfType(int type)
Returns the first child of the given type.

Overrides:
childOfType in class Node
Parameters:
type - a node type constant value
Returns:
a child node, or null

children

public int children()
Returns the number of children to the current node.

Overrides:
children in class Node
Returns:
the number of children, or zero for no children

childrenOfType

public int childrenOfType(int type)
Returns the number of children of a given type to the current node.

Overrides:
childrenOfType in class Node
Parameters:
type - the type number
Returns:
the number of children, or zero for no children

firstLine

public int firstLine()
Finds the first line for the node.

Overrides:
firstLine in class Node
Returns:
the first line, or -1 if no token present

firstColumn

public int firstColumn()
Finds the first column for the node.

Overrides:
firstColumn in class Node
Returns:
the first column, or -1 if no token present

lastLine

public int lastLine()
Finds the last line for the node.

Overrides:
lastLine in class Node
Returns:
the last line, or -1 if no token present

lastColumn

public int lastColumn()
Finds the last column for the node.

Overrides:
lastColumn in class Node
Returns:
the last column, or -1 if no token present