Gramaticas
Class ArbolCYK

java.lang.Object
  extended by Gramaticas.ArbolCYK
All Implemented Interfaces:
LabelledTree, Tree

public class ArbolCYK
extends java.lang.Object
implements LabelledTree

Clase que implementa un nodo del arbol de analisis resultante del algoritmo de parsing CYK.

Author:
jvilares

Field Summary
private  java.util.ArrayList ramas
          Ramas que cuelgan del nodo (de izqda a drcha).
private  Simbolo simb
          Simbolo (terminal/no terminal) almacenado en el nodo.
 
Constructor Summary
ArbolCYK(Simbolo s, ArbolCYK ri, ArbolCYK rd)
          Constructor
 
Method Summary
 void dibujar(java.lang.String titulo)
          Dibuja en una ventana una representacion grafica del arbol de analisis
 Tree getChild(int i)
          Returns the i'th subtree of the tree's root.
 java.lang.String getLabel()
          Returns the tree's root's label.
 int numChildren()
          Returns the number of subtrees of the tree's root.
 java.lang.String toString()
          Devuelve una representacion parentizada del arbol en formato String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

simb

private Simbolo simb
Simbolo (terminal/no terminal) almacenado en el nodo.


ramas

private java.util.ArrayList ramas
Ramas que cuelgan del nodo (de izqda a drcha). En el caso de ser un nodo hoja estara inicializada pero vacia.

Constructor Detail

ArbolCYK

public ArbolCYK(Simbolo s,
                ArbolCYK ri,
                ArbolCYK rd)
Constructor

Parameters:
s - Simbolo (terminal/no terminal) almacenado en el nodo.
ri - Subarbol de la rama izqda. (recibe null si no hay, caso de los nodos hoja)
rd - Subarbol de la rama drcha. (recibe null si no hay, caso de los nodos hoja y las reglas No_terminal->Terminal)
Method Detail

numChildren

public int numChildren()
Description copied from interface: Tree
Returns the number of subtrees of the tree's root.

Specified by:
numChildren in interface Tree

getChild

public Tree getChild(int i)
Description copied from interface: Tree
Returns the i'th subtree of the tree's root.

Specified by:
getChild in interface Tree

getLabel

public java.lang.String getLabel()
Description copied from interface: LabelledTree
Returns the tree's root's label.

Specified by:
getLabel in interface LabelledTree

dibujar

public void dibujar(java.lang.String titulo)
Dibuja en una ventana una representacion grafica del arbol de analisis

Parameters:
titulo - Titulo de la ventana

toString

public java.lang.String toString()
Devuelve una representacion parentizada del arbol en formato String

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()