tip.display
Class NodeText<T extends Node>

java.lang.Object
  extended by tip.analysis.AnswerAdapter<String>
      extended by tip.display.NodeText<T>
Type Parameters:
T - type of node for which the NodeText applies
All Implemented Interfaces:
Answer<String>, Stringifier<T>

public class NodeText<T extends Node>
extends AnswerAdapter<String>
implements Stringifier<T>

NodeText implements the Answer and Stringifier interfaces to support a custom textual representation of nodes.

Author:
Johnni Winther

Constructor Summary
NodeText()
           
 
Method Summary
 String caseABinopExp(ABinopExp node)
          Returns the default answer for a ABinopExp node.
 String caseADeclStm(ADeclStm node)
          Returns the default answer for a ADeclStm node.
 String caseADerefExp(ADerefExp node)
          Returns the default answer for a ADerefExp node.
 String caseAFunctionCallExp(AFunctionCallExp node)
          Returns the default answer for a AFunctionCallExp node.
 String caseAFunctionPtrCallExp(AFunctionPtrCallExp node)
          Returns the default answer for a AFunctionPtrCallExp node.
 String caseAIfThenElseStm(AIfThenElseStm node)
          Returns the default answer for a AIfThenElseStm node.
 String caseAIfThenStm(AIfThenStm node)
          Returns the default answer for a AIfThenStm node.
 String caseAInputExp(AInputExp node)
          Returns the default answer for a AInputExp node.
 String caseAIntConstExp(AIntConstExp node)
          Returns the default answer for a AIntConstExp node.
 String caseALocalDecl(ALocalDecl node)
          Returns the default answer for a ALocalDecl node.
 String caseAMallocExp(AMallocExp node)
          Returns the default answer for a AMallocExp node.
 String caseANullExp(ANullExp node)
          Returns the default answer for a ANullExp node.
 String caseAOutputStm(AOutputStm node)
          Returns the default answer for a AOutputStm node.
 String caseAPointerExp(APointerExp node)
          Returns the default answer for a APointerExp node.
 String caseAReturnStm(AReturnStm node)
          Returns the default answer for a AReturnStm node.
 String caseAVarExp(AVarExp node)
          Returns the default answer for a AVarExp node.
 String caseAWhileStm(AWhileStm node)
          Returns the default answer for a AWhileStm node.
 String caseAAssignPtrStm(AAssignPtrStm node)
          Returns the default answer for a AAssignPtrStm node.
 String caseAAssignVarStm(AAssignVarStm node)
          Returns the default answer for a AAssignVarStm node.
 String defaultNode(Node node)
          Returns the default answer for a Node.
 String defaultPBinop(PBinop binop)
          Returns the default answer for a PBinop node.
 String toString(T node)
          Returns a textual representation of t.
 
Methods inherited from class tip.analysis.AnswerAdapter
caseABlock, caseABlockStm, caseABody, caseADivideBinop, caseAEqBinop, caseAFuncDecl, caseAGtBinop, caseAMinusBinop, caseAPlusBinop, caseAProgram, caseATimesBinop, caseEOF, caseStart, caseTAnd, caseTAssign, caseTComma, caseTCommentBlock, caseTCommentSingle, caseTDiv, caseTElse, caseTEq, caseTGt, caseTIdentifier, caseTIf, caseTInput, caseTIntegerConst, caseTLBrace, caseTLPar, caseTMalloc, caseTMinus, caseTNull, caseTOutput, caseTPlus, caseTRBrace, caseTReturn, caseTRPar, caseTSemicolon, caseTStar, caseTVar, caseTWhile, caseTWhiteSpace, defaultPBlock, defaultPBody, defaultPDecl, defaultPExp, defaultPProgram, defaultPStm, defaultToken
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeText

public NodeText()
Method Detail

toString

public String toString(T node)
Description copied from interface: Stringifier
Returns a textual representation of t.

Specified by:
toString in interface Stringifier<T extends Node>
Parameters:
node - the object for which a textual representation is returned
Returns:
a textual representation of t

defaultNode

public String defaultNode(Node node)
Description copied from class: AnswerAdapter
Returns the default answer for a Node.

Overrides:
defaultNode in class AnswerAdapter<String>
Parameters:
node - the calling Node
Returns:
the default answer for a Node

caseABinopExp

public String caseABinopExp(ABinopExp node)
Description copied from class: AnswerAdapter
Returns the default answer for a ABinopExp node. The call is deferred to AnswerAdapter.defaultPExp(PExp).

Specified by:
caseABinopExp in interface Answer<String>
Overrides:
caseABinopExp in class AnswerAdapter<String>
Parameters:
node - the calling ABinopExp node
Returns:
the default answer for a ABinopExp node

caseAIfThenElseStm

public String caseAIfThenElseStm(AIfThenElseStm node)
Description copied from class: AnswerAdapter
Returns the default answer for a AIfThenElseStm node. The call is deferred to AnswerAdapter.defaultPStm(PStm).

Specified by:
caseAIfThenElseStm in interface Answer<String>
Overrides:
caseAIfThenElseStm in class AnswerAdapter<String>
Parameters:
node - the calling AIfThenElseStm node
Returns:
the default answer for a AIfThenElseStm node

caseAIfThenStm

public String caseAIfThenStm(AIfThenStm node)
Description copied from class: AnswerAdapter
Returns the default answer for a AIfThenStm node. The call is deferred to AnswerAdapter.defaultPStm(PStm).

Specified by:
caseAIfThenStm in interface Answer<String>
Overrides:
caseAIfThenStm in class AnswerAdapter<String>
Parameters:
node - the calling AIfThenStm node
Returns:
the default answer for a AIfThenStm node

caseAWhileStm

public String caseAWhileStm(AWhileStm node)
Description copied from class: AnswerAdapter
Returns the default answer for a AWhileStm node. The call is deferred to AnswerAdapter.defaultPStm(PStm).

Specified by:
caseAWhileStm in interface Answer<String>
Overrides:
caseAWhileStm in class AnswerAdapter<String>
Parameters:
node - the calling AWhileStm node
Returns:
the default answer for a AWhileStm node

caseAAssignVarStm

public String caseAAssignVarStm(AAssignVarStm node)
Description copied from class: AnswerAdapter
Returns the default answer for a AAssignVarStm node. The call is deferred to AnswerAdapter.defaultPStm(PStm).

Specified by:
caseAAssignVarStm in interface Answer<String>
Overrides:
caseAAssignVarStm in class AnswerAdapter<String>
Parameters:
node - the calling AAssignVarStm node
Returns:
the default answer for a AAssignVarStm node

caseAAssignPtrStm

public String caseAAssignPtrStm(AAssignPtrStm node)
Description copied from class: AnswerAdapter
Returns the default answer for a AAssignPtrStm node. The call is deferred to AnswerAdapter.defaultPStm(PStm).

Specified by:
caseAAssignPtrStm in interface Answer<String>
Overrides:
caseAAssignPtrStm in class AnswerAdapter<String>
Parameters:
node - the calling AAssignPtrStm node
Returns:
the default answer for a AAssignPtrStm node

caseAMallocExp

public String caseAMallocExp(AMallocExp node)
Description copied from class: AnswerAdapter
Returns the default answer for a AMallocExp node. The call is deferred to AnswerAdapter.defaultPExp(PExp).

Specified by:
caseAMallocExp in interface Answer<String>
Overrides:
caseAMallocExp in class AnswerAdapter<String>
Parameters:
node - the calling AMallocExp node
Returns:
the default answer for a AMallocExp node

caseAInputExp

public String caseAInputExp(AInputExp node)
Description copied from class: AnswerAdapter
Returns the default answer for a AInputExp node. The call is deferred to AnswerAdapter.defaultPExp(PExp).

Specified by:
caseAInputExp in interface Answer<String>
Overrides:
caseAInputExp in class AnswerAdapter<String>
Parameters:
node - the calling AInputExp node
Returns:
the default answer for a AInputExp node

caseANullExp

public String caseANullExp(ANullExp node)
Description copied from class: AnswerAdapter
Returns the default answer for a ANullExp node. The call is deferred to AnswerAdapter.defaultPExp(PExp).

Specified by:
caseANullExp in interface Answer<String>
Overrides:
caseANullExp in class AnswerAdapter<String>
Parameters:
node - the calling ANullExp node
Returns:
the default answer for a ANullExp node

caseAPointerExp

public String caseAPointerExp(APointerExp node)
Description copied from class: AnswerAdapter
Returns the default answer for a APointerExp node. The call is deferred to AnswerAdapter.defaultPExp(PExp).

Specified by:
caseAPointerExp in interface Answer<String>
Overrides:
caseAPointerExp in class AnswerAdapter<String>
Parameters:
node - the calling APointerExp node
Returns:
the default answer for a APointerExp node

caseADerefExp

public String caseADerefExp(ADerefExp node)
Description copied from class: AnswerAdapter
Returns the default answer for a ADerefExp node. The call is deferred to AnswerAdapter.defaultPExp(PExp).

Specified by:
caseADerefExp in interface Answer<String>
Overrides:
caseADerefExp in class AnswerAdapter<String>
Parameters:
node - the calling ADerefExp node
Returns:
the default answer for a ADerefExp node

caseAFunctionCallExp

public String caseAFunctionCallExp(AFunctionCallExp node)
Description copied from class: AnswerAdapter
Returns the default answer for a AFunctionCallExp node. The call is deferred to AnswerAdapter.defaultPExp(PExp).

Specified by:
caseAFunctionCallExp in interface Answer<String>
Overrides:
caseAFunctionCallExp in class AnswerAdapter<String>
Parameters:
node - the calling AFunctionCallExp node
Returns:
the default answer for a AFunctionCallExp node

caseAFunctionPtrCallExp

public String caseAFunctionPtrCallExp(AFunctionPtrCallExp node)
Description copied from class: AnswerAdapter
Returns the default answer for a AFunctionPtrCallExp node. The call is deferred to AnswerAdapter.defaultPExp(PExp).

Specified by:
caseAFunctionPtrCallExp in interface Answer<String>
Overrides:
caseAFunctionPtrCallExp in class AnswerAdapter<String>
Parameters:
node - the calling AFunctionPtrCallExp node
Returns:
the default answer for a AFunctionPtrCallExp node

caseAReturnStm

public String caseAReturnStm(AReturnStm node)
Description copied from class: AnswerAdapter
Returns the default answer for a AReturnStm node. The call is deferred to AnswerAdapter.defaultPStm(PStm).

Specified by:
caseAReturnStm in interface Answer<String>
Overrides:
caseAReturnStm in class AnswerAdapter<String>
Parameters:
node - the calling AReturnStm node
Returns:
the default answer for a AReturnStm node

caseAOutputStm

public String caseAOutputStm(AOutputStm node)
Description copied from class: AnswerAdapter
Returns the default answer for a AOutputStm node. The call is deferred to AnswerAdapter.defaultPStm(PStm).

Specified by:
caseAOutputStm in interface Answer<String>
Overrides:
caseAOutputStm in class AnswerAdapter<String>
Parameters:
node - the calling AOutputStm node
Returns:
the default answer for a AOutputStm node

caseADeclStm

public String caseADeclStm(ADeclStm node)
Description copied from class: AnswerAdapter
Returns the default answer for a ADeclStm node. The call is deferred to AnswerAdapter.defaultPStm(PStm).

Specified by:
caseADeclStm in interface Answer<String>
Overrides:
caseADeclStm in class AnswerAdapter<String>
Parameters:
node - the calling ADeclStm node
Returns:
the default answer for a ADeclStm node

caseAVarExp

public String caseAVarExp(AVarExp node)
Description copied from class: AnswerAdapter
Returns the default answer for a AVarExp node. The call is deferred to AnswerAdapter.defaultPExp(PExp).

Specified by:
caseAVarExp in interface Answer<String>
Overrides:
caseAVarExp in class AnswerAdapter<String>
Parameters:
node - the calling AVarExp node
Returns:
the default answer for a AVarExp node

caseAIntConstExp

public String caseAIntConstExp(AIntConstExp node)
Description copied from class: AnswerAdapter
Returns the default answer for a AIntConstExp node. The call is deferred to AnswerAdapter.defaultPExp(PExp).

Specified by:
caseAIntConstExp in interface Answer<String>
Overrides:
caseAIntConstExp in class AnswerAdapter<String>
Parameters:
node - the calling AIntConstExp node
Returns:
the default answer for a AIntConstExp node

caseALocalDecl

public String caseALocalDecl(ALocalDecl node)
Description copied from class: AnswerAdapter
Returns the default answer for a ALocalDecl node. The call is deferred to AnswerAdapter.defaultPDecl(PDecl).

Specified by:
caseALocalDecl in interface Answer<String>
Overrides:
caseALocalDecl in class AnswerAdapter<String>
Parameters:
node - the calling ALocalDecl node
Returns:
the default answer for a ALocalDecl node

defaultPBinop

public String defaultPBinop(PBinop binop)
Description copied from class: AnswerAdapter
Returns the default answer for a PBinop node. The call is deferred to AnswerAdapter.defaultNode(Node).

Overrides:
defaultPBinop in class AnswerAdapter<String>
Parameters:
binop - the calling PBinop node
Returns:
the default answer for a PBinop node