Skip to content

Commit

Permalink
Merge branch 'RegularSequence' of https://github.com/Sananka/Instat.git
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Sananka authored and Alex Sananka committed Apr 19, 2017
2 parents 289e370 + 9b847a3 commit fb006c3
Show file tree
Hide file tree
Showing 90 changed files with 5,232 additions and 2,525 deletions.
12 changes: 7 additions & 5 deletions instat/UcrPanel.vb
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,19 @@ Public Class UcrPanel
AddRadioButtonRange({rdoTemp})
If strValue <> "" Then
dctRadioButtonValues.Add(rdoTemp, strValue)
AddParameterValuesCondition(rdoTemp, clsParameter.strArgumentName, strValue)
AddParameterValuesCondition(rdoTemp, GetParameter().strArgumentName, strValue)
End If
End Sub

Public Sub RadioButtons_CheckedChanged()
OnControlValueChanged()
End Sub

Protected Overrides Sub UpdateParameter(clsTempParam As RParameter)
Dim strNewValue As String = ""
Dim rdoTemp As RadioButton

If bChangeParameterValue AndAlso clsParameter IsNot Nothing Then
If bChangeParameterValue AndAlso clsTempParam IsNot Nothing Then
For Each ctrTemp As Control In pnlRadios.Controls
If TypeOf ctrTemp Is RadioButton Then
rdoTemp = CType(ctrTemp, RadioButton)
Expand All @@ -64,13 +68,11 @@ Public Class UcrPanel
End If
Next
If strNewValue <> "" Then
clsParameter.SetArgumentValue(strNewValue)
clsTempParam.SetArgumentValue(strNewValue)
Else
MsgBox("Developer error: No parameter value is associated to the currently checked radio button. Cannot update parameter.")
End If
End If
UpdateRCode()
OnControlValueChanged()
End Sub

Protected Overrides Sub SetToValue(objTemp As Object)
Expand Down
10 changes: 9 additions & 1 deletion instat/clsRFunction.vb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Public Class RFunction
Inherits RCodeStructure

Public strRCommand As String
Private strPackageName As String = ""

Public Sub New()
OnParametersChanged()
Expand All @@ -28,14 +29,21 @@ Public Class RFunction
bIsAssigned = False
End Sub

Public Sub SetPackageName(strName As String)
strPackageName = strName
End Sub

Public Overrides Function ToScript(Optional ByRef strScript As String = "", Optional strTemp As String = "") As String
'Converting the RFunction into a string that when run in R gives the appropriate output
Dim i As Integer
'For method with OrderedIndices, replace clsParameters.count by Mybase.OrderedIndices.count and i by Mybase.OrderedIndices(i)

'Parameters are sorted in the appropriate order and then the script is built.
SortParameters()
strTemp = strRCommand & "("
If strPackageName <> "" Then
strTemp = strPackageName & "::"
End If
strTemp = strTemp & strRCommand & "("
For i = 0 To clsParameters.Count - 1
If i > 0 Then
strTemp = strTemp & ", "
Expand Down
3 changes: 3 additions & 0 deletions instat/clsRLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,9 @@ Public Class RLink
ucrCurrentReceiver.Clear()
For i = 0 To vecColumns.Count - 1
chrCurrColumns = vecColumns(i).AsCharacter
If chrCurrColumns Is Nothing Then
Continue For
End If
For Each strColumn As String In chrCurrColumns
lstItems.Add(New KeyValuePair(Of String, String)(strDataFrameName, strColumn))
Next
Expand Down
11 changes: 11 additions & 0 deletions instat/clsRSyntax.vb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ Public Class RSyntax
bUseCommandString = False
End Sub

Public Sub SetPackageName(strName As String)
If clsBaseFunction Is Nothing Then
MsgBox("Developer error: base function must be set before package name is set.")
Else
clsBaseFunction.SetPackageName(strName)
bUseBaseFunction = True
bUseBaseOperator = False
bUseCommandString = False
End If
End Sub

Public Sub SetBaseRFunction(clsFunction As RFunction)
clsBaseFunction = clsFunction
bUseBaseFunction = True
Expand Down
41 changes: 21 additions & 20 deletions instat/dlgAppend.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 14 additions & 19 deletions instat/dlgAppend.vb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
'
' You should have received a copy of the GNU General Public License k
' along with this program. If not, see <http://www.gnu.org/licenses/>.
Imports instat

Imports instat.Translations
Public Class dlgAppend
Public bFirstLoad As Boolean = True
Private bFirstLoad As Boolean = True
Private bReset As Boolean = True
Private clsBindRows As New RFunction

Expand All @@ -38,18 +38,12 @@ Public Class dlgAppend

' ucrReceiver
ucrReceiverAppendDataframe.SetParameter(New RParameter("x", 0))
ucrReceiverAppendDataframe.GetParameter().bIncludeArgumentName = False
ucrReceiverAppendDataframe.SetParameterIsRFunction()
ucrReceiverAppendDataframe.GetParameter().bIncludeArgumentName = False
ucrReceiverAppendDataframe.Selector = ucrSelectorDataframes
ucrReceiverAppendDataframe.SetMeAsReceiver()
ucrReceiverAppendDataframe.SetItemType("dataframe")

' ucrSave
ucrSaveGraph.SetIsTextBox()
ucrSaveGraph.SetSaveTypeAsDataFrame()
ucrSaveGraph.SetLabelText("New Data Frame Name:")


'chkID
SetParameter({ucrChkIncludeIDColumn, ucrInputIDColName}, New RParameter(".id", 1))
ucrChkIncludeIDColumn.SetText("Include ID Column")
Expand All @@ -58,31 +52,32 @@ Public Class dlgAppend
ucrInputIDColName.bAddRemoveParameter = False
ucrInputIDColName.SetLinkedDisplayControl(lblIDColName)


' ucrSave
ucrSaveGraph.SetIsTextBox()
ucrSaveGraph.SetSaveTypeAsDataFrame()
ucrSaveGraph.SetLabelText("New Data Frame Name:")
ucrSaveGraph.SetPrefix("Append")
End Sub

Private Sub SetDefaults()
Dim clsDefaultBindRows As New RFunction
clsBindRows = New RFunction

ucrSelectorDataframes.Reset()
ucrSaveGraph.Reset()

clsDefaultBindRows.SetRCommand("bind_rows")
clsDefaultBindRows.AddParameter(".id", Chr(34) & "id" & Chr(34))
clsDefaultBindRows.SetAssignTo(strTemp:="Append", strTempDataframe:="Append")
clsBindRows.SetRCommand("bind_rows")
clsBindRows.AddParameter(".id", Chr(34) & "id" & Chr(34))
clsBindRows.SetAssignTo(ucrSaveGraph.GetText(), strTempDataframe:=ucrSaveGraph.GetText())

clsBindRows = clsDefaultBindRows.Clone()
ucrBase.clsRsyntax.SetBaseRFunction(clsBindRows)

TestOKEnabled()
End Sub

Private Sub SetRCodeForControls(bReset As Boolean)
SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset)
End Sub

Private Sub TestOKEnabled()
If Not ucrReceiverAppendDataframe.IsEmpty AndAlso ucrSaveGraph.IsComplete() Then
If ucrReceiverAppendDataframe.lstSelectedVariables.Items.Count > 1 AndAlso ucrSaveGraph.IsComplete() Then
If ucrChkIncludeIDColumn.Checked AndAlso ucrInputIDColName.IsEmpty Then
ucrBase.OKEnabled(False)
Else
Expand All @@ -99,10 +94,10 @@ Public Class dlgAppend
Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset
SetDefaults()
SetRCodeForControls(True)
TestOKEnabled()
End Sub

Private Sub ucrReceiverAppendDataframe_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverAppendDataframe.ControlContentsChanged, ucrSaveGraph.ControlContentsChanged, ucrChkIncludeIDColumn.ControlContentsChanged, ucrInputIDColName.ControlContentsChanged
TestOKEnabled()
End Sub

End Class
5 changes: 2 additions & 3 deletions instat/dlgBoxPlot.vb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ Public Class dlgBoxplot
clsRgeom_boxplotFunction.ClearParameters()
ucrSelectorBoxPlot.Reset()
ucrSelectorBoxPlot.Focus()
ucrVariablesAsFactorForBoxplot.ResetControl()
ucrSaveBoxplot.strPrefix = "Boxplot"
chkHorizontalBoxplot.Checked = False
chkVarwidth.Checked = False
Expand Down Expand Up @@ -83,8 +82,8 @@ Public Class dlgBoxplot
sdgPlots.SetGgplotFunction(clsRggplotFunction)

ucrVariablesAsFactorForBoxplot.SetFactorReceiver(ucrByFactorsReceiver)
ucrVariablesAsFactorForBoxplot.SetSelector(ucrSelectorBoxPlot)
ucrVariablesAsFactorForBoxplot.SetIncludedDataType({"numeric"})
ucrVariablesAsFactorForBoxplot.Selector = ucrSelectorBoxPlot
ucrVariablesAsFactorForBoxplot.SetIncludedDataTypes({"numeric"})


ucrSaveBoxplot.SetDataFrameSelector(ucrSelectorBoxPlot.ucrAvailableDataFrames)
Expand Down
5 changes: 2 additions & 3 deletions instat/dlgCumulativeDistribution.vb
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ Public Class dlgCumulativeDistribution


ucrVariablesAsFactorforCumDist.SetFactorReceiver(ucrFactorReceiver)
ucrVariablesAsFactorforCumDist.SetSelector(ucrCumDistSelector)
ucrVariablesAsFactorforCumDist.SetIncludedDataType({"numeric"})
ucrVariablesAsFactorforCumDist.Selector = ucrCumDistSelector
ucrVariablesAsFactorforCumDist.SetIncludedDataTypes({"numeric"})


ucrSaveCumDist.SetDataFrameSelector(ucrCumDistSelector.ucrAvailableDataFrames)
Expand All @@ -62,7 +62,6 @@ Public Class dlgCumulativeDistribution
ucrSaveCumDist.strPrefix = "Graph"
ucrCumDistSelector.Reset()
ucrCumDistSelector.Focus()
ucrVariablesAsFactorforCumDist.ResetControl()
chkCountsOnYAxis.Checked = False
chkExceedancePlots.Checked = True
chkIncludePoints.Checked = False
Expand Down
Loading

0 comments on commit fb006c3

Please sign in to comment.