Initial commit

This commit is contained in:
2021-04-20 07:59:36 +02:00
commit fb0247c874
21969 changed files with 11640044 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
Public Class ErrorStopper
Private nb_events As Integer = 0
Private nb_seconds As Integer = 0
Private myStack As ArrayList
Public Function insert() As Boolean
Dim result As Boolean = True
'Neues Element rein
Dim new_el As New DateTime
new_el = Now()
myStack.Add(new_el)
'Alte löschen
Dim check_el As DateTime
Dim i As Integer = myStack.Count
Do While i > 0
check_el = myStack.Item(0)
If DateAdd(DateInterval.Second, nb_seconds, check_el) < Now() Then
myStack.RemoveAt(0)
End If
i = i - 1
Loop
'Check ob Menge überschritten
If myStack.Count >= nb_events Then result = False
Return result
End Function
Public Sub init(ByVal numberOfEvents As Integer, ByVal periodInSeconds As Integer)
Me.nb_events = numberOfEvents
Me.nb_seconds = periodInSeconds
Me.myStack = New ArrayList
End Sub
End Class