Swaping
#8
Three-dimensional pages? But there's also object and subject.

If the four dimensions don't create a really big array, then it might be better to create an array of strings, first storing the (x,y,z) values in serialized form, and then the four dimensions in turn, also in serialized form. Then it becomes easier to sort by the (x,y,z) values. But then the author would have to decide if he/she wants to order by x, y or z.

For example:

Object(1, 2, 3, 4).x = 2
Object(1, 2, 3, 4).y = 3
Object(1, 2, 3, 4).z = 4

could be turned into this:

Code: (Select All)
004z002x003y001002003004
--- === --- ===---===---
|   |   |   |  |  |  |
|   |   |   |  |  |  fourth dimension (least significant)
|   |   |   |  |  |
|   |   |   |  |  third dimension
|   |   |   |  |
|   |   |   |  second dimension
|   |   |   |
|   |   |   first dimension (most significant)
|   |   |
|   |   y-field
|   |
|   x-field
|
z-field

as a string entry. Put the value first then the field's name to make it easier to sort numerically, and keep the field names in the same order throughout. (Actually the field names serve only for documentation.) Of course, if the value required is greater than 999 then add more zeroes to match the length. If negative values are also required then also add plus or minus sign. There could be other variations about ordering the string value, but this is only to sort the contents. Then how to put it back into the four-dimensional array...

I guess figure out the extents for each dimension and walk sequentially through the string array setting the values. (shrugs)

This example would require good string-parsing routines, instead of the mountains of "FOR... NEXT" and "IF... THEN... END IF" revealed in the code of the first post.

This is only for Objects() array. Now I notice SwapPages(), SwapSubjects(), SwapObjects() which would each need its own special treatment.
Reply


Messages In This Thread
Swaping - by CSslymer - 03-05-2023, 05:06 PM
RE: Swaping - by mnrvovrfc - 03-05-2023, 05:17 PM
RE: Swaping - by vince - 03-05-2023, 05:27 PM
RE: Swaping - by Petr - 03-05-2023, 05:27 PM
RE: Swaping - by Petr - 03-05-2023, 05:30 PM
RE: Swaping - by Petr - 03-05-2023, 05:55 PM
RE: Swaping - by bplus - 03-05-2023, 06:43 PM
RE: Swaping - by CSslymer - 03-06-2023, 05:11 AM
RE: Swaping - by mnrvovrfc - 03-05-2023, 07:52 PM
RE: Swaping - by vince - 03-06-2023, 08:14 AM
RE: Swaping - by bplus - 03-06-2023, 04:39 PM



Users browsing this thread: 6 Guest(s)