Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package one.vigo.top.services.uxzoom;
- import it.unimi.dsi.fastutil.bytes.Byte2ObjectOpenHashMap;
- import one.vigo.top.services.uxzoom.data.model.cassandra.BufferingType;
- public class BufferingSM {
- public static enum State {
- NONE((byte) 0),
- WAITING((byte) 1),
- BUFFERING((byte) 2),
- ENDED((byte) 3);
- private static final Byte2ObjectOpenHashMap<State> values;
- static {
- Byte2ObjectOpenHashMap<State> vs = new Byte2ObjectOpenHashMap<>();
- for(State bf : values()) {
- vs.put(bf.value, bf);
- }
- values = vs;
- }
- private final byte value;
- private State(byte value) {
- this.value = value;
- }
- public byte getValue() {
- return value;
- }
- public static State fromValue(byte value) {
- return values.get(value);
- }
- }
- private BufferingType bufferingType;
- private State state;
- private PlayingSM.State playingState;
- /*
- public BufferingSM(){
- this.state = State.NONE;
- }
- */
- public void start(PlayingSM.State playingState, BufferingType bufferingType) {
- state = State.NONE;
- this.bufferingType = bufferingType;
- this.playingState = playingState;
- }
- public void end(PlayingSM.State playingState) {
- state = State.ENDED;
- this.playingState = playingState;
- }
- public void startBuffering(PlayingSM.State playingState) {
- state = State.BUFFERING;
- this.playingState = playingState;
- }
- public void stopBuffering(PlayingSM.State playingState) {
- state = State.ENDED;
- this.playingState = playingState;
- }
- public BufferingType getBufferingType() {
- return bufferingType;
- }
- public void setBufferingType(BufferingType bufferingType) {
- this.bufferingType = bufferingType;
- }
- public State getState() {
- return state;
- }
- public void setState(State state) {
- this.state = state;
- }
- public PlayingSM.State getPlayingState() {
- return playingState;
- }
- public void setPlayingState(PlayingSM.State playingState) {
- this.playingState = playingState;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement