torero.model
Class Derivat

java.lang.Object
  |
  +--torero.model.Derivat

public class Derivat
extends Object

The Derivation is the most complex Class in the Torero Model - it represents derivations in grammars. Like the Production class its free of any redandancy. Changes in the underlying referenced Objects doesn't harm the Derivation (changes of the used Productions are possible). A Derivation has a so called usedProduction that refers to the Production to that the "appliedTo"-ListElement is expanded. Additionally a Derivation has Childrens that are also Derivation Objects. This Subderivations can have on of the RHS ListElements of the (Parents) usedProduction as their "appliedTo"-ListElements. Therefore Derivation Objects build tree structures that can represent complex Derivations in a certain Grammar.

See Also:
Production

Method Summary
 Production.ListElement getAppliedTo()
          Returns the ListElement for what this (Sub)Derivation is the expansion.
 Iterator getChildList()
          Returns an Iterator of (Sub)Derivations of this Derivation.
 int getChildSize()
          Returns the number of (Sub)Derivations this Derivation has.
 String getDerivedWord()
          Returns the word this derivation builds (currently under development).
 Production.ListElement getExpansionElement(int pos)
          This method returns the ListElement on a specific Position that can be expanded on this derivation level.
 Iterator getExpansionList()
          This method returns an Iteration of ListElements that can be expanded on this derivation level.
 int getExpansionPos(Production.ListElement expe)
          This method returns the Position of a specific ListElement that can be expanded on this derivation level.
 int getExpansionSize()
          This method returns the number of ListElements that can be expanded on this derivation level.
 Derivat getParent()
          Returns the Derivations this (Sub)Derivation extends (the Parent Derivation).
 Production getUsedProduction()
          Returns the Production used for the extension of the "AppliedTo"-ListElement at this derivation level.
static Derivat makeRoot(Production rootProduction)
          This static factory method is used to create a root for a Derivation tree.
 void mkSubDerivation(Production.ListElement applyTo, Production useProduction)
          This method is used to make a new (Sub)Derivation on this derivation level.
 String toDot(boolean withattribs)
          Returns the Dot Graph Representation of this Derivation.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

makeRoot

public static Derivat makeRoot(Production rootProduction)
This static factory method is used to create a root for a Derivation tree.
Parameters:
rootProduction - takes the Production that should be used as the first Production that can have expanded RHS ListElements.

getExpansionList

public Iterator getExpansionList()
This method returns an Iteration of ListElements that can be expanded on this derivation level.
Returns:
returns an Iteration of ListElements that can be expanded on this derivation level

getExpansionSize

public int getExpansionSize()
This method returns the number of ListElements that can be expanded on this derivation level.
Returns:
returns the number of ListElements that can be expanded on this derivation level

getExpansionElement

public Production.ListElement getExpansionElement(int pos)
This method returns the ListElement on a specific Position that can be expanded on this derivation level.
Returns:
returns the ListElement on a specific Position that can be expanded on this derivation level

getExpansionPos

public int getExpansionPos(Production.ListElement expe)
This method returns the Position of a specific ListElement that can be expanded on this derivation level.
Returns:
returns the Position of a specific ListElement that can be expanded on this derivation level

mkSubDerivation

public void mkSubDerivation(Production.ListElement applyTo,
                            Production useProduction)
This method is used to make a new (Sub)Derivation on this derivation level.
Parameters:
applyTo - takes a ListElement from the RHS ListElement's that should be expanded
useProduction - takes the Production to which the given "applyTo"-ListElement should be expanded

getAppliedTo

public Production.ListElement getAppliedTo()
Returns the ListElement for what this (Sub)Derivation is the expansion.
Returns:
returns the ListElement for what this (Sub)Derivation is the expansion.

getChildList

public Iterator getChildList()
Returns an Iterator of (Sub)Derivations of this Derivation.
Returns:
returns an Iterator of (Sub)Derivations of this Derivation

getChildSize

public int getChildSize()
Returns the number of (Sub)Derivations this Derivation has.
Returns:
returns the nuber of (Sub)Derivations this Derivation has

getParent

public Derivat getParent()
Returns the Derivations this (Sub)Derivation extends (the Parent Derivation).
Returns:
returns the Derivations this (Sub)Derivation extends (the Parent Derivation). If called on the root Derivation null is returned.

getUsedProduction

public Production getUsedProduction()
Returns the Production used for the extension of the "AppliedTo"-ListElement at this derivation level.
Returns:
returns the Production used for the extension of the "AppliedTo"-ListElement at this derivation level

toString

public String toString()
Overrides:
toString in class Object

getDerivedWord

public String getDerivedWord()
Returns the word this derivation builds (currently under development).
Returns:
returns the word this derivation builds (currently under development)

toDot

public String toDot(boolean withattribs)
Returns the Dot Graph Representation of this Derivation.
Returns:
returns the Dot Graph Representation of this Derivation