I need to order a list of custom object based on multiple criteria:
My object is like this:
public class MyJob {
private Date finish;
private int time;
private int param1;
private int param2;
private int param3;
private int size;
//...
}
What I need is to create an algorithm to sort an array of there jobs based on:
- A job cannot finish after the "finish" attribute
- Given a job at index
i
, job at positioni+1
must have one of these pattern:- The attribute
param1
need to be one more or less than theparam1
of the sibling job andparam2
andparam3
are equal - attribute
param2
need to be one more or less than theparam2
of the sibling job andparam1
and param3 are equal - attribute
param3
need to be one more or less than theparam3
of the sibling job andparam1
andparam2
are equal.
- The attribute
- After two days, algorithm can start with any kind of
param1
,param2
orparam3
. - If a job has a size more than a size given to the method, it has to be put at the end of the list.
- Optional, the algorithm can start from
param1
orparam2
orparam3
passed as arguments.
Can someone give me the right direction to implement these multiple sort algorithm?
I think about some kind of selection sort edited but I can't start.