I have a mapping program that maps versioned language-codes from one version to another. The program maps the codes correctly with one caveat, working with combination codes. I have parsed the mapping files and have gotten far enough as to structure arrays with the options per node and calculate the number of possibilities given the data.
Consider the following data:
CodeA translates to: Array(1,1) = "CodeB|CodeC|CodeD|"
Array(1,2) = "CodeE|"
Array(1,3) = "CodeF|CodeG|"
What this means is that CodeA translates to (CodeB or CodeC or CodeD) with codeE with (CodeF or CodeG)
The code first calculates the # of possibilites (above has 6) then dims an array to fit the resulted strings. I need the stored strings to be all combinations of the mapping, i.e.:
CodeB with CodeE with CodeF
CodeB with CodeE with CodeG
CodeC with CodeE with CodeF
CodeC with CodeE with CodeG
CodeD with CodeE with CodeF
CodeD with CodeE with CodeG
The code needs to work with all different sizes of arrays with multiple mappings. The above example is simple, but it can get more complicated, like this:
CodeA translates to: Array(1,1) = "CodeB|CodeC|CodeD|"
Array(1,2) = "CodeE|"
Array(1,3) = "CodeF|CodeG|"
Array(2,1) = "CodeH|"
Array(2,2) = "CodeI|CodeJ|"
Array(2,3) = "CodeK|CodeL|CodeM|CodeN|"
Array(2,4) = "CodeO|"
Array(3,1) = "CodeQ|"
Array(3,2) = "CodeR|CodeS|"
Which means CodeA translates to: ((CodeB or CodeC or CodeD) with CodeE with (CodeF or CodeG)) or (CodeH with (CodeI or CodeJ) with (CodeK or CodeL or CodeM or CodeN) with CodeO) or (CodeQ with (CodeR or CodeS)) --- 96 combinations
The program will already know the max first subscript, so the code would look something like:
for i = 1 to maxSubOne
GET_COMBINATIONS(Array(i))
next i
Any suggestions?
occ = occ * (Len(myArray(i, i2)) - Len(Replace(myArray(i, i2), "|", "")))(accounting for 0 elsewhere)