From a399f9321b71d1055a28acc5feb194b69a35dbea Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 22 Apr 2022 11:42:39 +0200 Subject: [PATCH] created simple classes Issue #5 --- .gitignore | 6 +++ .../zhaw/projekt2/turnierverwaltung/Game.java | 47 +++++++++++++++++++ .../projekt2/turnierverwaltung/Location.java | 17 +++++++ .../turnierverwaltung/Participant.java | 6 +++ .../projekt2/turnierverwaltung/Person.java | 37 +++++++++++++++ .../projekt2/turnierverwaltung/Player.java | 10 ++++ .../zhaw/projekt2/turnierverwaltung/Team.java | 37 +++++++++++++++ .../turnierverwaltung/Tournament.java | 17 +++++++ 8 files changed, 177 insertions(+) create mode 100644 app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Game.java create mode 100644 app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Location.java create mode 100644 app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Participant.java create mode 100644 app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Person.java create mode 100644 app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Player.java create mode 100644 app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Team.java create mode 100644 app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Tournament.java diff --git a/.gitignore b/.gitignore index a1c2a23..47af25b 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,9 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* + +# Ignore Gradle project-specific cache directory +.gradle + +# Ignore Gradle build output directory +build diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Game.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Game.java new file mode 100644 index 0000000..e04b84d --- /dev/null +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Game.java @@ -0,0 +1,47 @@ +package ch.zhaw.projekt2.turnierverwaltung; + +public class Game { + private int participant1, Participant2; + private int points1, points2; + private Location location; + + public Location getLocation() { + return location; + } + + public void setLocation(Location location) { + this.location = location; + } + + public int getPoints1() { + return points1; + } + + public void setPoints1(int points1) { + this.points1 = points1; + } + + public int getPoints2() { + return points2; + } + + public void setPoints2(int points2) { + this.points2 = points2; + } + + public int getParticipant1() { + return participant1; + } + + public void setParticipant1(int participant1) { + this.participant1 = participant1; + } + + public int getParticipant2() { + return Participant2; + } + + public void setParticipant2(int participant2) { + Participant2 = participant2; + } +} diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Location.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Location.java new file mode 100644 index 0000000..448ae67 --- /dev/null +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Location.java @@ -0,0 +1,17 @@ +package ch.zhaw.projekt2.turnierverwaltung; + +public class Location { + private String name; + + public Location(String name){ + setName(name); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Participant.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Participant.java new file mode 100644 index 0000000..e48f3a1 --- /dev/null +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Participant.java @@ -0,0 +1,6 @@ +package ch.zhaw.projekt2.turnierverwaltung; + +public interface Participant { + String getName(); + void setName(String name); +} diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Person.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Person.java new file mode 100644 index 0000000..1165e7d --- /dev/null +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Person.java @@ -0,0 +1,37 @@ +package ch.zhaw.projekt2.turnierverwaltung; + +public class Person { + private String name; + private String firstName; + private String phoneNumber; + + public Person(String firstName, String name, String phoneNumber){ + setFirstName(firstName); + setName(name); + setPhoneNumber(phoneNumber); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } +} diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Player.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Player.java new file mode 100644 index 0000000..567f49b --- /dev/null +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Player.java @@ -0,0 +1,10 @@ +package ch.zhaw.projekt2.turnierverwaltung; + +public class Player extends Person{ + + + public Player(String firstName, String name, String phoneNumber){ + super(firstName, name, phoneNumber); + } + +} diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Team.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Team.java new file mode 100644 index 0000000..880cc13 --- /dev/null +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Team.java @@ -0,0 +1,37 @@ +package ch.zhaw.projekt2.turnierverwaltung; + +import java.util.ArrayList; +import java.util.List; + +public class Team implements Participant { + private String name; + private List players; + private Person contactPerson; + + public Team(String name){ + setName(name); + players = new ArrayList<>(); + } + + public void addPlayer(Player player){ + players.add(player); + } + + @Override + public String getName() { + return name; + } + + @Override + public void setName(String name) { + this.name = name; + } + + public Person getContactPerson() { + return contactPerson; + } + + public void setContactPerson(Person contactPerson) { + this.contactPerson = contactPerson; + } +} diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Tournament.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Tournament.java new file mode 100644 index 0000000..c6d6211 --- /dev/null +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Tournament.java @@ -0,0 +1,17 @@ +package ch.zhaw.projekt2.turnierverwaltung; + +public abstract class Tournament { + private String name; + + public Tournament(String name){ + setName(name); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +}