Advertisement
jsbsan

formatoFactory

Dec 10th, 2013
1,239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GAMBAS 0.83 KB | None | 0 0
  1. ' Gambas class file
  2.  
  3. Private formatos As CreaLetra[]
  4. Private creados As Integer
  5.  
  6. Public Sub _new()
  7.  
  8.   formatos = New Formato[]
  9.   creados = 0
  10.  
  11. End
  12.  
  13.  
  14. Public Function getCreados() As Integer
  15.  
  16.   Return creados
  17.  
  18. End
  19.  
  20. Public Sub setCreados(c As Integer)
  21.  
  22.   creados = c
  23.  
  24. End
  25.  
  26. Public Function getFormato(tipo As String, tam As Integer) As CreaLetra
  27.   Dim tmp As CreaLetra
  28.   Dim i As Integer
  29.   tmp = New Formato(tipo, tam)
  30.  
  31.   If getcreados() > 0 Then
  32.     For i = 0 To creados - 1
  33.       If tmp.equals(formatos[i]) Then Return formatos[i]
  34.     Next
  35.   Endif
  36.   'nuevo formato detectado... se le añade a la lista de formatos
  37.   formatos.Add(tmp)
  38.   creados += 1
  39.   Return tmp
  40.  
  41. End
  42.  
  43. Public Sub listaFormatos()
  44.  
  45.   Dim a As Integer
  46.   For a = 0 To formatos.count - 1
  47.     formatos[a].Describe
  48.   Next
  49.  
  50. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement