Craig Warnick wrote:box b > box c returns 1 whenever box c fits inside box box b. Note that c fits inside b if there is a way to arrange the dimensions of each box so
the corresponding dimensions of b are each larger than c.
No clue how to do that. Thanks for your earlier reply Saloon Keeper.
Well, first off, java.util.Comparator works on two objects, not three, so I'd start off by amending your class accordingly.
Second, as you said yourself:
Note that c fits inside b if there is a way to arrange the dimensions of each box so the corresponding dimensions of b are each larger than c.
So, in terms of a "fits inside" order, I would say that if Box a fits inside Box b, then
compare(a, b)
should return a negative number, and
compare(b, a)
should return a positive one; otherwise, your comparator should return 0 because the two objects have no 'order' with respect to each other in terms of "fitting in".
Then it's just a matter of calling the method for combinations of pairs for larger numbers of boxes.
[Edit] Note that while the above would work for providing a rudimentary "fits in" ordering, I suspect there's quite a bit more logic required to actually create a POS for these boxes. In terms of structure, I think I might look at an array of linked lists, but I suspect you're also going to need to come up with a heuristic to ensure that as many boxes are "fitted" as possible.
HIH
Winston