Search:

Type: Posts; User: Norm

Search: Search took 0.12 seconds.

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

    Finish the design work before starting any coding.
  2. Re: Ordering items but a bit more complex then just swapping items

    Another idea for a design:
    The original employee items are saved in a list.
    Each employee record has a list of its own that contains the employees that must follow.
    When a processAfter rule comes...
  3. Re: Ordering items but a bit more complex then just swapping items

    Continued at: https://coderanch.com/t/712871/java/Algorithm-java-complex-ordering#3338162
  4. Re: Ordering items but a bit more complex then just swapping items

    Is there a solution for that set of rules? I think it is possible to have a set of rules that is invalid.
    For a simple example:
    2 after 4
    4 after 2

    This is an algorithm problem, not a java...
  5. Re: Ordering items but a bit more complex then just swapping items

    Did you look at my suggestion on using the position of the employee record instead of the employee's id number?
    Given these ids: 8,3,6,2
    8 is at position 0
    3 " 1
    6 " 2
    2 " 3
    The rules...
  6. Re: Ordering items but a bit more complex then just swapping items

    Your original data was misleading because the ids were in order. The ordering of the rules is done based on the employee's position in the list, not the value of the id number.
  7. Re: Ordering items but a bit more complex then just swapping items

    Sometimes that happens.
  8. Re: Ordering items but a bit more complex then just swapping items

    Define a class to hold the rules and save objects of the class in a list that can be processed.
  9. Re: Ordering items but a bit more complex then just swapping items

    It was not a question. It was a step in solving the problem. Once all the processAfter rules have been received, the program will order them so that after they are applied the results will be a...
  10. Re: Ordering items but a bit more complex then just swapping items

    You didn't really give a when value for the questions.
    Let me try another way. Are these assumptions correct:
    All the employee information is given before any ordering of the employees is done. ...
  11. Re: Ordering items but a bit more complex then just swapping items

    Given those two processAfter received in that order, to get the correct order would require
    3 to be moved after 4: 4, 3
    and then
    1 to be moved after 4: 4, 1, 3

    Did you see my other questions?
  12. Re: Ordering items but a bit more complex then just swapping items

    Can more than one be processedAfter the same employee?
    For example:

    one.processAfterEmployee(four);
    three.processAfterEmployee(four);
    What would be the order of one and three?


    Are all...
  13. Re: Ordering items but a bit more complex then just swapping items

    A linked list would be ok.
    Also an ArrayList has methods that could be used to move elements in the list: remove and add

    What does: ID property that can adjust the order mean?
    How and when...
  14. Re: Ordering items but a bit more complex then just swapping items

    To control the order of the Strings returned by the toString methods used by the LinkedList's toString method, you will need to write your own method(s).

    The program puts objects in a list in a...
Results 1 to 14 of 14