Advertisement
jsbsan

nodo para lista doblemente enlazada

Apr 18th, 2014
1,914
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GAMBAS 1.04 KB | None | 0 0
  1. ' Gambas class file
  2.  
  3. Private hdato As String
  4. Property dato As String
  5.  
  6. Private hsiguiente As Nodo
  7. Property siguiente As Nodo
  8.  
  9. Private hprevio As Nodo
  10. Property previo As Nodo
  11.  
  12. Public Sub _new(dat As String, Optional prox As Nodo)
  13.  
  14.   hdato = dat
  15.   hsiguiente = prox
  16.  
  17. End
  18.  
  19. Private Function dato_Read() As String  
  20.  
  21.   Return hdato    
  22.  
  23. End
  24.  
  25. Private Sub dato_Write(Value As String)
  26.  
  27.   hdato = Value  
  28.  
  29. End
  30.  
  31. Private Function siguiente_Read() As Nodo  
  32.  
  33.   Return hsiguiente  
  34.  
  35. End
  36.  
  37. Public Function VerLista() As String
  38.  
  39.   Dim frutas As String
  40.   Dim un_nodo As Nodo
  41.  
  42.   un_nodo = Me
  43.   While True
  44.     un_nodo = un_nodo.siguiente  
  45.     If IsNull(un_nodo) Then
  46.       Break
  47.     Endif
  48.    
  49.     frutas &= un_nodo.dato & "<br>"
  50.    
  51.   Wend        
  52.  
  53.   Return frutas
  54.  
  55. End
  56.  
  57. Private Sub siguiente_Write(Value As Nodo)
  58.  
  59.   hsiguiente = Value  
  60.  
  61. End
  62.  
  63. Private Function previo_Read() As Nodo
  64.  
  65.   Return hprevio
  66.  
  67. End
  68.  
  69. Private Sub previo_Write(Value As Nodo)
  70.  
  71.   hprevio = Value
  72.  
  73. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement