У меня есть этот класс
public class Operation {
private double value;
private boolean inc;
public Operation(double value, boolean inc) {
this.value = value;
this.inc = inc;
}
public double getValue() {
return value;
}
public void setValue(double value) {
this.value = value;
}
public boolean isInc() {
return inc;
}
public void setInc(boolean inc) {
this.inc = inc;
}
@Override
public String toString() {
return "Operation{" + "value=" + value + ", inc=" + inc + '}';
}
}
Теперь у меня есть этот список
public class TestOperation {
public static void main(String[] args) {
List<Operation> listOperation1 = new ArrayList<>();
listOperation1.add(new Operation(1.3, true));
listOperation1.add(new Operation(2.7, true));
listOperation1.add(new Operation(0.9, false));
listOperation1.add(new Operation(0.8, false));
//Generate posible Rotation listOperation1
//Operation(1.3, true), Operation(2.7, true), Operation(0.9, false), Operation(0.8, false)
//Operation(1.3, true), Operation(2.7, true), Operation(0.8, false), Operation(0.9, false)
//Operation(2.7, true), Operation(1.3, true), Operation(0.9, false), Operation(0.8, false)
//Operation(2.7, true), Operation(1.3, true), Operation(0.8, false), Operation(0.9, false)
List<Operation> listOperation2 = new ArrayList<>();
listOperation2.add(new Operation(1.5, true));
listOperation2.add(new Operation(2.9, true));
listOperation2.add(new Operation(4.6, true));
//Generate posible Rotation listOperation2
//Operation(1.5, true), Operation(2.9, true), Operation(4.6, true)
//Operation(1.5, true), Operation(4.6, true), Operation(2.9, true)
//Operation(2.9, true), Operation(4.6, true), Operation(1.5, true)
//Operation(2.9, true), Operation(1.5, true), Operation(4.6, true)
//Operation(4.6, true), Operation(2.9, true), Operation(1.5, true)
//Operation(4.6, true), Operation(1.5, true), Operation(2.9, true)
}
}
Вращение происходит только между inc = true
и inc = false
, не смешано!
Количество предметов inc = true
может отличаться от inc = false
. Даже некоторые могут не существовать.
Все отправленные элементы из списка должны быть обработаны, ни один не может быть пропущен, но не может быть повторен (как объект, не как значение).
Как создать это вращение?