|
Orbital library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object orbital.logic.sign.concrete.Notation
public abstract class Notation
Represents notational variants of compositor applications. Defines the concrete syntax and thus the linearization of symbols.
Nested Class Summary | |
---|---|
static class |
Notation.NotationSpecification
Contains the specification of the default notation for a compositor. |
Field Summary | |
---|---|
static Notation |
AUTO
Specifies automatic compositor-dependant notation as registered. |
static Notation |
BESTFIX
Specifies best mixed notation "a*(b+f(c)) + d" inserting
brackets whenever necessary. |
static Notation |
DEFAULT
Specifies to use system default notation. |
static Notation |
FULLFIX
Specifies full-bracket mixed notation "(a*(b+f(c))) + d" . |
static Notation |
INFIX
Specifies infix notation "a f b" . |
static Notation |
POSTFIX
Specifies postfix notation "(a,b) f" . |
static Notation |
PREFIX
Specifies prefix notation "f(a,b)" . |
Constructor Summary | |
---|---|
protected |
Notation(java.lang.String name)
|
Method Summary | |
---|---|
int |
compareTo(java.lang.Object o)
Order imposed by ordinals according to the order of creation. |
boolean |
equals(java.lang.Object that)
Maintains the guarantee that all equal objects of the enumerated type are also identical. |
abstract java.lang.String |
format(java.lang.Object compositor,
java.lang.Object arg)
Format compositor with arguments in this notation. |
static Notation |
getDefault()
Get the notation used for the synonym DEFAULT. |
static Notation.NotationSpecification |
getNotation(java.lang.Object compositor)
Get the default notation specification registered for a compositor. |
int |
hashCode()
|
static Notation.NotationSpecification |
removeNotation(java.lang.Object f)
Remove any default notation specifications for a compositor. |
static void |
setAllNotations(java.lang.Object[][] compositorsAndNotations)
Sets/registers all notations contained in an array. |
static void |
setDefault(Notation notation)
Set which notation to use for DEFAULT. |
static boolean |
setNotation(java.lang.Object f,
Notation.NotationSpecification spec)
Sets/registers the default notation specification for a compositor. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Notation DEFAULT
Compositors with DEFAULT notation will use the current system default notation.
setDefault(Notation)
public static final Notation AUTO
Delegates to the registered notation
.
Compositors with registered default notation like +, -, *, /, ^ have a notation set.
All unknown symbols are treated as prefix.
PREFIX
,
INFIX
,
POSTFIX
public static final Notation PREFIX
"f(a,b)"
.
public static final Notation INFIX
"a f b"
.
n-ary this becomes "a f b f c"
.
Be aware that formatting a complex compound expression with simple infix only, might not result in a term with usual precedence, so brackets would be required.
BESTFIX
public static final Notation BESTFIX
"a*(b+f(c)) + d"
inserting
brackets whenever necessary. Decomposes compositors into
its components whenever possible building a function tree to
optimize formatting. This more sophisticated notation is aware
of the registered default notation
and will only insert brackets when necessary.
AUTO
public static final Notation FULLFIX
"(a*(b+f(c))) + d"
.
Delegates to the registered notation
.
Compositors with registered default notation like +, -, *, /, ^ have a notation set.
All unknown symbols are treated as prefix.
AUTO
,
BESTFIX
public static final Notation POSTFIX
"(a,b) f"
.
Constructor Detail |
---|
protected Notation(java.lang.String name)
Method Detail |
---|
public abstract java.lang.String format(java.lang.Object compositor, java.lang.Object arg)
compositor
- the compositor to apply, or the object describing the compositor to apply.arg
- the argument or array of arguments to apply the compositor on, or the array of
objects describing the corresponding arguments.
public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
public final boolean equals(java.lang.Object that)
equals
in class java.lang.Object
public final int hashCode()
hashCode
in class java.lang.Object
public static final Notation getDefault()
public static final void setDefault(Notation notation)
Call to specify system default notation behaviour.
notation
- which notation to use for the case of DEFAULT
notation.
java.lang.IllegalArgumentException
- if notation==DEFAULT
since this would result in an infinte recursion at runtime.public static Notation.NotationSpecification getNotation(java.lang.Object compositor)
null
if not set.setNotation(Object, NotationSpecification)
public static boolean setNotation(java.lang.Object f, Notation.NotationSpecification spec)
f
- the compositor whose notation specification to set.spec
- the notation specification to set as default for the compositor f.
true
if the default notation specification for the compositor f
changed as a result of the call.public static Notation.NotationSpecification removeNotation(java.lang.Object f)
f
- the compositor whose notation specification to remove.
null
if there was no mapping for compositor.public static final void setAllNotations(java.lang.Object[][] compositorsAndNotations)
compositorsAndNotations
- Contains compositors and their notation specifications.
Stored as an array of length-2 arrays
with compositors[i][0] being the Object
,
and compositor[i][1] being a Notation.NotationSpecification
.setNotation(Object,Notation.NotationSpecification)
|
Orbital library 1.3.0: 11 Apr 2009 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |