Browse Source

ProjectStructure changed, CD and ExceptionClasses added.

feature-dev-projectStructureChanges
JPANZO 3 years ago
parent
commit
b2b4e34037
  1. 7
      Geraete.config
  2. 50
      src/main/java/device/CDPlayer.java
  3. 33
      src/main/java/device/cdPlayer/CD.java
  4. 79
      src/main/java/device/cdPlayer/CDPlayer.java
  5. 8
      src/main/java/device/cdPlayer/exceptions/CdFlapIsOpenException.java
  6. 8
      src/main/java/device/cdPlayer/exceptions/FormatNotSupportedException.java
  7. 8
      src/main/java/device/cdPlayer/exceptions/NoCDException.java
  8. 4
      src/main/java/device/radioPlayer/RadioPlayer.java
  9. 4
      src/main/java/device/usbPlayer/UsbPlayer.java
  10. 3
      src/test/java/device/cdPlayer/CDPlayerTest.java
  11. 4
      src/test/java/device/radioPlayer/RadioPlayerTest.java
  12. 2
      src/test/java/device/usbPlayer/UsbPlayerTest.java

7
Geraete.config

@ -1,3 +1,4 @@
CD=device.CdPlayer
Radio=device.RadioPlayer
USB=device.UsbPlayer
CD=device.cdPlayer.CdPlayer
Radio=device.radioPlayer.RadioPlayer
USB=device.usbPlayer.UsbPlayer

50
src/main/java/device/CDPlayer.java

@ -1,50 +0,0 @@
package device;
public class CDPlayer implements Device {
@Override
public void louder() {
}
@Override
public void quieter() {
}
@Override
public int getVolume() {
return 0;
}
@Override
public void next() {
}
@Override
public void prev() {
}
@Override
public String getInfoText() {
return null;
}
@Override
public String[] getOptions() {
return new String[0];
}
@Override
public String[] getItemList() {
return new String[0];
}
@Override
public String play() {
return null;
}
}

33
src/main/java/device/cdPlayer/CD.java

@ -0,0 +1,33 @@
package device.cdPlayer;
public class CD {
private String format;
private String[] playList;
public CD() {}
public CD(String format) {
this.format = format;
}
public CD(String format, String[] playList) {
this.format = format;
this.playList = playList;
}
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public String[] getPlayList() {
return playList;
}
public void setPlayList(String[] playList) {
this.playList = playList;
}
}

79
src/main/java/device/cdPlayer/CDPlayer.java

@ -0,0 +1,79 @@
package device.cdPlayer;
import device.Device;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class CDPlayer implements Device {
// 0-Leer; true-1
private int CdDriveContent=0;
private int CdFlap=0;
private int volume = 0;
private List<String> supportedFormats = new ArrayList<String>(Arrays.asList(new String[] {"Audio","MP3","WMA","AAC"}));
private String actualPlayTrack="";
private CD loadedCD;
private String[] cdAlbum=new String[]{};
@Override
public void louder() {
}
@Override
public void quieter() {
}
@Override
public int getVolume() {
return 0;
}
@Override
public void next() {
}
@Override
public void prev() {
}
@Override
public String getInfoText() {
return null;
}
@Override
public String[] getOptions() {
return new String[0];
}
@Override
public String[] getItemList() {
return new String[0];
}
@Override
public String play() {
return null;
}
//Getters und Setters
public void setCD(CD _loadedCD) {
loadedCD=_loadedCD;
this.setCdDriveContent();
this.actualPlayTrack=loadedCD.getPlayList()[0];
}
private void setCdDriveContent() {
CdDriveContent = 1;
}
}

8
src/main/java/device/cdPlayer/exceptions/CdFlapIsOpenException.java

@ -0,0 +1,8 @@
package device.cdPlayer.exceptions;
public class CdFlapIsOpenException extends RuntimeException{
//String message="Cd Flap must be closed.";
public CdFlapIsOpenException() {
super("Cd Flap must be closed.");
}
}

8
src/main/java/device/cdPlayer/exceptions/FormatNotSupportedException.java

@ -0,0 +1,8 @@
package device.cdPlayer.exceptions;
public class FormatNotSupportedException extends RuntimeException{
//String message="Cd-Format not supported.";
public FormatNotSupportedException() {
super("Cd-Format not supported.");
}
}

8
src/main/java/device/cdPlayer/exceptions/NoCDException.java

@ -0,0 +1,8 @@
package device.cdPlayer.exceptions;
public class NoCDException extends RuntimeException {
//String message="CD must be set.";
public NoCDException() {
super("CD must be set.");
}
}

4
src/main/java/device/RadioPlayer.java → src/main/java/device/radioPlayer/RadioPlayer.java

@ -1,4 +1,6 @@
package device;
package device.radioPlayer;
import device.Device;
import java.util.ArrayList;

4
src/main/java/device/UsbPlayer.java → src/main/java/device/usbPlayer/UsbPlayer.java

@ -1,4 +1,6 @@
package device;
package device.usbPlayer;
import device.Device;
public class UsbPlayer implements Device {

3
src/test/java/device/CDPlayerTest.java → src/test/java/device/cdPlayer/CDPlayerTest.java

@ -1,4 +1,4 @@
package device;
package device.cdPlayer;
import org.junit.jupiter.api.Test;
@ -43,4 +43,5 @@ class CDPlayerTest {
}
*/
}

4
src/test/java/device/RadioPlayerTest.java → src/test/java/device/radioPlayer/RadioPlayerTest.java

@ -1,5 +1,7 @@
package device;
package device.radioPlayer;
import device.radioPlayer.RadioPlayer;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
src/test/java/device/UsbPlayerTest.java → src/test/java/device/usbPlayer/UsbPlayerTest.java

@ -1,4 +1,4 @@
package device;
package device.usbPlayer;
import org.junit.jupiter.api.Test;
Loading…
Cancel
Save