com.rubecula.util
Class PresentableString

java.lang.Object
  |
  +--com.rubecula.util.PresentableString
All Implemented Interfaces:
Presentable

public class PresentableString
extends java.lang.Object
implements Presentable

This class represents a Presentable string which can be used for several purposes such as expressions, formulas, etc.

Version:
$Revision:$
Author:
Robin Hillyard

Constructor Summary
PresentableString(java.lang.String value)
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PresentableString

public PresentableString(java.lang.String value)
Method Detail

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.

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.