473,698 Members | 2,602 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

arraylist shifting

tifoso
41 New Member
I searched here and only found somebody with a round-robin arraylist issue here but what they suggest I tried already and it doesn't work for me I hope somebody can shed some light

Scenario: I'm porting a PalmOS App written on C to .NET initially for a desktop and then to the CF, generic stuff is not biggie I have a section where
data comes in bursts and updates an array on a LIFO way, in C using a Memcopy gets this done in a few lines and pretty quickly

Requirement is to do this in vb.net 2003 and it seemed straightforward and an arraylist was chosen for speed appending data as it comes is cool and it works good, once the full-size is reached it came the time to do the LIFO and here I'n having issues.

I looped thru the array , shiftting a page of data shows good in the debugger
for i= start_idx to max-1
arraylist(i-start_idx) = arraylis(i)

the page at the end of array needs to be blanked out and the cell structure
have an element that needs a value set before receiving the packet
here is the issue I tried (simplifying the data structure)

cur_elt =CType(arraylis t(j), WackyType)
cur_elt.elt1=va lue
cur_elt.other_e lts =Nothing ' a few here
arraylist(j) = cur_elt

It works until I hit up to the last elt when it blanks the whole array om the
other_elts fields and my shifting is gone, I tried RemoveAt and Add with worst behaviour, any suggestions????

I had it with a regular ARRAY but used arraylist for the advertised performance boost. memcopy is not easily available in NET and the API gets funny so didn't go any deeper thinking that the Arraylist would do it.

Grazie in advance

Ciao
May 5 '07 #1
1 1465
tifoso
41 New Member
OK I also looked at the Queue and Stack but in this case accessing to elements in the middle e.g. elts starting at n thru n+mini_page positions seem to be available by the enumerator type but I'm not sure about the performance of those???

Any pointers here would be great. I still would like to get the Arraylist shifting as I can see it could useful somewhere else.

CIao
May 5 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
4402
by: David Stockwell | last post by:
Hi, My background is c/c++ and java. I'm learning python at this point. My question is does python share java's peculiar mode of bit shifting, or does python adhere closer to c's bit shifting? in java there are 3 kinds of bit shifts: << (shift left) >> (preserve the sign bit as we move right ) >>> (0 filled on the left as we move right)
9
8742
by: GGG | last post by:
Noticed something odd in the way bit shifting was working today. As far as I have ever heard, shifting will shift in zeros(signed ints aside) However I foudn something odd when I am shifting exactly the number of bits in a value... i.e. uint32_t x = 5;
7
14261
by: William Stacey [MVP] | last post by:
I can think of a couple ways to do this, but was wonder what the fastest way you can think of. Want to take any arraylist of > 1 element and make the first element the last, and all the rest of the elements will move up one position. This will be called a lot, so looking for speed. This just saving the index 0 as tmp and then enum the list to move up the elements, then put the tmp object in last pos is the best way? Cheers --...
2
2058
by: salsipius | last post by:
Can someone please help me clarify the below code. I think the shifting has to do with converting datatypes and/or loss of data but am not really clear on the details, could you help shed some light please? // Allocate array for( i = 0; i < Length; i++ ) { //pArray_00 is a BYTE Array -- Here a cast is used because
7
2091
by: Amit | last post by:
Hi everybody,I have 2 dropdowns and on selected index change the second dropdown is populated accordingly and so on.i am displaying the selected value in a label for the user so that he comes to know the hierarchy level. i will show you this with a example so that u can understand it well and help me out to come with a solution.the scenario is as below: Label: a>>a1 Dropdown1:a,b,c,d Dropdown2:suppose user clicks on (a) item in the...
10
10691
by: krunalb | last post by:
Hi, I am trying to shift unsigned long long value by 64 bits and this is what i get #include <stdio.h> int main() { unsigned short shiftby= 64;
20
2506
by: Charles Sullivan | last post by:
I understand different processor hardware may store the bits in a byte in different order. Does it make a difference in C insofar as bit-shifting unsigned char variables is concerned? E.g, if I have unsigned char x = 1; is it always true that (x << 1) == 2 (x << 2) == 4 etc?
8
2588
by: Guy | last post by:
Is there a better way to search identical elements in a sorted array list than the following: iIndex = Array.BinarySearch( m_Array, 0, m_Array.Count, aSearchedObject ); aFoundObject= m_Array; m_ResultArray.Add ( aFoundObject);
4
17686
by: tshad | last post by:
I have an ArrayList of thread pointers that I want delete from my list when the Thread in not alive and status is stopped. But I want to do it from the foreach loop I am looping through. threadList is the ArrayList. foreach (Thread theThread in threadList) { if ((!theThread.IsAlive) && (theThread.ThreadState.ToString == "Stopped")) sw.WriteLine(" Status for Thread: {0} is {1} IsAlive: {2}", theThread.Name,...
0
8680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.