org.rubato.math.yoneda
Class Form

java.lang.Object
  extended by org.rubato.math.yoneda.AbstractConnectableYoneda
      extended by org.rubato.math.yoneda.Form
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Form>, Connectable, Yoneda
Direct Known Subclasses:
ColimitForm, FormReference, LimitForm, ListForm, PowerForm, SimpleForm

public abstract class Form
extends AbstractConnectableYoneda
implements java.lang.Comparable<Form>

Abstract base class for forms.

Author:
Gérard Milmeister, Stefan Müller, Stefan Göller
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.rubato.math.yoneda.Yoneda
COLIMIT, LIMIT, LIST, POWER, SIMPLE
 
Method Summary
 Form _register(Repository repository, boolean builtin)
          Registers this form with the specified repository.
 java.lang.Object clone()
          Form object cannot be cloned.
 int compareTo(Form other)
          Compares two forms.
abstract  Denotator createDefaultDenotator()
          Returns a default denotator of this form.
abstract  Denotator createDefaultDenotator(Module address)
          Returns a default denotator of this form with the given address.
 void display()
          Print form to stdout.
 void display(java.io.PrintStream out)
          Print form to a stream.
 boolean equals(Form f)
          Returns true iff this form is equal to the specified form.
abstract  boolean equals(java.lang.Object object)
          Returns true iff this form is equal to the specified object.
 boolean fullEquals(Form f)
          Returns true iff this form is structurally equal to f.
 boolean fullEquals(Form f, java.util.IdentityHashMap<java.lang.Object,java.lang.Object> s)
          Returns true iff this form is structurally equal to f.
 java.util.LinkedList<Form> getDependencies()
          Returns a list of the forms that this form depends on.
 double getDimension()
          Returns the dimension of a form using default maximal depth.
 double getDimension(int maxDepth)
          Returns the dimension of a form.
abstract  Form getForm(int i)
          Returns a coordinate form.
abstract  int getFormCount()
          Returns the number of coordinate forms.
 java.util.List<Form> getForms()
          Returns a list of the coordinate forms.
 Morphism getIdentifier()
          Returns the identifier of the form.
 NameDenotator getName()
          Returns the name of the form as a denotator.
 java.lang.String getNameString()
          Returns the name of the form as a string.
abstract  int getType()
          Returns the type of the form.
 java.lang.String getTypeString()
          Returns the type of the form as a string.
 int hashCode()
          Returns a hash code for this form.
 boolean isRegistered()
          Returns true iff this form is already registered.
 boolean resolveReferences(RubatoDictionary dict)
          Resolves the references resulting from parsing.
 void setIdentifier(Morphism identifier)
          Sets the identifier of the form.
 void setName(NameDenotator name)
          Sets the name of the form as a denotator.
 void setName(java.lang.String name)
          Sets the name of the form as a denotator.
static int stringToType(java.lang.String s)
          Returns the space type as an integer.
abstract  java.lang.String toString()
          Returns a string representation of this form.
abstract  void toXML(XMLWriter writer)
           
static java.lang.String typeToString(int type)
          Returns the space type as a String.
 
Methods inherited from class org.rubato.math.yoneda.AbstractConnectableYoneda
getConnector, setConnector
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getName

public NameDenotator getName()
Returns the name of the form as a denotator.


getNameString

public java.lang.String getNameString()
Returns the name of the form as a string.


getType

public abstract int getType()
Returns the type of the form.


getTypeString

public java.lang.String getTypeString()
Returns the type of the form as a string.


getIdentifier

public Morphism getIdentifier()
Returns the identifier of the form.


setName

public void setName(NameDenotator name)
Sets the name of the form as a denotator.


setName

public void setName(java.lang.String name)
Sets the name of the form as a denotator.


setIdentifier

public void setIdentifier(Morphism identifier)
Sets the identifier of the form.


getDimension

public double getDimension()
Returns the dimension of a form using default maximal depth.


getDimension

public double getDimension(int maxDepth)
Returns the dimension of a form.


createDefaultDenotator

public abstract Denotator createDefaultDenotator()
Returns a default denotator of this form.


createDefaultDenotator

public abstract Denotator createDefaultDenotator(Module address)
Returns a default denotator of this form with the given address.


compareTo

public int compareTo(Form other)
Compares two forms. Comparison is done on the names of two forms.

Specified by:
compareTo in interface java.lang.Comparable<Form>

clone

public java.lang.Object clone()
Form object cannot be cloned.

Specified by:
clone in interface Yoneda
Specified by:
clone in class AbstractConnectableYoneda

equals

public abstract boolean equals(java.lang.Object object)
Returns true iff this form is equal to the specified object.

Overrides:
equals in class java.lang.Object

equals

public boolean equals(Form f)
Returns true iff this form is equal to the specified form.


fullEquals

public boolean fullEquals(Form f)
Returns true iff this form is structurally equal to f.


fullEquals

public boolean fullEquals(Form f,
                          java.util.IdentityHashMap<java.lang.Object,java.lang.Object> s)
Returns true iff this form is structurally equal to f.

Parameters:
f - the form to compare to
s - a map containing a history of already encountered forms, used to break recursion

getFormCount

public abstract int getFormCount()
Returns the number of coordinate forms.


getForm

public abstract Form getForm(int i)
Returns a coordinate form.

Parameters:
i - the coordinate position
Returns:
the form at coordinate position i

getForms

public java.util.List<Form> getForms()
Returns a list of the coordinate forms.


typeToString

public static final java.lang.String typeToString(int type)
Returns the space type as a String.


stringToType

public static final int stringToType(java.lang.String s)
Returns the space type as an integer.


toString

public abstract java.lang.String toString()
Returns a string representation of this form. This string is not parseable and does not contain all information. It is only meant for information purposes.

Overrides:
toString in class java.lang.Object

toXML

public abstract void toXML(XMLWriter writer)

display

public void display()
Print form to stdout.


display

public void display(java.io.PrintStream out)
Print form to a stream.

Parameters:
out - the stream to print to

getDependencies

public final java.util.LinkedList<Form> getDependencies()
Returns a list of the forms that this form depends on. A form always depends on itself.


hashCode

public int hashCode()
Returns a hash code for this form.

Overrides:
hashCode in class java.lang.Object

_register

public Form _register(Repository repository,
                      boolean builtin)
Registers this form with the specified repository. This is for internal use only. Forms must be registered by using the Repository.register(Form) method.


isRegistered

public boolean isRegistered()
Returns true iff this form is already registered.


resolveReferences

public boolean resolveReferences(RubatoDictionary dict)
Resolves the references resulting from parsing.

Returns:
true iff all references have been resolved.