com.rubecula.jquantity
Class SymbolicPresentation

java.lang.Object
  |
  +--com.rubecula.util.Presentation
        |
        +--com.rubecula.jquantity.SymbolicPresentation
All Implemented Interfaces:
Auditable

public class SymbolicPresentation
extends Presentation

Class to model the presentation of symbolic text, for example in a mathematical formula.

Version:
$Revision: 1.1 $
Author:
Robin Hillyard

Field Summary
 
Fields inherited from class com.rubecula.util.Presentation
$empty, $Stars
 
Constructor Summary
  SymbolicPresentation()
          Secondary constructor to create an empty SymbolicPresentation.
  SymbolicPresentation(Presentation presentation)
          Secondary constructor.
  SymbolicPresentation(java.lang.String string)
          Secondary constructor.
protected SymbolicPresentation(java.util.Vector presentations)
          Primary constructor.
 
Method Summary
 void add(java.lang.Object o)
          Add a Presentation or String to this SymbolicPresentation
 java.lang.String audit(java.lang.String label)
          Method to return a detailed string from an object for debugging purposes.
 java.lang.String getIdentifier()
          Method to get the specific identifier for an object.
 Presentable parse()
          Method to parse this text presentation and create a new Presentable object.
 java.lang.String toString(int width)
          Render this Presentation as a String within the width specified.
 
Methods inherited from class com.rubecula.util.Presentation
audit, audit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SymbolicPresentation

protected SymbolicPresentation(java.util.Vector presentations)
Primary constructor.

Parameters:
presentations - the vector of presentations.

SymbolicPresentation

public SymbolicPresentation()
Secondary constructor to create an empty SymbolicPresentation.


SymbolicPresentation

public SymbolicPresentation(Presentation presentation)
Secondary constructor.

Parameters:
presentation - the initial presentation for this new SymbolicPresentation.

SymbolicPresentation

public SymbolicPresentation(java.lang.String string)
Secondary constructor.

Parameters:
string - the text for the one (simple) presentation.
Method Detail

toString

public java.lang.String toString(int width)
Render this Presentation as a String within the width specified.

Specified by:
toString in class Presentation
Parameters:
width - the max. number of characters within which to output the presentation.
Returns:
a representation (rendering) of this Presentation.
Throws:
PresentationException - if the presentation cannot be rendered within the given width.

audit

public java.lang.String audit(java.lang.String label)
Description copied from interface: Auditable
Method to return a detailed string from an object for debugging purposes.

Parameters:
label - the label to associate with the data. If label is non-null, a more detailed audit will be returned (this normally occurs only at the top level).
Returns:
the detailed string.

parse

public Presentable parse()
Method to parse this text presentation and create a new Presentable object.

Specified by:
parse in class Presentation
Returns:
an object of class defined by #_PresentableClass.
Throws:
java.lang.RuntimeException - if the text presentation cannot be parsed.

getIdentifier

public java.lang.String getIdentifier()
Method to get the specific identifier for an object.

Returns:
the text itself.

add

public void add(java.lang.Object o)
         throws PresentationException
Add a Presentation or String to this SymbolicPresentation

Parameters:
o - the Presentation or String to be added.
Throws:
PresentationException - if o is not a Presentation or String.