Valores.vb

  1. ' Valores.vb — ProInf.net — feb-2012
  2. '
  3. ' Cada una de las líneas de los archivos estadísticos "array_*.csv"
  4. ' Son los elementos de las clases Vectores
  5.  
  6. Public MustInherit Class ValorVector
  7. Public Property Texto As String
  8. Public Property Frecuencia As Integer = 0
  9. Public MustOverride Sub Analizar(ByVal linea As String)
  10. End Class
  11.  
  12. Public Class ValorProvincia
  13. Inherits ValorVector
  14. Public Property CodigoPostal As String
  15. Public Property PrefijoTelefonico As String
  16. Public Overrides Sub Analizar(ByVal linea As String)
  17. 'línea="Soria,42,975"
  18. Dim items = linea.Split(",")
  19. Texto = items(0)
  20. CodigoPostal = items(1)
  21. PrefijoTelefonico = items(2)
  22. End Sub
  23. End Class
  24.  
  25. Public Class ValorMunicipio
  26. Inherits ValorVector
  27. Public Property NumeroProvincia As Integer
  28. Public ReadOnly Property Provincia As String
  29. Get
  30. Return Recursos.provincias(NumeroProvincia).Texto
  31. End Get
  32. End Property
  33. Public Overrides Sub Analizar(ByVal linea As String)
  34. 'línea="197488,Pamplona,23"
  35. Dim items = linea.Split(",")
  36. Frecuencia = items(0)
  37. Texto = items(1)
  38. NumeroProvincia = items(2)
  39. End Sub
  40. End Class
  41.  
  42. Public Enum EnumSexo
  43. Mujer
  44. Hombre
  45. End Enum
  46.  
  47. Public Class ValorNombre
  48. Inherits ValorVector
  49. Public Property Sexo As EnumSexo
  50. Public Overrides Sub Analizar(ByVal linea As String)
  51. 'línea="776445,Antonio,1"
  52. Dim items = linea.Split(",")
  53. Frecuencia = items(0)
  54. Texto = items(1)
  55. Sexo = items(2)
  56. End Sub
  57. End Class
  58.  
  59. Public Class ValorApellido
  60. Inherits ValorVector
  61. Public Overrides Sub Analizar(ByVal linea As String)
  62. 'línea="1483939,García"
  63. Dim items = linea.Split(",")
  64. Frecuencia = items(0)
  65. Texto = items(1)
  66. End Sub
  67. End Class
  68.  
  69.  
  70. Public Class ValorPalabraComun
  71. Inherits ValorVector
  72. Public Overrides Sub Analizar(ByVal linea As String)
  73. 'línea="vamos,2378"
  74. Dim items = linea.Split(",")
  75. Texto = items(0)
  76. Frecuencia = items(1)
  77. End Sub
  78. End Class
  79.  
  80. Public Class ValorPalabra
  81. Inherits ValorVector
  82. Public Property Articulo As String
  83. Public Overrides Sub Analizar(ByVal linea As String)
  84. 'línea="Cosmos,El"
  85. Try
  86. Dim items = linea.Split(",")
  87. Texto = items(0)
  88. Articulo = items(1)
  89. Catch ex As Exception
  90. MsgBox("Error en ValorPalabra: " & linea)
  91. End Try
  92. End Sub
  93. End Class
  94.  
  95. Public Class ValorAdjetivo
  96. Inherits ValorVector
  97. Public Overrides Sub Analizar(ByVal linea As String)
  98. Texto = linea
  99. End Sub
  100. End Class
  101.  
  102. Public Class ValorCampoDefinido
  103. Inherits ValorVector
  104. Public Overrides Sub Analizar(ByVal linea As String)
  105. Texto = linea
  106. End Sub
  107. End Class

Proinf.net