fmrisc.Syntax
Class Number

java.lang.Object
  extended by fmrisc.Syntax.ASTBase
      extended by fmrisc.Syntax.Number
All Implemented Interfaces:
AST, Expression

public final class Number
extends ASTBase
implements Expression

Handling of numbers.


Constructor Summary
Number(java.lang.String digits)
          construct number from digit representation
 
Method Summary
 AST accept(ASTVisitor visitor)
          Accept visitor for a visit.
 java.lang.String getDigits()
          get digit representation of number
 int getPriority()
          get binding level for printing (lower numbers mean greater binding power)
 Expression instantiate()
          return copy of AST with value references instantiated by the substitutions set in the corresponding declaration identifiers
 void print(java.io.PrintWriter out)
          Prints text representation of tree on out (without new line termination).
 void printCore(java.io.PrintWriter out)
          Prints text representation of tree on out (without new line termination).
 void printPriority(int treshold, java.io.PrintWriter out)
          print expression, use parentheses if priority is greater than treshold
 
Methods inherited from class fmrisc.Syntax.ASTBase
printParens, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface fmrisc.Syntax.AST
printParens, toString
 

Constructor Detail

Number

public Number(java.lang.String digits)
construct number from digit representation

Parameters:
digits - the digit representation
Method Detail

getDigits

public java.lang.String getDigits()
get digit representation of number

Returns:
the digit representation

getPriority

public int getPriority()
get binding level for printing (lower numbers mean greater binding power)

Specified by:
getPriority in interface Expression
Returns:
the priority level

printCore

public void printCore(java.io.PrintWriter out)
Prints text representation of tree on out (without new line termination).

Specified by:
printCore in interface AST
Specified by:
printCore in class ASTBase
Parameters:
out - the stream on which the text is written

print

public void print(java.io.PrintWriter out)
Prints text representation of tree on out (without new line termination). Overrides ASTBase.print such that parentheses are never printed around the number.

Specified by:
print in interface AST
Overrides:
print in class ASTBase
Parameters:
out - the stream on which the text is written

printPriority

public void printPriority(int treshold,
                          java.io.PrintWriter out)
print expression, use parentheses if priority is greater than treshold

Specified by:
printPriority in interface Expression
Parameters:
treshold - priority level of enclosing expression
out - writer to print expression on

instantiate

public Expression instantiate()
return copy of AST with value references instantiated by the substitutions set in the corresponding declaration identifiers

Specified by:
instantiate in interface Expression
Returns:
the instantiated copy

accept

public AST accept(ASTVisitor visitor)
Accept visitor for a visit.

Specified by:
accept in interface AST
Parameters:
visitor - the visitor who is accepted by this node.
Returns:
the result of the visit (may be not null)