com.rubecula.util
Class Symbol

java.lang.Object
  extended bycom.rubecula.util.Symbol
All Implemented Interfaces:
Presentable
Direct Known Subclasses:
Operator

public class Symbol
extends java.lang.Object
implements Presentable

Symbol Class. This class is used to model non-numerical objects which appear in expressions, such as operators, variable references, parentheses, etc.

Copyright: Copyright (c) 2003

Company: Rubecula Software

Since:
V_0_3
Version:
$Revision: 1.3 $
Author:
Robin Hillyard

Field Summary
protected  java.lang.String _S
           
 
Constructor Summary
Symbol(java.lang.String s)
           
 
Method Summary
 java.lang.String getType()
          This method is primarily for development purposes: it yields the name of the class of the presentable object or, in some cases, the class of the presentable object indirectly referenced.
 Presentable makePresentableInstance(Presentation presentation)
          Instance method to convert a Presentation into a Presentable.
 Presentation present(AttrMap attributes)
          Convert this Presentable object into a Presentation, according to the set of attributes provided.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_S

protected final java.lang.String _S
Constructor Detail

Symbol

public Symbol(java.lang.String s)
Method Detail

toString

public java.lang.String toString()

present

public Presentation present(AttrMap attributes)
                     throws PresentationException
Description copied from interface: Presentable
Convert this Presentable object into a Presentation, according to the set of attributes provided.

Specified by:
present in interface Presentable
Parameters:
attributes - a map of the attributes desired for the construction of the new presentation (may be empty).
Returns:
an appropriate instance of Presentation.
Throws:
PresentationException - in case of parsing error.

getType

public java.lang.String getType()
This method is primarily for development purposes: it yields the name of the class of the presentable object or, in some cases, the class of the presentable object indirectly referenced. The text returned is canonical class name (subclasses may choose to override this).

Specified by:
getType in interface Presentable
Returns:
a representation of the effective class of this object.

makePresentableInstance

public Presentable makePresentableInstance(Presentation presentation)
                                    throws PresentationException
Description copied from interface: Presentable
Instance method to convert a Presentation into a Presentable. Ideally, this would be a class method, but such a method cannot be defined in an interface. Nor can it be defined in an abstract class with the intention of overriding it in a subclass. Polymorphism just doesn't work that way.
Therefore, the present value (as in fields) of the instance is essentially ignored - only the methods are important.

Specified by:
makePresentableInstance in interface Presentable
Parameters:
presentation - of a number to be converted into a Presentable number.
Returns:
a number in the form of a Presentable.
Throws:
PresentationException - in case of parsing error.