diff --git a/src/main/java/io/zipcoder/Music.java b/src/main/java/io/zipcoder/Music.java index 180c65c..4944de0 100644 --- a/src/main/java/io/zipcoder/Music.java +++ b/src/main/java/io/zipcoder/Music.java @@ -5,10 +5,83 @@ public class Music { private String[] playList; public Music(String[] playList){ + this.playList = playList; } - public Integer selection(Integer startIndex, String selection){ - return null; + public int MoveForward(int currentPosition) + { + int nextPosition = 0; + if (currentPosition != playList.length-1) + { + nextPosition = currentPosition+1; + } + else nextPosition = 0; + + return nextPosition; + + } + + public int MoveBackward(int currentPosition) + { + int nextPosition = 0; + if (currentPosition != 0) + { + nextPosition = currentPosition-1; + } + else nextPosition = playList.length-1; + + return nextPosition; + } + + public Integer selection(Integer startIndex, String selection) + { + Integer noClickForward = 0; + Integer noClickBackward = 0; + //forward + int currentIndex = startIndex; + int nextIndex = MoveForward(currentIndex); + for (int i=0; inoClickBackward) + { + return noClickBackward; + } + else { + return noClickForward; + } + } }