Orbital library

orbital.logic.sign.concrete
Class Notation.NotationSpecification

java.lang.Object
  extended by orbital.logic.sign.concrete.Notation.NotationSpecification
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable
Enclosing class:
Notation

public static class Notation.NotationSpecification
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable

Contains the specification of the default notation for a compositor.

Author:
André Platzer
See Also:
Serialized Form
Invariants:
precedence > 0 && associativity and notation match
Stereotype:
data-type

Constructor Summary
Notation.NotationSpecification(int arity)
          Create a very basic default notation specification of a compositor's notation.
Notation.NotationSpecification(int precedence, Notation notation, int arity)
          Create a specification of a compositor's notation.
Notation.NotationSpecification(int precedence, java.lang.String associativity)
          Create a specification of a compositor's notation with automatic notation resolution.
Notation.NotationSpecification(int precedence, java.lang.String associativity, Notation notation)
          Create a specification of a compositor's notation.
Notation.NotationSpecification(int precedence, java.lang.String associativity, Notation notation, int arity)
          Create a specification of a compositor's notation.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares for precedence.
 boolean equals(java.lang.Object o)
           
 java.lang.String getAssociativity()
          Get the associativity specification of the sign.
 Notation getNotation()
          Get the notation object to use for formatting.
 int getPrecedence()
          Get the precedence of the sign (with 1 being the highest precedence).
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Notation.NotationSpecification

public Notation.NotationSpecification(int precedence,
                                      java.lang.String associativity,
                                      Notation notation)
Create a specification of a compositor's notation.

See Also:
getAssociativity()

Notation.NotationSpecification

public Notation.NotationSpecification(int precedence,
                                      java.lang.String associativity,
                                      Notation notation,
                                      int arity)
Create a specification of a compositor's notation.

See Also:
getAssociativity()

Notation.NotationSpecification

public Notation.NotationSpecification(int precedence,
                                      Notation notation,
                                      int arity)
Create a specification of a compositor's notation.

See Also:
getAssociativity()

Notation.NotationSpecification

public Notation.NotationSpecification(int precedence,
                                      java.lang.String associativity)
Create a specification of a compositor's notation with automatic notation resolution.

This constructor will determine the notation object to use for formatting according to the associativity string which must be correct, then!

See Also:
getAssociativity()

Notation.NotationSpecification

public Notation.NotationSpecification(int arity)
Create a very basic default notation specification of a compositor's notation.

The default notation specification is non-associative system default notation of very strong precedence.

Method Detail

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Compares for precedence. Compositors that bind stronger have a stronger precedence (the lower value) and are ordered before weaker ones.

Specified by:
compareTo in interface java.lang.Comparable
Returns:
a negative value if this binds stronger than o (this<o), zero if binding precedence is identical, a positive value if this binds weaker than a (this>o).
Postconditions:
only semi-consistent with equals

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getPrecedence

public int getPrecedence()
Get the precedence of the sign (with 1 being the highest precedence).


getAssociativity

public java.lang.String getAssociativity()
Get the associativity specification of the sign. Associativity is one of
 xf, yf, xfx, xfy, yfx, yfy, fy, fx
 
(and alike for compositors of arbitrary arity). Where
Quick overview of associativty specification
specification effect
(unary) prefix notation
fx unary prefix notation non-associative, i.e., f (f a) needs brackets
fy unary prefix notation associative, i.e., f f a needs no brackets but is taken to mean f (f a)
(unary) postfix notation
xf unary postfix notation non-associative, i.e., (a f) f needs brackets
yf unary postfix notation associative, i.e., a f f needs no brackets but is taken to mean a (a f)
(binary) infix notation
yfx left associative, i.e., a f b f c is taken to mean (a f b) f c, while a f (b f c) needs brackets
xfy right associative, i.e., a f b f c is taken to mean a f (b f c), while (a f b) f c needs brackets
xfx non-associative, i.e., always use brackets
yfy full associative, i.e., never use brackets. a f b f c is taken to mean either (a f b) f c or a f (b f c), as both are equivalent.

The compositor position specification used must match the concept of notation objects.


getNotation

public Notation getNotation()
Get the notation object to use for formatting.


Orbital library
1.3.0: 11 Apr 2009

Copyright © 1996-2009 André Platzer
All Rights Reserved.