rewrite ranks list

This commit is contained in:
okx-code
2020-06-24 21:37:58 +01:00
parent 1e7805e213
commit a4be05ffa8
33 changed files with 692 additions and 456 deletions
@@ -0,0 +1,31 @@
package sh.okx.rankup.ranks;
import lombok.Getter;
import java.util.Objects;
@Getter
public class RankElement<T extends Rank> {
private boolean rootNode = true;
private final T rank;
private RankElement<T> next;
public RankElement(T rank, RankElement<T> next) {
Objects.requireNonNull(rank);
this.rank = rank;
this.next = next;
}
public void setRootNode(boolean rootNode) {
this.rootNode = rootNode;
}
public boolean hasNext() {
return next != null;
}
public void setNext(RankElement<T> next) {
this.next = next;
this.next.setRootNode(false);
}
}