org.openfdl.core
Class FrameAttrNode

java.lang.Object
  extended by org.openfdl.core.FrameAttrNode
All Implemented Interfaces:
org.openfdl.text.FDLTreeParserTokenTypes

public class FrameAttrNode
extends java.lang.Object
implements org.openfdl.text.FDLTreeParserTokenTypes

FrameAttrNode.java This class is primarily used to create a simple linked list that simplifies the output of frame attribute data generated from the *.fdl file.

Version:
1.00
Author:
Matt Acosta

Field Summary
private  java.lang.String attrName
           
private  int attrType
           
private  java.lang.String newline
           
private  FrameAttrNode next
           
private  java.lang.String params
           
private  int slotNum
           
private  java.lang.String varType
           
 
Fields inherited from interface org.openfdl.text.FDLTreeParserTokenTypes
COLON, COMMA, COMMENT, EOF, IDENT, INTLIT, LBRAKET, LITERAL_appfunc, LITERAL_AppID, LITERAL_appvar, LITERAL_char, LITERAL_const, LITERAL_double, LITERAL_float, LITERAL_func, LITERAL_int, LITERAL_long, LITERAL_pFrame, LITERAL_short, LITERAL_signed, LITERAL_struct, LITERAL_union, LITERAL_unsigned, LITERAL_var, LPAREN, NULL_TREE_LOOKAHEAD, RBRAKET, RPAREN, SEMI, TIMES, WS
 
Constructor Summary
FrameAttrNode()
          Creates an empty object.
FrameAttrNode(int attrType, int slotNum, java.lang.String attrName, java.lang.String params, java.lang.String varType)
          Creates an object with the specified values already set.
 
Method Summary
 FrameAttrNode appendAttrNode(FrameAttrNode node)
          This methods sets the next field to the parameter value given, thereby adding it on to the linked list we are creating.
 FrameAttrNode appendAttrNode(int attrType, int slotNum, java.lang.String attrName, java.lang.String params, java.lang.String varType)
          Appends a new FrameAttrNode to this node.
 java.lang.String createHeader()
          Only for this node, will create a string of data that can be used in a header file that can then be used in a FRAME macro when creating a flash application.
private  java.lang.String getFuncString()
          Generates header code for use with a func or appfunc type.
 FrameAttrNode getNext()
           
private  java.lang.String getParamSummary()
          From the parameter string, creates a "summary" for use with a macro.
private  java.lang.String getVarString()
          From the class fields, creates all necessary variable data which includes a symbolic name and get/set macros.
 void setAttrName(java.lang.String attrName)
           
 void setAttrType(int attrType)
           
 void setParams(java.lang.String params)
           
 void setSlotNum(int slotNum)
           
 void setVarType(java.lang.String varType)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

attrType

private int attrType

slotNum

private int slotNum

attrName

private java.lang.String attrName

params

private java.lang.String params

varType

private java.lang.String varType

next

private FrameAttrNode next

newline

private final java.lang.String newline
Constructor Detail

FrameAttrNode

public FrameAttrNode()
Creates an empty object. You will have to use the set methods in this class this initialize the data fields prior to adding it to the list.


FrameAttrNode

public FrameAttrNode(int attrType,
                     int slotNum,
                     java.lang.String attrName,
                     java.lang.String params,
                     java.lang.String varType)
Creates an object with the specified values already set.

Parameters:
attrType - Type of node we are creating. This is a value representing "var", "appvar", "func" or "appfunc" from the FDLTreeParserTokenTypes interface. (Prefixed with "LITERAL_")
slotNum - Attribute slot number. This number must be greater than 0x10000 (OO_FIRST_APP_ATTR) since the rest are reserved by the AMS operating system.
attrName - Name of the given attribute, either the variable name or function name.
params - Parameters for a function, this value may be null for variables since it is not used in that case.
varType - The variable type or function return type, depending.
Method Detail

appendAttrNode

public FrameAttrNode appendAttrNode(int attrType,
                                    int slotNum,
                                    java.lang.String attrName,
                                    java.lang.String params,
                                    java.lang.String varType)
Appends a new FrameAttrNode to this node. For more info, see the links below.

See Also:
FrameAttrNode(int, int, String, String, String), appendAttrNode(FrameAttrNode)

appendAttrNode

public FrameAttrNode appendAttrNode(FrameAttrNode node)
This methods sets the next field to the parameter value given, thereby adding it on to the linked list we are creating.

Parameters:
node - FrameAttrNode object to append to the list.
Returns:
The next node in the list, meaning, this method returns what you gave it, the node parameter.
See Also:
appendAttrNode(int, int, String, String, String)

createHeader

public java.lang.String createHeader()
Only for this node, will create a string of data that can be used in a header file that can then be used in a FRAME macro when creating a flash application. You will generally have to call this multiple times along with the getNext() method.

Returns:
String representing all the data that will be output to the header file, for this particular node.
See Also:
getNext()

getVarString

private java.lang.String getVarString()
From the class fields, creates all necessary variable data which includes a symbolic name and get/set macros.

Returns:
String with data that can be used with a C compiler.

getFuncString

private java.lang.String getFuncString()
Generates header code for use with a func or appfunc type. Data includes a symbolic name and method call macro.

Returns:
String with data that can be used with a C compiler.

getParamSummary

private java.lang.String getParamSummary()
From the parameter string, creates a "summary" for use with a macro. More specifically, for the second parameter to a function (since the first parameter is always "obj") summarizes to a single letter 'a'. The third would then be 'b', the fourth 'c' and so on. If the parameter string is null you get an empty string, and if there are more than 26 parameters, you get "a", so too bad.

Returns:
String with the ABCs; separated by commas.
See Also:
getFuncString()

toString

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

getNext

public FrameAttrNode getNext()

setAttrName

public void setAttrName(java.lang.String attrName)

setAttrType

public void setAttrType(int attrType)

setParams

public void setParams(java.lang.String params)

setSlotNum

public void setSlotNum(int slotNum)

setVarType

public void setVarType(java.lang.String varType)