Valhalla Legends Archive

Programming => General Programming => Topic started by: Fr0z3N on May 19, 2003, 09:22 AM

Title: Addin Query's
Post by: Fr0z3N on May 19, 2003, 09:22 AM
Does anyone have a simple AddQuery Code that I would be able to use?
Title: Re:Addin Query's
Post by: Tuberload on May 19, 2003, 10:53 AM
My suggestion would be to go look it up, try to figure out how it works, and then you will have learned something. After you have done all of that you will have an idea of what's going on and if you are still stuck you can elaborate with people on the subject, not just ask for free information.

BTW, this was not meant as a flame/insult/etc...
Title: Re:Addin Query's
Post by: TheMinistered on May 19, 2003, 07:55 PM
I assume you are referring to a Queue which is the exact opposite of a Stack.   Stack is LIFO (Last In First Out) and Queue is FIFO (First In First Out)

CQueue

Dim Queue As Collection

Public Sub Class_Initialize()
   Set Queue = new Collection
End Sub

Public Sub Enqueue(ByVal value As Variant)
   Queue .Add value
End Sub

Public Function Dequeue() As Variant
   Dequeue = Queue .Item(1)
   Queue .Remove 1
End Function

Public Function Peek() As Variant
   Peek = Queue .Item(1)
End Function

Public Function Count() As Long
   Count = Queue .Count
End Function

Public Sub Clear()
   Set Queue = New Collection
End Sub

Public Sub Class_Terminate()
   Set Queue = Nothing
End Sub

Enjoy!
Title: Re:Addin Query's
Post by: Fr0z3N on May 20, 2003, 07:45 PM
Ok I'll try that im in PEi right now ^.^