generated from hummel/Bank-System
Struktur geändert
parent
dbb7419f1e
commit
d42c1ef95e
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="src" path="Bank-Beispiel/src"/>
|
||||
<classpathentry kind="src" path="Roboter"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -0,0 +1,20 @@
|
|||
package tpe.exceptions;
|
||||
import java.util.*;
|
||||
import java.lang.Thread;
|
||||
@SuppressWarnings("serial")
|
||||
public class RobotException extends Exception {
|
||||
|
||||
public class MagicValueException extends Throwable {
|
||||
throw new Exception("Die Zahl 42 kann nicht verarbeitet werden");
|
||||
}
|
||||
|
||||
public RobotException(String string) {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public RobotException MagicValueException() throws {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package tpe.exceptions;
|
||||
|
||||
public class RobotIllegalStateException {
|
||||
public boolean illegalState(boolean powerSwitch) {
|
||||
if(powerSwitch=false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package tpe.exceptions.roboter;
|
||||
|
||||
import tpe.exceptions.roboter.exceptions.RobotException;
|
||||
import tpe.exceptions.RobotException;
|
||||
|
||||
public class C3PO implements Robot{
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package tpe.exceptions.roboter;
|
||||
|
||||
import tpe.exceptions.roboter.exceptions.RobotException;
|
||||
import tpe.exceptions.RobotException;
|
||||
|
||||
public class Nexus6 implements RobotControl, RobotInstructions {
|
||||
private static int id=19281982;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package tpe.exceptions.roboter;
|
||||
|
||||
import java.util.*;
|
||||
import tpe.exceptions.roboter.exceptions.RobotException;
|
||||
|
||||
import tpe.exceptions.RobotException;
|
||||
|
||||
public class R2D2 implements Robot {
|
||||
RobotException robotexception;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package tpe.exceptions.roboter;
|
||||
|
||||
import tpe.exceptions.roboter.exceptions.RobotException;
|
||||
import tpe.exceptions.RobotException;
|
||||
|
||||
/**
|
||||
* Das Interface repräsentiert einen einfachen Roboter mit seinen Funktionen.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package tpe.exceptions.roboter;
|
||||
|
||||
import tpe.exceptions.roboter.exceptions.RobotException;
|
||||
import tpe.exceptions.roboter.exceptions.RobotIllegalStateException;
|
||||
import tpe.exceptions.roboter.exceptions.RobotMagicValueException;
|
||||
import tpe.exceptions.RobotException;
|
||||
import tpe.exceptions.RobotIllegalStateException;
|
||||
import tpe.exceptions.RobotMagicValueException;
|
||||
|
||||
/**
|
||||
* Das Interface repräsentiert den Befehlssatz eines einfachen Roboters.
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
package tpe.exceptions.roboter.exceptions;
|
||||
|
||||
public class RobotException {
|
||||
|
||||
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package tpe.exceptions.roboter.exceptions;
|
||||
|
||||
public class RobotIllegalStateException {
|
||||
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package tpe.exceptions.roboter.exceptions;
|
||||
|
||||
|
||||
public class RobotMagicValueException {
|
||||
|
||||
public boolean invalidNumber(int[] zahlen) {
|
||||
|
||||
boolean error=false;
|
||||
for(int i =0; i<zahlen.length;i++)
|
||||
{
|
||||
if(zahlen[i]==42)
|
||||
error=true ;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package tpe.exceptions.roboter.ui;
|
||||
|
||||
public class UI {
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package tpe.exceptions.roboter.facade;
|
||||
package tpe.facade;
|
||||
|
||||
import tpe.exceptions.roboter.C3PO;
|
||||
import tpe.exceptions.roboter.R2D2;
|
||||
|
@ -6,6 +6,11 @@ import tpe.exceptions.roboter.R2D2;
|
|||
public class RobotFactory {
|
||||
private R2D2 r2d2;
|
||||
private C3PO c3po;
|
||||
enum RobotType{
|
||||
R2D2,
|
||||
C3PO,
|
||||
NEXUS6
|
||||
}
|
||||
public int constructRobot() {
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package tpe.infrastructure;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
public class Persistenz {
|
||||
private static final String Robot_DATEI = "-robot-data.ser";
|
||||
|
||||
public static boolean checkDataSaved(String name) {
|
||||
return new File(name + Robot_DATEI).exists();
|
||||
}
|
||||
|
||||
public static boolean deleteRobotData(String name) throws FileNotFoundException, IOException
|
||||
{
|
||||
File file = new File("C:\\Users\\Lukas Berens\\git\\RoboterFabrik\\"+name+"-robot-data.ser");
|
||||
return file.delete();
|
||||
}
|
||||
|
||||
public static void saveRobotData(Object robot, String name) throws Exception {
|
||||
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(name + Robot_DATEI));
|
||||
oos.writeObject(robot);
|
||||
oos.close();
|
||||
}
|
||||
|
||||
public static Object loadRobotData(String name) throws Exception {
|
||||
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(name + Robot_DATEI));
|
||||
Object robot = ois.readObject();
|
||||
ois.close();
|
||||
|
||||
return robot;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package tpe.ui;
|
||||
|
||||
public class UI {
|
||||
|
||||
}
|
Loading…
Reference in New Issue