|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.rubecula.util.Presentation
com.rubecula.jquantity.SymbolicPresentation
Class to model the presentation of symbolic text, for example in a mathematical formula.
Field Summary | |
(package private) static java.lang.String |
_PresentableClass
This string defines the class which will be used to parse JQuantityPresentations. |
private java.util.Vector |
_Presentations
List of component presentations, some of which may be pure Strings. |
static java.lang.String |
$E
The symbolic representation of e (base of natural logarithms) - i.e. the letter e alone. |
static java.lang.String |
$I
The symbolic representation of i - i.e. the square root of -1. |
static java.lang.String |
$Infinity
The symbolic representation of infinity. |
static java.lang.String |
$Pi
The symbolic representation of pi - i.e. the greek letter. |
Fields inherited from class com.rubecula.util.Presentation |
_Appearance, $empty, $Stars |
Constructor Summary | |
|
SymbolicPresentation()
Secondary constructor to create an empty SymbolicPresentation. |
|
SymbolicPresentation(Presentation presentation)
Secondary constructor. |
|
SymbolicPresentation(Presentation presentation1,
Presentation presentation2)
Secondary constructor. |
|
SymbolicPresentation(Presentation presentation1,
java.lang.String presentation2)
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. |
AttrMap |
getAttributes()
Return the attributes with which this presentation was created, or at least the best guess. |
java.lang.String |
getIdentifier()
Method to get the specific identifier for an object. |
private static Presentable |
GetPresentable(java.lang.Object component)
|
java.lang.String |
getPresentableClass()
Method to get the name of the corresponding Presentable class for this Presentation. |
protected boolean |
isOperator(java.lang.String string)
|
java.util.Iterator |
iterator()
|
private int |
length()
Method to get the lengthwise dimension of this presentation. |
static void |
main(java.lang.String[] args)
Main method for testing this class. |
private static Presentable |
parseStringComponent(java.lang.String component)
Method to parse this text presentation and create a new Presentable object. |
void |
refineStructure(java.lang.Object token)
This method is used to discover serial-type delimiters and create an appropriate structure. |
void |
refineStructure(java.lang.Object tokenStart,
java.lang.Object tokenEnd)
This method is used to discover open/close delimiter pairs and create an appropriate structure. |
void |
render(StylishWriteable doc)
This method is used to render this object in the context of a StylishWriteable doc. |
void |
replace(int index,
java.lang.Object o)
|
protected static void |
testPresentation(java.io.PrintStream out,
Presentation presentation,
java.lang.String label)
|
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, parse, toString, updateAppearance |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String $Pi
public static final java.lang.String $I
public static final java.lang.String $E
public static final java.lang.String $Infinity
private java.util.Vector _Presentations
static java.lang.String _PresentableClass
Constructor Detail |
protected SymbolicPresentation(java.util.Vector presentations)
presentations
- the vector of presentations.public SymbolicPresentation()
public SymbolicPresentation(Presentation presentation)
presentation
- the initial presentation for this new SymbolicPresentation.public SymbolicPresentation(Presentation presentation1, Presentation presentation2)
presentation1
- the initial presentation for this new SymbolicPresentation.presentation2
- the second presentation for this new SymbolicPresentation.public SymbolicPresentation(Presentation presentation1, java.lang.String presentation2)
presentation1
- the initial presentation for this new SymbolicPresentation.presentation2
- the second presentation for this new SymbolicPresentation.public SymbolicPresentation(java.lang.String string)
string
- the text for the one (simple) presentation.Method Detail |
protected static void testPresentation(java.io.PrintStream out, Presentation presentation, java.lang.String label)
public static void main(java.lang.String[] args)
args
- String[] : the command line options.public AttrMap getAttributes() throws PresentationException
getAttributes
in class Presentation
PresentationException
public java.lang.String toString(int width)
toString
in class Presentation
width
- the max. number of characters within which to output the
presentation.
PresentationException
- if the presentation cannot be rendered
within the given width.
// TODO make this more sophisticated. Currently it just concatenates the
presentations.
// TODO deal more properly with the case where we ignore non-trailing "1"
presentations.
// TODO in particular, we want to add more structure including spacing
between elements.public java.lang.String audit(java.lang.String label)
Auditable
audit
in interface Auditable
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).
public java.lang.String getPresentableClass()
getPresentableClass
in class Presentation
_PresentableClass
.public java.lang.String getIdentifier()
getIdentifier
in interface Identifiable
public void render(StylishWriteable doc)
Documentable
StylishWriteable
doc.
render
in interface Documentable
doc
- the document in which to render this object.private static Presentable parseStringComponent(java.lang.String component) throws PresentationException
component
- a string representation of a Value.
PresentationException
- if the symbolic presentation cannot be parsed.protected boolean isOperator(java.lang.String string)
private int length()
public void add(java.lang.Object o) throws PresentationException
o
- the Presentation or String to be added.
PresentationException
- if o is not a Presentation or String.public void replace(int index, java.lang.Object o) throws PresentationException
PresentationException
public void refineStructure(java.lang.Object tokenStart, java.lang.Object tokenEnd) throws PresentationException
tokenStart
- the opening tokentokenEnd
- the closing token
// TODO Note that it cannot deal with nested delimiters of the same type.
That has to be fixed, obviously.
PresentationException
public void refineStructure(java.lang.Object token) throws PresentationException
token
- the token
PresentationException
public java.util.Iterator iterator()
private static Presentable GetPresentable(java.lang.Object component) throws PresentationException
PresentationException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |