Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. package one.vigo.top.services.uxzoom;
  2.  
  3. import it.unimi.dsi.fastutil.bytes.Byte2ObjectOpenHashMap;
  4. import one.vigo.top.services.uxzoom.data.model.cassandra.BufferingType;
  5.  
  6. public class BufferingSM {
  7.  
  8. public static enum State {
  9. NONE((byte) 0),
  10. WAITING((byte) 1),
  11. BUFFERING((byte) 2),
  12. ENDED((byte) 3);
  13.  
  14. private static final Byte2ObjectOpenHashMap<State> values;
  15. static {
  16. Byte2ObjectOpenHashMap<State> vs = new Byte2ObjectOpenHashMap<>();
  17. for(State bf : values()) {
  18. vs.put(bf.value, bf);
  19. }
  20. values = vs;
  21. }
  22.  
  23. private final byte value;
  24.  
  25. private State(byte value) {
  26. this.value = value;
  27. }
  28.  
  29. public byte getValue() {
  30. return value;
  31. }
  32.  
  33. public static State fromValue(byte value) {
  34. return values.get(value);
  35. }
  36. }
  37.  
  38. private BufferingType bufferingType;
  39. private State state;
  40. private PlayingSM.State playingState;
  41.  
  42. /*
  43. public BufferingSM(){
  44. this.state = State.NONE;
  45. }
  46. */
  47.  
  48. public void start(PlayingSM.State playingState, BufferingType bufferingType) {
  49. state = State.NONE;
  50. this.bufferingType = bufferingType;
  51. this.playingState = playingState;
  52. }
  53.  
  54. public void end(PlayingSM.State playingState) {
  55. state = State.ENDED;
  56. this.playingState = playingState;
  57. }
  58.  
  59. public void startBuffering(PlayingSM.State playingState) {
  60. state = State.BUFFERING;
  61. this.playingState = playingState;
  62. }
  63.  
  64. public void stopBuffering(PlayingSM.State playingState) {
  65. state = State.ENDED;
  66. this.playingState = playingState;
  67. }
  68.  
  69.  
  70. public BufferingType getBufferingType() {
  71. return bufferingType;
  72. }
  73.  
  74. public void setBufferingType(BufferingType bufferingType) {
  75. this.bufferingType = bufferingType;
  76. }
  77.  
  78. public State getState() {
  79. return state;
  80. }
  81.  
  82. public void setState(State state) {
  83. this.state = state;
  84. }
  85.  
  86. public PlayingSM.State getPlayingState() {
  87. return playingState;
  88. }
  89.  
  90. public void setPlayingState(PlayingSM.State playingState) {
  91. this.playingState = playingState;
  92. }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement