|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.symcomp.openmath.OpenMathBase
public abstract class OpenMathBase
Base class of all OpenMath Objects OpenMathBase and its subclasses are used to store OpenMath expressions. They offer a 1:1-correspondence to the XML-Tree. A tree of OpenMath-Objects can either be constructed programmatically by calling the constructors and stacking the resulting objects together, or by parsing an xml-string. Note that there are no classes for representing attributions and bound variables, the functionality is integrated into all classes and OMBind respectively.
| Nested Class Summary | |
|---|---|
static class |
OpenMathBase.ENCODINGS
constants |
| Field Summary | |
|---|---|
protected java.util.Map<java.lang.String,OpenMathBase[]> |
attributions
an assoziative array that contains the OMATTR attributes of the node |
protected java.lang.String |
cdbase
the cdbase of the node, if set |
protected java.lang.String |
id
the id of the node, if set |
| Constructor Summary | |
|---|---|
OpenMathBase()
|
|
| Method Summary | |
|---|---|
OpenMathBase |
$plus(OpenMathBase that)
used to override operators for use from Scala |
org.symcomp.openmath.OMApply |
apply(OpenMathBase... params)
Creates an application where this is head and params are the params |
org.symcomp.openmath.OMBind |
bind(org.symcomp.openmath.OMVariable[] bvars,
OpenMathBase param)
Creates a binding where this is head and params are the params |
OpenMathBase |
deOMObject()
Removes the OMObject wrapping if present, otherwise return the unmodified object. |
abstract boolean |
equals(java.lang.Object that)
Decide whether two nodes are identical. |
org.symcomp.openmath.OMError |
error(OpenMathBase[] params)
Creates an application where this is head and params are the params |
OpenMathBase |
getAt(OpenMathBase key)
Get an OMATTR attribute. |
java.util.Map<java.lang.String,OpenMathBase[]> |
getAttributions()
Get the attributions. |
java.lang.String |
getCdbase()
Get the value of the xml-attribute cdbase |
java.lang.String |
getId()
Get the value of the xml-attribute id |
boolean |
isApplication()
Check whether this is an OMA |
boolean |
isApplication(org.symcomp.openmath.OMSymbol oms)
Check whether this is an application of oms |
boolean |
isApplication(java.lang.String cd,
java.lang.String name)
Check whether this is an application of |
boolean |
isAttributed()
Find out whether the Object is attributed |
boolean |
isBinary()
Check whether this is an OMB |
boolean |
isBinding()
Check whether this is an OMBIND |
boolean |
isBinding(org.symcomp.openmath.OMSymbol oms)
Check whether this is a binding of oms |
boolean |
isBinding(java.lang.String cd,
java.lang.String name)
Check whether this is a binding of |
boolean |
isError()
Check whether this is an OME |
boolean |
isError(org.symcomp.openmath.OMSymbol oms)
Check whether this is an application of oms |
boolean |
isError(java.lang.String cd,
java.lang.String name)
Check whether this is an application of |
boolean |
isFloat()
Check whether this is an OMF |
boolean |
isFloat(double f)
Check whether this is an OMF and has value f |
boolean |
isForeign()
Check whether this is an OMFOREIGN |
boolean |
isInteger()
Check whether this is an OMI |
boolean |
isInteger(java.math.BigInteger i)
Check whether this is an OMI with value i |
boolean |
isInteger(java.lang.Integer i)
Check whether this is an OMI with value i |
boolean |
isObject()
Check whether this is an OMOBJ |
boolean |
isReference()
Check whether this is an OMR |
boolean |
isReference(java.lang.String href)
Check whether this is an OMR whith given href |
boolean |
isString()
Check whether this is an OMSTR |
boolean |
isString(java.lang.String s)
Check whether this is an OMSTR with given value |
boolean |
isSymbol()
Check whether this is an OMS |
boolean |
isSymbol(java.lang.String cd,
java.lang.String name)
Check whether this is an OMS with given cd and name |
boolean |
isVariable()
Check whether this is an OMV |
boolean |
isVariable(java.lang.String name)
Check whether this is an OMV of the given name |
static OpenMathBase |
parse(java.io.Reader r)
Parse the content from the given Reader to an OpenMathBase tree The encoding is guessed by the first byte (using sniffEncoding) |
static OpenMathBase |
parse(java.lang.String text)
Parse the given OpenMath string to an OpenMathBase tree. |
static OpenMathBase |
parseBinary(java.io.Reader r)
Parse the given OpenMath binary encoded string to an OpenMathBase tree |
static OpenMathBase |
parseBinary(java.lang.String s)
Parse the given OpenMath binary encoded string to an OpenMathBase tree |
static OpenMathBase |
parsePopcorn(java.io.InputStream istream)
Parse a string containing POPCORN code to an OpenMath tree. |
static OpenMathBase |
parsePopcorn(java.io.Reader r)
Parse a string containing POPCORN code to an OpenMath tree. |
static OpenMathBase |
parsePopcorn(java.lang.String popcode)
Parse a string containing POPCORN code to an OpenMath tree. |
static OpenMathBase |
parseXml(java.io.Reader r)
Parse the given OpenMath XML encoded string to an OpenMathBase tree |
static OpenMathBase |
parseXml(java.lang.String s)
Parse the given OpenMath XML encoded string to an OpenMathBase tree |
void |
putAt(OpenMathBase key,
OpenMathBase val)
Set an OMATTR attribute. |
protected boolean |
sameAttributes(OpenMathBase that)
Decide whether two nodes have the same OMATTR attributes, necessary for equality testing |
void |
setAttributions(java.util.Map<java.lang.String,OpenMathBase[]> attributions)
Set the attributions. |
void |
setCdbase(java.lang.String cdbase)
Set the value for the xml-attribute cdbase |
void |
setId(java.lang.String id)
Set the value for the xml-attribute id |
static java.lang.Object[] |
sniffEncoding(java.io.Reader r)
Guesses the encoding of the OpenMath object in the given Reader by the first byte. |
char[] |
toBinary()
Render whole tree to the binary representation |
void |
toBinary(java.io.Writer out)
Render whole tree to the binary representation |
java.lang.String |
toBinaryAsString()
Render whole tree to the binary representation. |
java.lang.String |
toLatex()
Convert the given OpenMath tree to a string containing a LaTeX representation. |
void |
toLatex(java.io.Writer out)
Convert the given OpenMath tree to a string containing a LaTeX representation. |
org.symcomp.openmath.OMObject |
toOMObject()
Wraps the OpenMathBase object in an OMOBject is it is not already an OMOBject |
java.lang.String |
toPopcorn()
Convert the given OpenMath tree to a string containing a POPCORN representation. |
void |
toPopcorn(java.io.Writer out)
Convert the given OpenMath tree to a string containing a POPCORN representation. |
java.lang.String |
toXml()
Render whole tree to an XML-string w/o namespace w/o dereferencing |
void |
toXml(java.io.Writer out)
Render whole tree to an XML-string w/o namespace w/o dereferencing |
OpenMathBase |
traverse(OpenMathVisitor visitor)
Traverse the Object-tree with the visitor. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String id
protected java.lang.String cdbase
protected java.util.Map<java.lang.String,OpenMathBase[]> attributions
| Constructor Detail |
|---|
public OpenMathBase()
| Method Detail |
|---|
public java.lang.String getId()
public void setId(java.lang.String id)
id - The new id.public java.lang.String getCdbase()
public void setCdbase(java.lang.String cdbase)
cdbase - The new cdbase.public java.util.Map<java.lang.String,OpenMathBase[]> getAttributions()
public void setAttributions(java.util.Map<java.lang.String,OpenMathBase[]> attributions)
attributions - The new attributions.
public void putAt(OpenMathBase key,
OpenMathBase val)
key - the OMATTR keyval - the OMATTR valuepublic OpenMathBase getAt(OpenMathBase key)
key - the key for which to fetch a value
public boolean isAttributed()
public abstract boolean equals(java.lang.Object that)
equals in class java.lang.Objectpublic org.symcomp.openmath.OMApply apply(OpenMathBase... params)
params - the parameters
public org.symcomp.openmath.OMError error(OpenMathBase[] params)
params - the parameters
public org.symcomp.openmath.OMBind bind(org.symcomp.openmath.OMVariable[] bvars,
OpenMathBase param)
bvars - the variables to bindparam - the expression to bind
public boolean isApplication()
public boolean isApplication(org.symcomp.openmath.OMSymbol oms)
oms - the possible head
public boolean isApplication(java.lang.String cd,
java.lang.String name)
cd - the cd of the OMSname - the name of the OMS
public boolean isBinary()
public boolean isBinding()
public boolean isBinding(org.symcomp.openmath.OMSymbol oms)
oms - the possible head
public boolean isBinding(java.lang.String cd,
java.lang.String name)
cd - the cd of the OMSname - the name of the OMS
public boolean isError()
public boolean isError(org.symcomp.openmath.OMSymbol oms)
oms - the possible head
public boolean isError(java.lang.String cd,
java.lang.String name)
cd - the cd of the OMSname - the name of the OMS
public boolean isFloat()
public boolean isFloat(double f)
f - the value to compare
public boolean isForeign()
public boolean isInteger()
public boolean isInteger(java.math.BigInteger i)
i - the value to compare
public boolean isInteger(java.lang.Integer i)
i - the value to compare
public boolean isObject()
public org.symcomp.openmath.OMObject toOMObject()
public OpenMathBase deOMObject()
public boolean isReference()
public boolean isReference(java.lang.String href)
href - the value to compare
public boolean isString()
public boolean isString(java.lang.String s)
s - the String to compare to
public boolean isSymbol()
public boolean isSymbol(java.lang.String cd,
java.lang.String name)
cd - the cd to checkname - the name to check
public boolean isVariable()
public boolean isVariable(java.lang.String name)
name - the name to check
protected boolean sameAttributes(OpenMathBase that)
that - the OpenMathBase Object to test against
public OpenMathBase traverse(OpenMathVisitor visitor)
visitor -
public static java.lang.Object[] sniffEncoding(java.io.Reader r)
throws OpenMathException
r - a reader that delivers an OpenMath stream
OpenMathException - if something went wrong
public static OpenMathBase parse(java.io.Reader r)
throws OpenMathException
r - a reader that delivers an OpenMath stream
OpenMathException - if something went wrong
public static OpenMathBase parse(java.lang.String text)
throws OpenMathException
text - an OpenMath XML encoded string
OpenMathException - if something went wrong
public static OpenMathBase parseXml(java.io.Reader r)
throws OpenMathException
r - a Reader that delivers an OpenMath XML encoded string
OpenMathException - if something went wrong
public static OpenMathBase parseXml(java.lang.String s)
throws OpenMathException
s - an OpenMath XML encoded string
OpenMathException - if something went wrong
public static OpenMathBase parseBinary(java.io.Reader r)
throws OpenMathException
r - a Reader that delivers an OpenMath binary encoded string
OpenMathException - if something went wrong
public static OpenMathBase parseBinary(java.lang.String s)
throws OpenMathException
s - an OpenMath binary encoded string
OpenMathException - if something went wrong
public static OpenMathBase parsePopcorn(java.io.Reader r)
throws OpenMathException
r - a Reader delivering a POPCORN string
OpenMathException - if sth went wrong ;)
public static OpenMathBase parsePopcorn(java.lang.String popcode)
throws OpenMathException
popcode - a POPCORN string
OpenMathException - if sth went wrong ;)
public static OpenMathBase parsePopcorn(java.io.InputStream istream)
throws OpenMathException
istream - a stream delivering a POPCORN string
OpenMathException - if sth went wrong ;)public java.lang.String toXml()
public void toXml(java.io.Writer out)
throws OpenMathException
out - the writer to which to write
OpenMathException - if something goes wrongpublic char[] toBinary()
public java.lang.String toBinaryAsString()
public void toBinary(java.io.Writer out)
throws OpenMathException
out - the writer to which to write
OpenMathException - if something goes wrongpublic java.lang.String toPopcorn()
public void toPopcorn(java.io.Writer out)
throws OpenMathException
out - a writer to deliver the POPCODE
OpenMathException - if something goes wrongpublic java.lang.String toLatex()
public void toLatex(java.io.Writer out)
throws OpenMathException
out - a Writer for the LaTeX representation
java.lang.Exception - if something goes wrong
OpenMathExceptionpublic OpenMathBase $plus(OpenMathBase that)
that -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||