Advertisement
jsbsan

switchStrategy

Jan 19th, 2014
1,621
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GAMBAS 0.60 KB | None | 0 0
  1. ' Gambas class file
  2.  
  3. Private listaEstrategia As New InterfaceCrearComando[]
  4.  
  5. Public Sub operar(orden As String, datos As String) As Comando
  6.  
  7.   Dim iCrearcomando As New InterfaceCrearComando
  8.  
  9.   For Each iCrearcomando In listaEstrategia
  10.    
  11.     If iCrearcomando.guard(orden) Then
  12.       Return iCrearcomando.crearComando(datos)
  13.     Endif
  14.    
  15.   Next
  16.   'si llega aqui es que no ha encontrado el comando
  17.   Message.Info(("Error: Comando desconocido") & " (" & orden & ")")
  18.   Return Null
  19.  
  20. End
  21.  
  22. Public Sub add(estrategia As InterfaceCrearComando)
  23.  
  24.   listaEstrategia.Add(estrategia)
  25.  
  26. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement