Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windowed FiFo Queue #3

Open
carlosdelfino opened this issue Mar 11, 2018 · 3 comments
Open

Windowed FiFo Queue #3

carlosdelfino opened this issue Mar 11, 2018 · 3 comments

Comments

@carlosdelfino
Copy link
Contributor

I started to write a FIFO queue that works with a window concept, ie it has all the features of the common FIFO, however I can delimit a content perception window.

Entering data they will enter the QUEUE and exit according to the limit of the size allowed for it, but whenever you query an item in index 0 for example will return the first item that the window allows. if item 5 is requested, the fifth intem of the window will be returned.

The other option I am analyzing is that I can have a DataView, or WindowView, object that would view this FIFO as if it were an independent FIFO but actions on it only occur in the perception window.

Below is an image that speaks more than all this explanation.
image
Credit: https://www.cse.iitk.ac.in/users/dheeraj/cs425/lec09.html

thanks.

@huan
Copy link
Owner

huan commented Mar 11, 2018

Are you supposing a new Queue like WindowedQueue for your use case?

I have just read the link you provided but it seems that's a scenario of a Server/Client network protocol.

Could you please provide your scenario that needs this kind of Queue, to make it clear for me?

I would like to add it if you could prove it's a useful common feature.

Thanks again for your feature request!

@carlosdelfino
Copy link
Contributor Author

Thanks @zixia

A scenario would be for example the reading of a sensor that constantly sends update of graph of lines that is maintained comparing periods of time, thus I can move the graph so as to only display the desired window of time, this hisencia of data would be in an array , the WindownedQueue or WindownedView would display only the desired window of the array.

Today I do this with two arrays one keeps all the history and another is getting and I'm replacing the old data with the new ones using the Array.splice function, but it's very slow, because if I'm not mistaken it recreates an array every time which is called.

And each array in my case has between 1000 and 2000 items.

https://gist.github.com/carlosdelfino/25f41a053eed2859fd1a8fba7ce84f63

See in the gist the callback function, there is a small part of the code that updates a NativeScript ObservableArray.

Another example could be a line chart that displays real-time stock market counts every hour and can be compared to other time windows for decision making, and both would be updated in a synchronized fashion.

Yet another use would be for example a Google Analytics chart.

@huan
Copy link
Owner

huan commented Mar 12, 2018

I did not fully understand your scenario but it seems not like a RxQueue problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants