Skip to content

Commit

Permalink
Corrections after testing: small problem in the ExcludeCase because m…
Browse files Browse the repository at this point in the history
…issing lines in comparison with Include case
  • Loading branch information
FrancoisJRenaud committed Nov 12, 2016
1 parent 66e3bbb commit 8bf9d17
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions instat/ucrReceiver.vb
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,22 @@ Public Class ucrReceiver
Dim strTypes(strInclude.Count - 1) As String

Array.Copy(strInclude, strTypes, strInclude.Length)
'If the two previous lines where not added, the modification of value performed on strTypes was immediately performed on strInclude, then the argument passed into the function such as clsCurrGeom.clsAesParameters(i).strIncludedDataTypes in ucrGeomListWithAes.SetParameters would have been edited (i.e. quotes would have been added to the types names in the strIncludedDataTypes of the i'th AesParameter of the current Geom...), which we don't want !
For i = 0 To strInclude.Count - 1
strTypes(i) = Chr(34) & strInclude(i) & Chr(34)
Next
AddIncludedMetadataProperty("class", strTypes)
End Sub

Public Sub SetExcludedDataTypes(strExclude As String())
Dim strTypes(strExclude.Count - 1) As String

Array.Copy(strExclude, strTypes, strExclude.Length)
'If the two previous lines where not added, the modification of value performed on strTypes was immediately performed on strInclude, then the argument passed into the function such as clsCurrGeom.clsAesParameters(i).strExcludedDataTypes in ucrGeomListWithAes.SetParameters would have been edited (i.e. quotes would have been added to the types names in the strExcludedDataTypes of the i'th AesParameter of the current Geom...), which we don't want !
For i = 0 To strExclude.Count - 1
strExclude(i) = Chr(34) & strExclude(i) & Chr(34)
strTypes(i) = Chr(34) & strTypes(i) & Chr(34)
Next
AddExcludedMetadataProperty("class", strExclude)
AddExcludedMetadataProperty("class", strTypes)
End Sub

Public Sub AddIncludedMetadataProperty(strProperty As String, strInclude As String())
Expand Down Expand Up @@ -216,7 +221,13 @@ Public Class ucrReceiver
Dim iExcludeIndex As Integer

Dim kvpExcludeProperty As KeyValuePair(Of String, String())

If strProperty = "class" AndAlso strExclude.Contains(Chr(34) & "factor" & Chr(34)) Then
Array.Resize(strExclude, strExclude.Length + 1)
' WARNING: This is dependent on the way the metadata is displayed by the Instat object
' If this changes in Instat object, ordered factors will not be displayed
' TODO: Make this solid - should somehow use is.factor() in R
strExclude(strExclude.Length - 1) = Chr(34) & "ordered,factor" & Chr(34)
End If
kvpExcludeProperty = New KeyValuePair(Of String, String())(strProperty, strExclude)
iExcludeIndex = lstExcludedMetadataProperties.FindIndex(Function(x) x.Key = strProperty)
If iExcludeIndex <> -1 Then
Expand Down

0 comments on commit 8bf9d17

Please sign in to comment.