Search:

Type: Posts; User: alfa86

Search: Search took 0.07 seconds.

  1. Re: Ordering items but a bit more complex then just swapping items

    Thanks for the idea Norm, this sounds very interesting. Kinda like a linked node setup. I just need to think about how to start coding this. I've asked for help on the other forum too.
  2. Re: Ordering items but a bit more complex then just swapping items

    The solution for my example is 6,8,3,2

    This is an algorithm problem, i have posted on coderanch.
  3. Re: Ordering items but a bit more complex then just swapping items

    Norm, yes I understand the position of the record needs to be used as opposed to the employee value. Given this example;

    // 8,3,6,2
    // rules in no particular order
    // rule1: move 8 after...
  4. Re: Ordering items but a bit more complex then just swapping items

    I think I've just done a full round and back to square one.

    I can't seem to think of a way to sort a list of rules the way that would give me the output.

    if I iterate around the rules, i can...
  5. Re: Ordering items but a bit more complex then just swapping items

    it was too simple.

    the original list can be of any order, e.g 8,3,6,2 so ordering descending on the "after" value wont really work. Think I am stuck on the design of this.
  6. Re: Ordering items but a bit more complex then just swapping items

    Logically though, is it enough to look at the run after value and sort that descending simply?

    for e.g if we take the following rules (note that I have created a very simplistic rule class for...
  7. Re: Ordering items but a bit more complex then just swapping items

    You're right, I've been playing around with this in my head. The rules can be sorted to achieve the final output order.

    If the rules are set like this initially:
    ...
  8. Re: Ordering items but a bit more complex then just swapping items

    Hey Norm, apologies for the lack of clarity - answers below



    --- Update ---

    I thought I would have a crack at coding it, but you see my problem.
  9. Re: Ordering items but a bit more complex then just swapping items

    Agree that for all processAfter's that have the same target, processing them in "last in first out" order makes sense.

    On your other questions:
    when do you get the list of employees <-- they...
  10. Re: Ordering items but a bit more complex then just swapping items

    Assumption is that if we have the above scenario where two processAfter occur on the same target, then the first call to the target should take precedence

    one.processAfterEmployeeId(four); would...
  11. Re: Ordering items but a bit more complex then just swapping items

    Hi Nord - yes you're right about the comments.

    In terms of your comment:

    "That implies the that the order of the calls to the processAfter method needs to be ordered.
    For this example: move...
  12. Re: Ordering items but a bit more complex then just swapping items

    The initial order comes from an external source that I have no control over. The order is initially defined by that system. This process is a bespoke way to customly adjust the order of the list.
    ...
  13. Ordering items but a bit more complex then just swapping items

    Hi guys, I am needed some help with a snippet to order a list properly. I have actually turned my use case into a simple employee class for the sake of explaining my issue to everyone.

    In the...
  14. Thread: Hey

    by alfa86
    Replies
    0
    Views
    765

    Hey

    Hey guys,

    I am new to this forum. I work as a embedded developer on an energy and risk management system. We use Java, but we are limited to the API that the software provides so learning the core...
Results 1 to 14 of 14