Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim finalList As ListView
End Sub
Sub Activity_Create(FirstTime As Boolean)
finalList.Initialize ("")
Activity.AddView (finalList,0,0,100%x,100%y)
' Here we can start serial-read the file instead of the following testing list
Dim a As List
a.Initialize
a.AddAll (Array As String _
("AWORD","BWORD","AWORD","CWORD","MINAS","DWORD","MINA","NIKOS","BWORD","AWORD","MINAS","MINAS","AWORD","BWORD","OMEGA"))
Dim ar(26,27,27) As String
' instead of this loop we can loop until eof
For k=0 To a.Size -1
' s would be the read string
Dim s As String
s=a.Get(k)
If s.Length =1 Then
s=s & Chr(64) & Chr(64)
Else If s.Length =2 Then
s=s & Chr(64)
End If
Dim tempA As String
tempA=ar(Asc(s.CharAt (0))-65,Asc(s.CharAt(1))-64,Asc(s.CharAt (2))-64)
Dim tempI As Int
tempI=tempA.IndexOf (s & ",")
If tempI=-1 Then
tempA=tempA & s & ",1" & TAB
Else
Dim tempC As Int
Dim tempI2 As Int
Dim tempI3 As Int
Dim tempD As String
tempI2=tempA.IndexOf2 (",",tempI+1)
tempI3=tempA.IndexOf2 (TAB,tempI2+1)
tempC=tempA.SubString2(tempI2+1,tempI3)
tempC=tempC+1
tempD=tempA.SubString2(0,s.Length+1) & tempC & TAB
If tempI3+1<tempA.Length Then
tempD=tempD & tempA.SubString (tempI3+1)
End If
tempA=tempD
End If
ar(Asc(s.CharAt (0))-65,Asc(s.CharAt(1))-64,Asc(s.CharAt (2))-64)=tempA
Next
' here we would close the loop
For o1=0 To 25
For o2=0 To 26
For o3=0 To 26
If ar(o1,o2,o3).Length >0 Then
Dim tempObj() As String
tempObj=Regex.Split (TAB,ar(o1,o2,o3))
For omega=0 To tempObj.Length -1
finalList.AddSingleLine (tempObj(omega))
Next
End If
Next
Next
Next
End Sub