Click here to Skip to main content
15,903,201 members
Home / Discussions / C#
   

C#

 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 20:53
sitebuilderLuc Pattyn6-Jan-07 20:53 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp6-Jan-07 21:04
Captain See Sharp6-Jan-07 21:04 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn7-Jan-07 7:20
sitebuilderLuc Pattyn7-Jan-07 7:20 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp7-Jan-07 7:25
Captain See Sharp7-Jan-07 7:25 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp7-Jan-07 7:34
Captain See Sharp7-Jan-07 7:34 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn7-Jan-07 7:43
sitebuilderLuc Pattyn7-Jan-07 7:43 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp7-Jan-07 7:59
Captain See Sharp7-Jan-07 7:59 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn7-Jan-07 8:51
sitebuilderLuc Pattyn7-Jan-07 8:51 
I am now looking at Data.cs in HDPC1.0 and HDPC2.0 in parallel.

Switching _selected and _changed from <int> collections to <range> collections is
definitely a big step in the right direction.

I am sure working with ranges EVRYWHERE will really speed things up.

To facilitate thiseven more, I would suggest to introduce a new class RangeCollection,
which somehow holds any number of non-overlapping ranges (maybe ordered, maybe not,
thats up to your judgement). The class would offer methods such as:
- Clear()
- AddRange(start, length) or (Range)
- RemoveRange(start, length) or (Range)
- GetEnumerator()

There would be no restrictions on AddRange; you must choose some details:
- when adjacent to an existing range, merge or not ? (may even cause a double merge)
- when overlapping, ignore the overlap or throw Exception ?

There would be no restrictions on RemoveRange (it may modify more than one of the
internally held ranges). You must choose the spec when it contains items not currently
represented in the range list (probably an Exception).

The Enumerator would return a collection of ranges that are logically equal to
what was added/removed before, without having to be identical...

In this way, the rest of your app can easily be range oriented, and the RangeCollection
class is not that difficult to create either.

If handled in this way, you may not need an "indexesArray to rangesArray" conversion at all,
or if you do (e.g. for API compatibility), its performance might be of lesser importance.

One final remark: your current Data class is not really thread-safe, and
the RangeCollection class would not be either, so it is not obvious for either of them
how to switch to a multi-threading approach (assuming you would still be
considering that at all; I dont expect it will come to that).

Regards,








Luc Pattyn

GeneralRe: I cant seem to think today. Pin
Captain See Sharp7-Jan-07 9:29
Captain See Sharp7-Jan-07 9:29 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn7-Jan-07 9:48
sitebuilderLuc Pattyn7-Jan-07 9:48 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 19:11
sitebuilderLuc Pattyn6-Jan-07 19:11 
QuestionHow to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
new_era886-Jan-07 14:08
new_era886-Jan-07 14:08 
AnswerRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
Captain See Sharp6-Jan-07 17:05
Captain See Sharp6-Jan-07 17:05 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
Luc Pattyn6-Jan-07 18:25
sitebuilderLuc Pattyn6-Jan-07 18:25 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
new_era887-Jan-07 7:07
new_era887-Jan-07 7:07 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
Captain See Sharp7-Jan-07 7:29
Captain See Sharp7-Jan-07 7:29 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
new_era887-Jan-07 8:16
new_era887-Jan-07 8:16 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
Captain See Sharp7-Jan-07 8:25
Captain See Sharp7-Jan-07 8:25 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
new_era887-Jan-07 8:51
new_era887-Jan-07 8:51 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
WillemM7-Jan-07 7:34
WillemM7-Jan-07 7:34 
GeneralRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
Luc Pattyn7-Jan-07 8:00
sitebuilderLuc Pattyn7-Jan-07 8:00 
QuestionHelp needed converting string hash values into binary... Pin
rvp717y6-Jan-07 12:45
rvp717y6-Jan-07 12:45 
AnswerRe: Help needed converting string hash values into binary... Pin
Guffa6-Jan-07 13:45
Guffa6-Jan-07 13:45 
GeneralRe: Help needed converting string hash values into binary... Pin
rvp717y6-Jan-07 14:59
rvp717y6-Jan-07 14:59 
GeneralRe: Help needed converting string hash values into binary... Pin
Luc Pattyn6-Jan-07 18:39
sitebuilderLuc Pattyn6-Jan-07 18:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.