diff --git a/MyFirstUniverseFinal/.idea/description.html b/MyFirstUniverseFinal/.idea/description.html new file mode 100644 index 0000000..db5f129 --- /dev/null +++ b/MyFirstUniverseFinal/.idea/description.html @@ -0,0 +1 @@ +Simple Java application that includes a class with main() method \ No newline at end of file diff --git a/MyFirstUniverseFinal/.idea/discord.xml b/MyFirstUniverseFinal/.idea/discord.xml new file mode 100644 index 0000000..2a6a89a --- /dev/null +++ b/MyFirstUniverseFinal/.idea/discord.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/MyFirstUniverseFinal/.idea/encodings.xml b/MyFirstUniverseFinal/.idea/encodings.xml new file mode 100644 index 0000000..ab2dc53 --- /dev/null +++ b/MyFirstUniverseFinal/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MyFirstUniverseFinal/.idea/inspectionProfiles/Project_Default.xml b/MyFirstUniverseFinal/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..759552c --- /dev/null +++ b/MyFirstUniverseFinal/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/MyFirstUniverseFinal/.idea/misc.xml b/MyFirstUniverseFinal/.idea/misc.xml new file mode 100644 index 0000000..7e211a1 --- /dev/null +++ b/MyFirstUniverseFinal/.idea/misc.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/MyFirstUniverseFinal/.idea/modules.xml b/MyFirstUniverseFinal/.idea/modules.xml new file mode 100644 index 0000000..774cf7c --- /dev/null +++ b/MyFirstUniverseFinal/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/MyFirstUniverseFinal/.idea/project-template.xml b/MyFirstUniverseFinal/.idea/project-template.xml new file mode 100644 index 0000000..d57a956 --- /dev/null +++ b/MyFirstUniverseFinal/.idea/project-template.xml @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/MyFirstUniverseFinal/.idea/uiDesigner.xml b/MyFirstUniverseFinal/.idea/uiDesigner.xml new file mode 100644 index 0000000..b93ac08 --- /dev/null +++ b/MyFirstUniverseFinal/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MyFirstUniverseFinal/.idea/vcs.xml b/MyFirstUniverseFinal/.idea/vcs.xml new file mode 100644 index 0000000..94f066c --- /dev/null +++ b/MyFirstUniverseFinal/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/MyFirstUniverseFinal/.idea/workspace.xml b/MyFirstUniverseFinal/.idea/workspace.xml new file mode 100644 index 0000000..accc280 --- /dev/null +++ b/MyFirstUniverseFinal/.idea/workspace.xml @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { + "keyToString": { + "RunOnceActivity.OpenProjectViewOnStart": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "WebServerToolWindowFactoryState": "false", + "last_opened_file_path": "D:/Study/3year/OOP/MyFirstUniverse", + "settings.editor.selected.configurable": "preferences.pluginManager" + } +} + + + + + + + + + + + + + + + + + + + 1664307490741 + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MyFirstUniverseFinal/MyFirstUniverse.iml b/MyFirstUniverseFinal/MyFirstUniverse.iml new file mode 100644 index 0000000..9465dd8 --- /dev/null +++ b/MyFirstUniverseFinal/MyFirstUniverse.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/MyFirstUniverseFinal/MyZoznamStvoritela.txt b/MyFirstUniverseFinal/MyZoznamStvoritela.txt new file mode 100644 index 0000000..c5c5d51 --- /dev/null +++ b/MyFirstUniverseFinal/MyZoznamStvoritela.txt @@ -0,0 +1,10 @@ +Kapor +Nemo +Eagle +Mucha +MarineMammals +MarineMammals +MarineMammals +MarineMammals +Muz +Zena diff --git a/MyFirstUniverseFinal/src/Main.java b/MyFirstUniverseFinal/src/Main.java new file mode 100644 index 0000000..7c6c687 --- /dev/null +++ b/MyFirstUniverseFinal/src/Main.java @@ -0,0 +1,207 @@ +import com.company.Singletone; +import com.company.cars.Car; +import com.company.cars.UniverseCarFactory; +import com.company.cosmicbody.Earth; +import com.company.cosmicbody.Planet; +import com.company.cosmicbody.SolarSystem; +import com.company.cosmicbody.Star; +import com.company.creature.Creature; +import com.company.creature.MarineMammals; +import com.company.creature.Mucha; +import com.company.creature.clovecina.Clovek; +import com.company.creature.clovecina.Muz; +import com.company.creature.clovecina.Zena; +import com.company.creature.stavovce.stavovcediely.birds.Eagle; +import com.company.creature.stavovce.stavovcediely.fish.Kapor; +import com.company.creature.stavovce.stavovcediely.fish.Nemo; +import com.company.universe.Galaxy; +import com.company.universe.PlanetaryNebula; +import com.company.universe.Universe; +import tools.MessageReader; +import tools.MessageWriter; + +import java.util.ArrayList; +import java.util.Date; + +public class Main { + + public static void main(String[] args) { + Universe i_xander_i = new Universe(); + + System.out.println("\n"); + + PlanetaryNebula Orion = new PlanetaryNebula("Orion",5, 18000,200,200,200); + PlanetaryNebula Buba = new PlanetaryNebula("Buba", 8, 2300, 12,59,94); + PlanetaryNebula Phonk = new PlanetaryNebula("Phonk", 20, 100000, 0,0,0); + + System.out.println("\n"); + + Planet Mercury = new Planet("Mercury", 1333, 6083, 0); + Planet Venus = new Planet("Venus", 4867, 938, 12.1); + Planet Earth = new Planet("Earth", 100000, 108321); + Earth motherEarth = new Earth("Earth2", 100000, 108321); + Planet Mars = new Planet("Mars", 641, 16318, 9.81); + Planet Jupiter = new Planet("Jupiter", 3, 71313, 20.89); + Planet Saturn = new Planet("Saturn", 1000, 108408, 95.8); + Planet Uranus = new Planet("Uranus", 1000, 202156, 255.55); + Planet Neptune = new Planet("Neptune", 7050, 620654, 0); + + System.out.println("\n"); + + Star sun = new Star("Sun", 1.392, 1.40927, 1499726.85); + sun.on(); + + System.out.println("\n"); + + SolarSystem solarSystem = new SolarSystem(); + solarSystem.addBody(Mercury); + solarSystem.addBody(Venus); + solarSystem.addBody(Earth); + solarSystem.addBody(Mars); + solarSystem.addBody(Jupiter); + solarSystem.addBody(Saturn); + solarSystem.addBody(Uranus); + solarSystem.addBody(Neptune); + + System.out.println("\n"); + + Galaxy milkyWay = new Galaxy("Milky Way"); + milkyWay.addSustava(solarSystem); + + Galaxy Hryshchenko = new Galaxy("Hryshchenko"); + Hryshchenko.addSustava(solarSystem); + + System.out.println("\n"); + + milkyWay.sendMessage(Hryshchenko, "Hi, I'm you friend"); + Hryshchenko.sendMessage(milkyWay, "Hi."); + + System.out.println("\n"); + +/* Creature Ara = new Bird("Blu", 60, 0.4, "Blu-ara"); + Ara.move(10, 10, 20); + Creature Ara1 = new Bird("Jewel", 55, 0.4, "Blu-ara"); + Ara1.move(20,60,90); + Creature Toucan = new Bird("Rafael", 65, 0.75, "Toco toucan"); + Toucan.move(60,23,95); + Creature Cardinal = new Bird("Pedro", 20, 0.09, "Red-crested cardinal"); + Cardinal.move(98,65,32); + Creature Canary = new Bird("Nico", 20.5, 0.05, "Domestic canary"); + Canary.move(87,56,26); + Creature Cockatoo = new Bird("Nigel", 55, 0.97, "Sulphur-crested cockatoo"); + Cockatoo.move(95,45,12); + Creature Toucan1 = new Bird("Eva", 53, 0.4, "Keel-billed toucan"); + Toucan1.move(78,64,23);*/ + +/* System.out.println("\n"); + + Creature Clownfish = new Fish("Oscar" , 10, 0.02, "Bluestreak cleaner wrasse"); + Clownfish.move(2000,9000,3000); + Creature Shark = new Fish("Lenny" , 12000, 561, "Tiger shark"); + Shark.move(6000,6258,82214); + Creature Angelfish = new Fish("Angie" , 15, 0.06, "Angelfish"); + Angelfish.move(8452,1235,7536); + Creature Porcupinefish = new Fish("Sykes" , 91, 0.1, "Porcupinefish"); + Porcupinefish.move(5628,7874,5632); + Creature Lionfish = new Fish("Lola" , 45.7, 0.26, "Red lionfish"); + Lionfish.move(6203,8954,8443);*/ + + Kapor vianocnykapor = new Kapor(50); + Date dNow = new Date(); + vianocnykapor.born(dNow); + motherEarth.addCreature(vianocnykapor); + vianocnykapor.move(10,10,0); + vianocnykapor.die(dNow); + + motherEarth.addCreature(new Nemo()); + motherEarth.addCreature(new Eagle()); + + Mucha vinnamuska = new Mucha(); + motherEarth.addCreature(vinnamuska); + + System.out.println("\n"); + + Creature Bear = new MarineMammals(); + Bear.move(56,9,0); + Creature Otter = new MarineMammals("Nora", 115.1, 3.6, "marine otter", true); + Otter.move(20,8,2); + Creature Walrus = new MarineMammals("Pupik", 4.4, 1700, "Walrus", true); + Walrus.move(35,58,8); + Creature Seals = new MarineMammals("Duska", 117.2, 45, "True seals", true); + Seals.move(9526,856,258); + + motherEarth.addCreature(Otter); + motherEarth.addCreature(Bear); + motherEarth.addCreature(Walrus); + motherEarth.addCreature(Seals); + + System.out.println("\n"); + + /*for(int i = 0; i < 2000; i++){ + motherEarth.addCreature(new Bird()); + motherEarth.addCreature(new Fish()); + } + + Creature[] array = motherEarth.getArrayCreature(); + for(int i = 0; i < 2000; i++){ + array[i].move(10,10,0); + }*/ + + Muz prvyMuz = new Muz(null, null,34, "Adam", "Prvy"); + Zena prvaZena = new Zena(null, null,34, "Eva", "Prva"); + System.out.println(prvyMuz); + System.out.println(prvaZena); + + motherEarth.addCreature(prvyMuz); + motherEarth.addCreature(prvaZena); + + Clovek prvedieta = prvaZena.splodit(prvyMuz); + prvedieta.born(dNow); + prvedieta.setName("Kain"); + + Clovek druhedieta = prvaZena.splodit(prvyMuz); + druhedieta.born(dNow); + druhedieta.setName("Abel"); + + System.out.println(prvedieta); + System.out.println(druhedieta); + + MessageReader AdamovReader = new MessageReader(); + AdamovReader.obtainFilename(args); + AdamovReader.openAndRead(); + AdamovReader.processMessage(); + + MessageWriter AdamovWriter = new MessageWriter(motherEarth.getArrayCreature()); + AdamovWriter.WriteMessage(); + + Singletone singletone = Singletone.getInstance(); + singletone.takeUniverse(i_xander_i); + + System.out.println("\n"); + + UniverseCarFactory myFactory = new UniverseCarFactory("BMW"); + + Car mvp = myFactory.produce("MVP"); + Car suv = myFactory.produce("SUV"); + Car sport = myFactory.produce("Sportcar"); + Car little = myFactory.produce("Littlecar"); + + System.out.println(mvp); + System.out.println(suv); + System.out.println(sport); + System.out.println(little); + + ArrayList warehouse = new ArrayList(); + UniverseCarFactory Mercedes = new UniverseCarFactory("Mercedes"); + UniverseCarFactory BMW = new UniverseCarFactory("BMW"); + + for(int i =0; i<1000; i++ ){ + Car mercedes = Mercedes.produce("Littlecar"); + Car bmw = BMW.produce("Sportcar"); + warehouse.add(mercedes); + warehouse.add(bmw); + } + + i_xander_i.stopUniverse(); + } +} \ No newline at end of file diff --git a/MyFirstUniverseFinal/src/com/company/Singletone.java b/MyFirstUniverseFinal/src/com/company/Singletone.java new file mode 100644 index 0000000..1941683 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/Singletone.java @@ -0,0 +1,25 @@ +package com.company; + +import com.company.universe.Universe; + +public class Singletone { + private static Singletone instance = null; + private Universe i_xander_i; + + private Singletone() { + + } + + public static Singletone getInstance() { + if(instance == null){ + instance = new Singletone(); + } + return instance; + } + + public void takeUniverse(Universe i_xander_i){ + this.i_xander_i = i_xander_i; + + System.out.println("Vesmir teraz uz ma stvoritela"); + } +} diff --git a/MyFirstUniverseFinal/src/com/company/cars/Car.java b/MyFirstUniverseFinal/src/com/company/cars/Car.java new file mode 100644 index 0000000..22bd9e3 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/cars/Car.java @@ -0,0 +1,28 @@ +package com.company.cars; + +public abstract class Car { + + protected String Model; + protected String Logo; + + public String getModel() { + return Model; + } + + public void setModel(String model) { + Model = model; + } + + public String getLogo() { + return Logo; + } + + public void setLogo(String logo) { + Logo = logo; + } + + @Override + public String toString() { + return "Logo: " + Logo + "Model: " + Model; + } +} diff --git a/MyFirstUniverseFinal/src/com/company/cars/Littlecar.java b/MyFirstUniverseFinal/src/com/company/cars/Littlecar.java new file mode 100644 index 0000000..b27e0bb --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/cars/Littlecar.java @@ -0,0 +1,5 @@ +package com.company.cars; + +public class Littlecar extends Car{ + +} diff --git a/MyFirstUniverseFinal/src/com/company/cars/MVP.java b/MyFirstUniverseFinal/src/com/company/cars/MVP.java new file mode 100644 index 0000000..4fcd278 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/cars/MVP.java @@ -0,0 +1,4 @@ +package com.company.cars; + +public class MVP extends Car{ +} diff --git a/MyFirstUniverseFinal/src/com/company/cars/SUV.java b/MyFirstUniverseFinal/src/com/company/cars/SUV.java new file mode 100644 index 0000000..bd6226d --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/cars/SUV.java @@ -0,0 +1,4 @@ +package com.company.cars; + +public class SUV extends Car{ +} diff --git a/MyFirstUniverseFinal/src/com/company/cars/Sportcar.java b/MyFirstUniverseFinal/src/com/company/cars/Sportcar.java new file mode 100644 index 0000000..82d52a3 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/cars/Sportcar.java @@ -0,0 +1,4 @@ +package com.company.cars; + +public class Sportcar extends Car{ +} diff --git a/MyFirstUniverseFinal/src/com/company/cars/UniverseCarFactory.java b/MyFirstUniverseFinal/src/com/company/cars/UniverseCarFactory.java new file mode 100644 index 0000000..819adfd --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/cars/UniverseCarFactory.java @@ -0,0 +1,37 @@ +package com.company.cars; + +public class UniverseCarFactory { + protected String nameFactory; + + public UniverseCarFactory(String NameFactory) { + nameFactory = NameFactory; + } + + public Car produce(String type){ + if(type == "SUV"){ + Car suv = new SUV(); + suv.setLogo(nameFactory); + suv.setModel("Suviaq"); + return suv; + } + else if (type == "MVP") { + Car mvp = new MVP(); + mvp.setLogo(nameFactory); + mvp.setModel("Familiaq"); + return mvp; + } + else if(type == "Sportcar"){ + Car sport =new Sportcar(); + sport.setLogo(nameFactory); + sport.setModel("Sport"); + return sport; + } + else if(type == "Littlecar"){ + Car little =new Littlecar(); + little.setLogo(nameFactory); + little.setModel("Little"); + return little; + } + return null; + } +} diff --git a/MyFirstUniverseFinal/src/com/company/cosmicbody/CosmicBody.java b/MyFirstUniverseFinal/src/com/company/cosmicbody/CosmicBody.java new file mode 100644 index 0000000..75edda2 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/cosmicbody/CosmicBody.java @@ -0,0 +1,13 @@ +package com.company.cosmicbody; + +public class CosmicBody { + private String body; + + public String getBody() { + return body; + } + + protected void setBody(String body) { + this.body = body; + } +} diff --git a/MyFirstUniverseFinal/src/com/company/cosmicbody/Earth.java b/MyFirstUniverseFinal/src/com/company/cosmicbody/Earth.java new file mode 100644 index 0000000..e25f243 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/cosmicbody/Earth.java @@ -0,0 +1,35 @@ +package com.company.cosmicbody; + +import com.company.creature.Creature; + +import java.util.ArrayList; + +public class Earth extends Planet{ + private ArrayList arrayCreature = new ArrayList(); + private int counterCreature; + + public Earth(String name, double weight, double diameter) { + super(name, weight, diameter); + + //arrayCreature = new Creature[9999]; + //counterCreature = 0; + } + + public void addCreature(Creature newCreature){ + arrayCreature.add(newCreature); + + //arrayCreature[counterCreature] = newCreature; + //counterCreature++; + } + + public Earth() { + } + + public ArrayList getArrayCreature() { + return arrayCreature; + } + +/* public Creature[] getArrayCreature() { + return arrayCreature; + }*/ +} diff --git a/MyFirstUniverseFinal/src/com/company/cosmicbody/Planet.java b/MyFirstUniverseFinal/src/com/company/cosmicbody/Planet.java new file mode 100644 index 0000000..c309811 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/cosmicbody/Planet.java @@ -0,0 +1,106 @@ +package com.company.cosmicbody; + +public class Planet extends CosmicBody { + private String name; + private double weight; + private double diameter; + private double gravitation; + private Boolean weightSet = false; + + public void setPlanetaryWeight(double weight){ + if(!weightSet){ + setWeight(weight); + weightSet = true; + } + } + + + public double getWeight() { + return weight; + } + + public void setWeight(double weight) { + if(this.weight>weight){ + if(Math.abs(this.weight-weight) <= 1000){ + System.out.println("I'm losing weight."); + } + else { + System.out.println("I'm losing a lot of weight."); + } + if(Math.abs(this.weight-weight) > 1000){ + decreaseGravity(0.1); + } + } + else{ + if(Math.abs(this.weight-weight) <= 1000){ + System.out.println("Damn, I woke up."); + } + else { + System.out.println("Damn, I put on too much weight."); + } + if(Math.abs(this.weight-weight) > 1000){ + increaseGravity(0.1); + } + } + + this.weight = weight; + } + + public double getDiameter() { + return diameter; + } + + public void setDiameter(double diameter) { + this.diameter = diameter; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getGravitation() { + return gravitation; + } + + public void setGravitation(double gravitation) { + this.gravitation = gravitation; + } + + public Planet(String name, double weight, double diameter) { +// setWeight(weight); +// setDiameter(diameter); +// setName(name); + this.name = name; + this.weight = weight; + this.diameter = diameter; + this.gravitation = 9.81; + System.out.println("Planet is: " + name + " has been created. Parameters: " + weight + " " + diameter + ". Gravitation: " + gravitation); + } + + private void increaseGravity(double add){ + gravitation = gravitation + add; + } + private void decreaseGravity(double dec){ + gravitation = gravitation - dec; + } + + public Planet(String name, double weight, double diameter, double gravitation) { + this.name = name; + this.weight = weight; + this.diameter = diameter; + this.gravitation = gravitation; + System.out.println("Planet is: " + name + " has been created. Parameters: " + weight + " " + diameter + ". Gravitation: " + gravitation); + } + + public Planet() { + this.name = "Earth"; + this.weight = 5972200; + this.diameter = 12756; + System.out.println("Planet is: " + name + " has been created. Parameters: " + weight + " " + diameter + ". Gravitation: " + gravitation); + } + +} diff --git a/MyFirstUniverseFinal/src/com/company/cosmicbody/SolarSystem.java b/MyFirstUniverseFinal/src/com/company/cosmicbody/SolarSystem.java new file mode 100644 index 0000000..a600e25 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/cosmicbody/SolarSystem.java @@ -0,0 +1,40 @@ +package com.company.cosmicbody; + +public class SolarSystem { +// private Star Sun = new Star(); + +// private Planet Earth; +// private Planet Mars; +// private Planet Jupiter; +// private Planet Saturn; + + private CosmicBody[] orbitalBody = new CosmicBody[500000000]; + private int objectCounter; + + public SolarSystem() { + //star = new Star(); + + setObjectCounter(0); + orbitalBody[objectCounter] = new Planet("Mars2", 432432, 432432); + objectCounter++; + + orbitalBody[objectCounter] = new Planet("Venusa2", 55, 32342); + objectCounter++; + + orbitalBody[objectCounter] = new Star("Polar",0,0,0); + objectCounter++; + } + + public void addBody(CosmicBody newBody){ + orbitalBody[objectCounter] = newBody; + objectCounter++; + } + + public int getObjectCounter() { + return objectCounter; + } + + public void setObjectCounter(int objectCounter) { + this.objectCounter = objectCounter; + } +} diff --git a/MyFirstUniverseFinal/src/com/company/cosmicbody/Star.java b/MyFirstUniverseFinal/src/com/company/cosmicbody/Star.java new file mode 100644 index 0000000..230ddfc --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/cosmicbody/Star.java @@ -0,0 +1,68 @@ +package com.company.cosmicbody; + +public class Star extends CosmicBody { + private String name; + private double weight; + private double radius; + private double temperature; + private Boolean light = false; + + public Star(String name, double weight, double radius, double temperature) { + this.name = name; + this.weight = weight; + this.radius = radius; + this.temperature = temperature; + System.out.println("Star is: " + name + " has been created. Parameters: " + weight + ", " + radius + ", " + temperature); + } + + public Star(){ + this.name = "naname"; + this.weight = 1000^35; + this.temperature = 500000; + System.out.println("Star is: " + name + " has been created"); + } + + public void on(){ + this.light = true; + this.temperature = temperature + 10000; + System.out.println("Status: on" + ". Temperature = " + temperature); + } + + public void off(){ + this.light = false; + this.temperature = temperature - 10000; + System.out.println("Status: off" + ". Temperature = " + temperature); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getWeight() { + return weight; + } + + public void setWeight(double weight) { + this.weight = weight; + } + + public double getRadius() { + return radius; + } + + public void setRadius(double radius) { + this.radius = radius; + } + + public double getTemperature() { + return temperature; + } + + public void setTemperature(double temperature) { + this.temperature = temperature; + } +} diff --git a/MyFirstUniverseFinal/src/com/company/cosmicbody/Сomet.java b/MyFirstUniverseFinal/src/com/company/cosmicbody/Сomet.java new file mode 100644 index 0000000..630946a --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/cosmicbody/Сomet.java @@ -0,0 +1,21 @@ +package com.company.cosmicbody; + +public class Сomet extends CosmicBody { + private int object_counter; + + private CosmicBody[] orbitalBody = new CosmicBody[500000000]; + + public Сomet() { + setObject_counter(0); + orbitalBody[object_counter] = new Сomet(); + object_counter++; + } + + public int getObject_counter() { + return object_counter; + } + + public void setObject_counter(int object_counter) { + this.object_counter = object_counter; + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/Bezstavovce.java b/MyFirstUniverseFinal/src/com/company/creature/Bezstavovce.java new file mode 100644 index 0000000..9fbe450 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/Bezstavovce.java @@ -0,0 +1,5 @@ +package com.company.creature; + +public abstract class Bezstavovce extends Creature { + +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/Bornable.java b/MyFirstUniverseFinal/src/com/company/creature/Bornable.java new file mode 100644 index 0000000..bf6adfa --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/Bornable.java @@ -0,0 +1,7 @@ +package com.company.creature; + +import java.util.Date; + +public interface Bornable { + public void born(Date DayOfBirth); +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/Creature.java b/MyFirstUniverseFinal/src/com/company/creature/Creature.java new file mode 100644 index 0000000..a36b41a --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/Creature.java @@ -0,0 +1,13 @@ +package com.company.creature; + +import java.util.Date; + +public abstract class Creature implements Bornable, Dieable{ + protected Date DayOfBirth; + protected Date DayOfDie; + public abstract void move (int directionX, int directionY, int directionZ); + + public Date getDayOfBirth() { + return DayOfBirth; + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/Dieable.java b/MyFirstUniverseFinal/src/com/company/creature/Dieable.java new file mode 100644 index 0000000..ab0b8ab --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/Dieable.java @@ -0,0 +1,7 @@ +package com.company.creature; + +import java.util.Date; + +public interface Dieable { + public void die(Date DayOfDie); +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/MarineMammals.java b/MyFirstUniverseFinal/src/com/company/creature/MarineMammals.java new file mode 100644 index 0000000..e957e44 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/MarineMammals.java @@ -0,0 +1,51 @@ +package com.company.creature; + +import java.util.Date; + +public class MarineMammals extends Creature { + private String name; + private double height; + private double weight; + private String type; + private boolean predator = false; + + public MarineMammals(String name, double height, double weight, String type, boolean predator) { + this.name = name; + this.height = height; + this.weight = weight; + this.type = type; + this.predator = predator; + if (predator = true) { + System.out.println("Marine Mammals is: " + name + " has been created. Parameters: " + height + "cm, " + weight + "kg. Type - " + type + ". Predator: Yes" ); + }else{ + System.out.println("Marine Mammals is: " + name + " has been created. Parameters: " + height + "cm, " + weight + "kg. Type - " + type + ". Predator: No" ); + } + } + + public MarineMammals() { + this.name = "Umka"; + this.height = 222; + this.weight = 5555; + this.type = "White Bear"; + this.predator = false; + System.out.println("Marine Mammals is: " + name + " has been created. Parameters: " + height + "cm, " + weight + "kg. Type - " + type + ". Predator: " + this.predator); + } + + + + + @Override + public void move(int directionX, int directionY, int directionZ) { + System.out.println("I'm live in sea and land"); + } + + @Override + public void born(Date DayOfBirth) { + + } + + @Override + public void die(Date DayOfDie) { + + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/Mucha.java b/MyFirstUniverseFinal/src/com/company/creature/Mucha.java new file mode 100644 index 0000000..f2af630 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/Mucha.java @@ -0,0 +1,23 @@ +package com.company.creature; + +import com.company.creature.Bezstavovce; + +import java.util.Date; + +public class Mucha extends Bezstavovce { + + @Override + public void born(Date DayOfBirth) { + + } + + @Override + public void move(int directionX, int directionY, int directionZ) { + + } + + @Override + public void die(Date DayOfDie) { + + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/cicavce/Cicavec.java b/MyFirstUniverseFinal/src/com/company/creature/cicavce/Cicavec.java new file mode 100644 index 0000000..b9061a5 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/cicavce/Cicavec.java @@ -0,0 +1,25 @@ +package com.company.creature.cicavce; + +import com.company.creature.stavovce.stavovcediely.Stavovec; +import com.company.creature.stavovce.stavovcediely.sustavy.*; + +public abstract class Cicavec extends Stavovec implements cicable{ + private float temperature; + + @Override + public void create_sustavy() { + sustavy.add(new ObehovaSustavaStavovec(TypSustavy.OBEHOVA)); + sustavy.add(new OpovovaSustavaStavovec(TypSustavy.OPOROVA)); + sustavy.add(new VylucovaciaSustavaStavovec(TypSustavy.VYLUCOVACIA)); + sustavy.add(new PohybovaSustavaStavovec(TypSustavy.POHYBOVA)); + sustavy.add(new DychaciaSustavaStavovec(TypSustavy.DUCHACIA)); + sustavy.add(new TraviacaSustavaStavovec(TypSustavy.TRAVIACA)); + sustavy.add(new RozmnozovaciaSustavaStavovec(TypSustavy.ROZMNOZOVACIA)); + sustavy.add(new NervovaSustavaStavovec_Default(TypSustavy.NERVOVA)); + } + + public Cicavec(int pocet_stavcov) { + super(pocet_stavcov); + this.temperature = 36; + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/cicavce/Materske_mlieko.java b/MyFirstUniverseFinal/src/com/company/creature/cicavce/Materske_mlieko.java new file mode 100644 index 0000000..9735eb8 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/cicavce/Materske_mlieko.java @@ -0,0 +1,4 @@ +package com.company.creature.cicavce; + +public class Materske_mlieko { +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/cicavce/cicable.java b/MyFirstUniverseFinal/src/com/company/creature/cicavce/cicable.java new file mode 100644 index 0000000..5a7f2d9 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/cicavce/cicable.java @@ -0,0 +1,6 @@ +package com.company.creature.cicavce; + +public interface cicable { + public void cicat (Cicavec mama); + public void cicat(Materske_mlieko mliecko); +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/clovecina/Clovek.java b/MyFirstUniverseFinal/src/com/company/creature/clovecina/Clovek.java new file mode 100644 index 0000000..b3e1aca --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/clovecina/Clovek.java @@ -0,0 +1,68 @@ +package com.company.creature.clovecina; + +import com.company.creature.cicavce.Cicavec; +import com.company.creature.cicavce.Materske_mlieko; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public abstract class Clovek extends Cicavec { + protected Clovek otec; + protected Clovek mama; + protected List deti; + + protected String name; + protected String surname; + + public Clovek(Clovek otec, Clovek mama, int pocet_stavcov) { + super(pocet_stavcov); + + this.otec = otec; + this.mama = mama; + + deti = new ArrayList(); + + } + + public void setName(String name) { + this.name = name; + } + + public void setSurname(String surname){ + this.surname = surname; + } + + @Override + public void cicat(Cicavec mama) { + + } + + @Override + public void cicat(Materske_mlieko mliecko) { + + } + + @Override + public void born(Date DayOfBirth) { + super.born(DayOfBirth); + } + + @Override + public void move(int directionX, int directionY, int directionZ) { + super.move(directionX, directionY, directionZ); + } + + @Override + public void die(Date DayOfDie) { + super.die(DayOfDie); + } + + @Override + public String toString() { + return "Clovek{" + + "name='" + name + '\'' + + ", surname='" + surname + '\'' + + '}'; + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/clovecina/Muz.java b/MyFirstUniverseFinal/src/com/company/creature/clovecina/Muz.java new file mode 100644 index 0000000..83bee78 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/clovecina/Muz.java @@ -0,0 +1,61 @@ +package com.company.creature.clovecina; + +import com.company.creature.cicavce.Cicavec; +import com.company.creature.cicavce.Materske_mlieko; +import com.company.creature.stavovce.stavovcediely.sustavy.*; +import com.company.creature.stavovce.stavovcediely.sustavy.rozmnozovaciaclovek.RozmonozovaciaSustavaMuz; + +import java.util.Date; + +public class Muz extends Clovek{ + public Muz(Clovek otec, Clovek mama, int pocet_stavcov) { + super(otec, mama, pocet_stavcov); + } + + public Muz(Clovek otec, Clovek mama, int pocet_stavcov, String name, String surname) { + super(otec, mama, pocet_stavcov); + + super.name = name; + super.surname = surname; + + create_sustavy(); + } + + @Override + public void cicat(Cicavec mama) { + + } + + @Override + public void cicat(Materske_mlieko mliecko) { + + } + + @Override + public void born(Date DayOfBirth) { + super.born(DayOfBirth); + } + + @Override + public void move(int directionX, int directionY, int directionZ) { + super.move(directionX, directionY, directionZ); + } + + @Override + public void die(Date DayOfDie) { + super.die(DayOfDie); + } + + @Override + public void create_sustavy() { + sustavy.add(new ObehovaSustavaStavovec(TypSustavy.OBEHOVA)); + sustavy.add(new OpovovaSustavaStavovec(TypSustavy.OPOROVA)); + sustavy.add(new VylucovaciaSustavaStavovec(TypSustavy.VYLUCOVACIA)); + sustavy.add(new PohybovaSustavaStavovec(TypSustavy.POHYBOVA)); + sustavy.add(new DychaciaSustavaStavovec(TypSustavy.DUCHACIA)); + sustavy.add(new TraviacaSustavaStavovec(TypSustavy.TRAVIACA)); + sustavy.add(new RozmonozovaciaSustavaMuz(TypSustavy.ROZMNOZOVACIA)); + sustavy.add(new NervovaSustavaStavovec_Default(TypSustavy.NERVOVA)); + System.out.println("Som muz a mam obicajnu nervovu sustavu a rozmozovaciu sustavu"); + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/clovecina/Zena.java b/MyFirstUniverseFinal/src/com/company/creature/clovecina/Zena.java new file mode 100644 index 0000000..70b1a95 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/clovecina/Zena.java @@ -0,0 +1,91 @@ +package com.company.creature.clovecina; + +import com.company.creature.cicavce.Cicavec; +import com.company.creature.cicavce.Materske_mlieko; +import com.company.creature.stavovce.stavovcediely.sustavy.*; +import com.company.creature.stavovce.stavovcediely.sustavy.rozmnozovaciaclovek.RozmonozovaciaSustavaZena; + +import java.util.Date; +import java.util.Random; + +public class Zena extends Clovek{ + public Zena(Clovek otec, Clovek mama, int pocet_stavcov) { + super(otec, mama, pocet_stavcov); + } + + public Zena(Clovek otec, Clovek mama, int pocet_stavcov, String name, String surname) { + super(otec, mama, pocet_stavcov); + + super.name = name; + super.surname = surname; + + create_sustavy(); + } + + + @Override + public void cicat(Cicavec mama) { + + } + + @Override + public void cicat(Materske_mlieko mliecko) { + + } + + @Override + public void born(Date DayOfBirth) { + super.born(DayOfBirth); + } + + @Override + public void move(int directionX, int directionY, int directionZ) { + super.move(directionX, directionY, directionZ); + } + + @Override + public void die(Date DayOfDie) { + super.die(DayOfDie); + } + + @Override + public void create_sustavy() { + sustavy.add(new ObehovaSustavaStavovec(TypSustavy.OBEHOVA)); + sustavy.add(new OpovovaSustavaStavovec(TypSustavy.OPOROVA)); + sustavy.add(new VylucovaciaSustavaStavovec(TypSustavy.VYLUCOVACIA)); + sustavy.add(new PohybovaSustavaStavovec(TypSustavy.POHYBOVA)); + sustavy.add(new DychaciaSustavaStavovec(TypSustavy.DUCHACIA)); + sustavy.add(new TraviacaSustavaStavovec(TypSustavy.TRAVIACA)); + sustavy.add(new RozmonozovaciaSustavaZena(TypSustavy.ROZMNOZOVACIA)); + sustavy.add(new NervovaSustavaStavovec_Default(TypSustavy.NERVOVA)); + + System.out.println("Som zena a mam zlozitu nervovu sustavu a speci rozmozovaciu sustavu"); + } + + public Clovek splodit(Muz stymtomuzom){ + Random rand = new Random(); + Boolean man = rand.nextBoolean(); + + Clovek clovecikSpodneny; + + if(man){ + clovecikSpodneny = new Muz(stymtomuzom, this,34); + super.deti.add(clovecikSpodneny); + stymtomuzom.deti.add(clovecikSpodneny); + } + else{ + clovecikSpodneny = new Zena(stymtomuzom, this,34); + super.deti.add(clovecikSpodneny); + stymtomuzom.deti.add(clovecikSpodneny); + } + + clovecikSpodneny.surname = super.surname + "-" + stymtomuzom.surname; + babyIsideCare(clovecikSpodneny); + return clovecikSpodneny; + } + + public void babyIsideCare(Clovek plod){ + RozmonozovaciaSustavaZena myRS = (RozmonozovaciaSustavaZena) sustavy.get(6); + myRS.takeAndCareBaby(plod); + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/Chrbtica.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/Chrbtica.java new file mode 100644 index 0000000..3d6667e --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/Chrbtica.java @@ -0,0 +1,13 @@ +package com.company.creature.stavovce.stavovcediely; + +public class Chrbtica { + private Stavec[] stavce; + + public Chrbtica(int pocet_stavcov) { + this.stavce = new Stavec[pocet_stavcov]; + } + + public Chrbtica() { + this.stavce = new Stavec[11]; + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/Stavec.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/Stavec.java new file mode 100644 index 0000000..45e727e --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/Stavec.java @@ -0,0 +1,4 @@ +package com.company.creature.stavovce.stavovcediely; + +public class Stavec { +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/Stavovec.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/Stavovec.java new file mode 100644 index 0000000..c6652a4 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/Stavovec.java @@ -0,0 +1,48 @@ +package com.company.creature.stavovce.stavovcediely; + +import com.company.creature.Creature; +import com.company.creature.stavovce.stavovcediely.sustavy.*; + +import java.util.ArrayList; +import java.util.Date; + +public class Stavovec extends Creature { + + protected Chrbtica chrbtica; + protected ArrayList sustavy = new ArrayList(); + + public Stavovec(int pocet_stavcov){ + chrbtica = new Chrbtica(pocet_stavcov); + //create_sustavy(); + } + + protected void create_sustavy(){ + sustavy.add(new ObehovaSustavaStavovec(TypSustavy.OBEHOVA)); + sustavy.add(new OpovovaSustavaStavovec(TypSustavy.OPOROVA)); + sustavy.add(new VylucovaciaSustavaStavovec(TypSustavy.VYLUCOVACIA)); + sustavy.add(new PohybovaSustavaStavovec(TypSustavy.POHYBOVA)); + sustavy.add(new DychaciaSustavaStavovec(TypSustavy.DUCHACIA)); + sustavy.add(new TraviacaSustavaStavovec(TypSustavy.TRAVIACA)); + sustavy.add(new RozmnozovaciaSustavaStavovec(TypSustavy.ROZMNOZOVACIA)); + sustavy.add(new NervovaSustavaStavovec_Default(TypSustavy.NERVOVA)); + } + + public ArrayList getSustavy() { + return sustavy; + } + + @Override + public void born(Date DayOfBirth) { + + } + + @Override + public void move(int directionX, int directionY, int directionZ) { + + } + + @Override + public void die(Date DayOfDie) { + + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/birds/Bird.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/birds/Bird.java new file mode 100644 index 0000000..16f07c4 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/birds/Bird.java @@ -0,0 +1,52 @@ +package com.company.creature.stavovce.stavovcediely.birds; + +import com.company.creature.stavovce.stavovcediely.Stavovec; + +import java.util.Date; + +public abstract class Bird extends Stavovec { + private String name; + private double height; + private double weight; + private String type; + + public Bird(int pocet_stavcov){ + super(pocet_stavcov); + } + + public Bird(String name, double height, double weight, String type, int pocet_stavcov) { + super(pocet_stavcov); + this.name = name; + this.height = height; + this.weight = weight; + this.type = type; + System.out.println("Bird is: " + name + " has been created. Parameters: " + height + "cm, " + weight + "kg. Type - " + type); + } + + public Bird() { + super(11); + this.name = "Loloska"; + this.height = 100; + this.weight = 10; + this.type = "parrot"; + System.out.println("Bird is: " + name + " has been created. Parameters: " + height + "cm, " + weight + "kg. Type - " + type); + } + + + @Override + public void move(int directionX, int directionY, int directionZ) { + System.out.println("I fly. Because I'm bird"); + } + + @Override + public void born(Date DayOfBirth) { + super.DayOfBirth = DayOfBirth; + System.out.println("I was born " + super.DayOfBirth.toString()); + } + + @Override + public void die(Date DayOfDie) { + super.DayOfDie = DayOfDie; + System.out.println("I was die " + super.DayOfDie.toString()); + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/birds/Eagle.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/birds/Eagle.java new file mode 100644 index 0000000..f961cd4 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/birds/Eagle.java @@ -0,0 +1,14 @@ +package com.company.creature.stavovce.stavovcediely.birds; + +public class Eagle extends Bird{ + public Eagle(int pocet_stavcov) { + super(pocet_stavcov); + } + + public Eagle(String name, double height, double weight, String type, int pocet_stavcov) { + super(name, height, weight, type, pocet_stavcov); + } + + public Eagle() { + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/fish/Fish.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/fish/Fish.java new file mode 100644 index 0000000..a4fe872 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/fish/Fish.java @@ -0,0 +1,51 @@ +package com.company.creature.stavovce.stavovcediely.fish; + +import com.company.creature.stavovce.stavovcediely.Stavovec; + +import java.util.Date; + +public abstract class Fish extends Stavovec { + private String name; + private double height; + private double weight; + private String type; + + public Fish(int pocet_stavcov){ + super(pocet_stavcov); + } + + public Fish(String name, double height, double weight, String type, int pocet_stavcov) { + super(pocet_stavcov); + this.name = name; + this.height = height; + this.weight = weight; + this.type = type; + System.out.println("Fish is: " + name + " has been created. Parameters: " + height + "cm, " + weight + "kg. Type - " + type); + } + + public Fish() { + super(11); + this.name = "Svoupy"; + this.height = 15; + this.weight = 0.2; + this.type = "Golden fish"; + System.out.println("Bird is: " + name + " has been created. Parameters: " + height + "cm, " + weight + "kg. Type - " + type); + } + + @Override + public void move(int directionX, int directionY, int directionZ) { + System.out.println("I swim. Because I'm a fish"); + } + + @Override + public void born(Date DayOfBirth) { + super.DayOfBirth = DayOfBirth; + System.out.println("I was born " + super.DayOfBirth.toString()); + } + + @Override + public void die(Date DayOfDie) { + super.DayOfDie = DayOfDie; + System.out.println("I was die " + super.DayOfDie.toString()); + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/fish/Kapor.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/fish/Kapor.java new file mode 100644 index 0000000..d54a3be --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/fish/Kapor.java @@ -0,0 +1,15 @@ +package com.company.creature.stavovce.stavovcediely.fish; + +public class Kapor extends Fish{ + + public Kapor(int pocet_stavcov) { + super(pocet_stavcov); + } + + public Kapor(String name, double height, double weight, String type, int pocet_stavcov) { + super(name, height, weight, type, pocet_stavcov); + } + + public Kapor() { + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/fish/Nemo.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/fish/Nemo.java new file mode 100644 index 0000000..543e7d9 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/fish/Nemo.java @@ -0,0 +1,14 @@ +package com.company.creature.stavovce.stavovcediely.fish; + +public class Nemo extends Fish{ + public Nemo(int pocet_stavcov) { + super(pocet_stavcov); + } + + public Nemo(String name, double height, double weight, String type, int pocet_stavcov) { + super(name, height, weight, type, pocet_stavcov); + } + + public Nemo() { + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/DychaciaSustavaStavovec.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/DychaciaSustavaStavovec.java new file mode 100644 index 0000000..6d69109 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/DychaciaSustavaStavovec.java @@ -0,0 +1,7 @@ +package com.company.creature.stavovce.stavovcediely.sustavy; + +public class DychaciaSustavaStavovec extends Sustava{ + public DychaciaSustavaStavovec(TypSustavy typSustavy) { + super(typSustavy); + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/NervovaSustavaStavovec_Default.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/NervovaSustavaStavovec_Default.java new file mode 100644 index 0000000..8019dc9 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/NervovaSustavaStavovec_Default.java @@ -0,0 +1,7 @@ +package com.company.creature.stavovce.stavovcediely.sustavy; + +public class NervovaSustavaStavovec_Default extends Sustava{ + public NervovaSustavaStavovec_Default(TypSustavy typSustavy) { + super(typSustavy); + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/ObehovaSustavaStavovec.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/ObehovaSustavaStavovec.java new file mode 100644 index 0000000..087fe10 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/ObehovaSustavaStavovec.java @@ -0,0 +1,7 @@ +package com.company.creature.stavovce.stavovcediely.sustavy; + +public class ObehovaSustavaStavovec extends Sustava{ + public ObehovaSustavaStavovec(TypSustavy typSustavy) { + super(typSustavy); + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/OpovovaSustavaStavovec.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/OpovovaSustavaStavovec.java new file mode 100644 index 0000000..930a012 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/OpovovaSustavaStavovec.java @@ -0,0 +1,7 @@ +package com.company.creature.stavovce.stavovcediely.sustavy; + +public class OpovovaSustavaStavovec extends Sustava{ + public OpovovaSustavaStavovec(TypSustavy typSustavy) { + super(typSustavy); + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/PohybovaSustavaStavovec.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/PohybovaSustavaStavovec.java new file mode 100644 index 0000000..eb44e95 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/PohybovaSustavaStavovec.java @@ -0,0 +1,7 @@ +package com.company.creature.stavovce.stavovcediely.sustavy; + +public class PohybovaSustavaStavovec extends Sustava{ + public PohybovaSustavaStavovec(TypSustavy typSustavy) { + super(typSustavy); + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/RozmnozovaciaSustavaStavovec.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/RozmnozovaciaSustavaStavovec.java new file mode 100644 index 0000000..838ebd1 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/RozmnozovaciaSustavaStavovec.java @@ -0,0 +1,7 @@ +package com.company.creature.stavovce.stavovcediely.sustavy; + +public class RozmnozovaciaSustavaStavovec extends Sustava { + public RozmnozovaciaSustavaStavovec(TypSustavy typSustavy) { + super(typSustavy); + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/Sustava.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/Sustava.java new file mode 100644 index 0000000..5880daa --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/Sustava.java @@ -0,0 +1,13 @@ +package com.company.creature.stavovce.stavovcediely.sustavy; + +public abstract class Sustava { + TypSustavy typSustavy; + + public Sustava(TypSustavy typSustavy) { + this.typSustavy = typSustavy; + } + + public void setTypSustavy(TypSustavy typSustavy) { + this.typSustavy = typSustavy; + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/TraviacaSustavaStavovec.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/TraviacaSustavaStavovec.java new file mode 100644 index 0000000..647d791 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/TraviacaSustavaStavovec.java @@ -0,0 +1,7 @@ +package com.company.creature.stavovce.stavovcediely.sustavy; + +public class TraviacaSustavaStavovec extends Sustava{ + public TraviacaSustavaStavovec(TypSustavy typSustavy) { + super(typSustavy); + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/TypSustavy.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/TypSustavy.java new file mode 100644 index 0000000..f995aa6 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/TypSustavy.java @@ -0,0 +1,12 @@ +package com.company.creature.stavovce.stavovcediely.sustavy; + +public enum TypSustavy { + OPOROVA, + OBEHOVA, + VYLUCOVACIA, + POHYBOVA, + DUCHACIA, + TRAVIACA, + ROZMNOZOVACIA, + NERVOVA +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/VylucovaciaSustavaStavovec.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/VylucovaciaSustavaStavovec.java new file mode 100644 index 0000000..9ca15da --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/VylucovaciaSustavaStavovec.java @@ -0,0 +1,7 @@ +package com.company.creature.stavovce.stavovcediely.sustavy; + +public class VylucovaciaSustavaStavovec extends Sustava{ + public VylucovaciaSustavaStavovec(TypSustavy typSustavy) { + super(typSustavy); + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/CNS.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/CNS.java new file mode 100644 index 0000000..5b2c55e --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/CNS.java @@ -0,0 +1,11 @@ +package com.company.creature.stavovce.stavovcediely.sustavy.nervova; + +public class CNS { + private Mozog mozog; + private Miecha miecha; + + public CNS() { + mozog = new Mozog(); + miecha = new Miecha(); + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/Miecha.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/Miecha.java new file mode 100644 index 0000000..10365f1 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/Miecha.java @@ -0,0 +1,9 @@ +package com.company.creature.stavovce.stavovcediely.sustavy.nervova; + +public class Miecha { + private Neuron[] NeuronovaSiet; + + public Miecha() { + this.NeuronovaSiet = new Neuron[500]; + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/Mozog.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/Mozog.java new file mode 100644 index 0000000..77d8b34 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/Mozog.java @@ -0,0 +1,9 @@ +package com.company.creature.stavovce.stavovcediely.sustavy.nervova; + +public class Mozog { + private Neuron[] NeuronovaSiet; + + public Mozog(){ + this.NeuronovaSiet = new Neuron[500]; + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/Nerv.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/Nerv.java new file mode 100644 index 0000000..ff06245 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/Nerv.java @@ -0,0 +1,4 @@ +package com.company.creature.stavovce.stavovcediely.sustavy.nervova; + +public class Nerv { +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/NervovaSustavaCicavec.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/NervovaSustavaCicavec.java new file mode 100644 index 0000000..e991f76 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/NervovaSustavaCicavec.java @@ -0,0 +1,16 @@ +package com.company.creature.stavovce.stavovcediely.sustavy.nervova; + +import com.company.creature.stavovce.stavovcediely.sustavy.NervovaSustavaStavovec_Default; +import com.company.creature.stavovce.stavovcediely.sustavy.TypSustavy; + +public class NervovaSustavaCicavec extends NervovaSustavaStavovec_Default { + + private CNS cns; + private PNS pns; + + public NervovaSustavaCicavec(TypSustavy typSustavy) { + super(typSustavy); + cns = new CNS(); + pns = new PNS(); + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/Neuron.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/Neuron.java new file mode 100644 index 0000000..170949b --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/Neuron.java @@ -0,0 +1,4 @@ +package com.company.creature.stavovce.stavovcediely.sustavy.nervova; + +public class Neuron { +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/PNS.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/PNS.java new file mode 100644 index 0000000..0665080 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/nervova/PNS.java @@ -0,0 +1,9 @@ +package com.company.creature.stavovce.stavovcediely.sustavy.nervova; + +public class PNS { + private Nerv[] nervy; + + public PNS(){ + nervy = new Nerv[100]; + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/rozmnozovaciaclovek/RozmonozovaciaSustavaMuz.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/rozmnozovaciaclovek/RozmonozovaciaSustavaMuz.java new file mode 100644 index 0000000..f8c7dd9 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/rozmnozovaciaclovek/RozmonozovaciaSustavaMuz.java @@ -0,0 +1,10 @@ +package com.company.creature.stavovce.stavovcediely.sustavy.rozmnozovaciaclovek; + +import com.company.creature.stavovce.stavovcediely.sustavy.RozmnozovaciaSustavaStavovec; +import com.company.creature.stavovce.stavovcediely.sustavy.TypSustavy; + +public class RozmonozovaciaSustavaMuz extends RozmnozovaciaSustavaStavovec { + public RozmonozovaciaSustavaMuz(TypSustavy typSustavy) { + super(typSustavy); + } +} diff --git a/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/rozmnozovaciaclovek/RozmonozovaciaSustavaZena.java b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/rozmnozovaciaclovek/RozmonozovaciaSustavaZena.java new file mode 100644 index 0000000..f1c6668 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/creature/stavovce/stavovcediely/sustavy/rozmnozovaciaclovek/RozmonozovaciaSustavaZena.java @@ -0,0 +1,22 @@ +package com.company.creature.stavovce.stavovcediely.sustavy.rozmnozovaciaclovek; + +import com.company.creature.clovecina.Clovek; +import com.company.creature.stavovce.stavovcediely.sustavy.RozmnozovaciaSustavaStavovec; +import com.company.creature.stavovce.stavovcediely.sustavy.TypSustavy; + +public class RozmonozovaciaSustavaZena extends RozmnozovaciaSustavaStavovec { + + public int BabyDevelopmentProgress = 0; + + public RozmonozovaciaSustavaZena(TypSustavy typSustavy) { + super(typSustavy); + } + + public int takeAndCareBaby(Clovek plod){ + while (BabyDevelopmentProgress != 100){ + BabyDevelopmentProgress++; + } + plod.create_sustavy(); + return BabyDevelopmentProgress; + } +} diff --git a/MyFirstUniverseFinal/src/com/company/universe/Galaxy.java b/MyFirstUniverseFinal/src/com/company/universe/Galaxy.java new file mode 100644 index 0000000..ad3c1fc --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/universe/Galaxy.java @@ -0,0 +1,46 @@ +package com.company.universe; + +import com.company.cosmicbody.SolarSystem; + +public class Galaxy { + + private String name; + private SolarSystem[] systems = new SolarSystem[5000]; + private int objectCounter; + + private String message; + + public void sendMessage(Galaxy galaxy, String message){ + galaxy.setMessage(message); + System.out.println("Meassage: '" + message + "' from " + this.name + " has been send to: " + galaxy.name); + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Galaxy(String name) { + this.name = name; + this.objectCounter = 0; + System.out.println("Galaxy is: " + name + " has been created."); + } + + + + public void addSustava(SolarSystem system){ + this.systems[objectCounter] = system; + this.setObjectCounter(this.objectCounter++); + } + + public int getObjectCounter() { + return objectCounter; + } + + private void setObjectCounter(int objectCounter) { + this.objectCounter = objectCounter; + } +} diff --git a/MyFirstUniverseFinal/src/com/company/universe/PlanetaryNebula.java b/MyFirstUniverseFinal/src/com/company/universe/PlanetaryNebula.java new file mode 100644 index 0000000..88de17d --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/universe/PlanetaryNebula.java @@ -0,0 +1,28 @@ +package com.company.universe; + +public class PlanetaryNebula { + + private String name; + private long size; + private long lifeDuration; + private long x, y , z; + + public PlanetaryNebula(){ + name = "myName"; + size = 0; + lifeDuration = 0; + x = 0; y = 0; z=0; + System.out.println("Created Planetary Nebula: " + name + "Parameters: " + lifeDuration + ", " + size + ". Coordination: " + x + ", " + y + ", " + z); + } + + public PlanetaryNebula(String name,long lifeDuration, long size, long x, long y, long z) { + this.name = name; + this.lifeDuration = lifeDuration; + this.size = size; + this.x = x; + this.y = y; + this.z = z; + System.out.println("Created Planetary Nebula: " + name + "Parameters: " + lifeDuration + ", " + size + ". Coordination: " + x + ", " + y + ", " + z); + } +} + diff --git a/MyFirstUniverseFinal/src/com/company/universe/Universe.java b/MyFirstUniverseFinal/src/com/company/universe/Universe.java new file mode 100644 index 0000000..3c4a176 --- /dev/null +++ b/MyFirstUniverseFinal/src/com/company/universe/Universe.java @@ -0,0 +1,40 @@ +package com.company.universe; + +public class Universe { + private boolean state; + private long size; + + public Universe() { + state = false; + size = 0; + startUniverse(); + } + + public void startUniverse(){ + state = true; + System.out.println("World is ready"); + increaseSize(); + decreaseSize(10000); + } + + public void stopUniverse(){ + state = false; + System.out.println("World is stop"); + } + + private void increaseSize(){ + while (size<999000){ + size++; + //System.out.println("Wait. Universe " + size + "km3"); + } + System.out.println("Universe is " + size + "km3"); + } + + private void decreaseSize(long desiredSize){ + while (size > desiredSize){ + size--; + //System.out.println ("Wait. Compressed world " + size + "km3"); + } + System.out.println ("Compress world is " + size + "km3"); + } +} diff --git a/MyFirstUniverseFinal/src/tools/MessageReader.java b/MyFirstUniverseFinal/src/tools/MessageReader.java new file mode 100644 index 0000000..fc73ba1 --- /dev/null +++ b/MyFirstUniverseFinal/src/tools/MessageReader.java @@ -0,0 +1,61 @@ +package tools; + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.*; + +public class MessageReader { + private String filename; + + private File myFile; + private Scanner fileScanner; + + List lineContainer = new ArrayList(); + + private Map uniqueWords = new HashMap<>(); + + public MessageReader(){ + + } + + public void obtainFilename(String arguments[]){ +// if(arguments.length >= 1){ +// filename = arguments[0]; +// } +// else{ +// Scanner inputReader = new Scanner(System.in); +// System.out.println("Zadaj nazov suboru: "); +// +// filename = inputReader.nextLine(); +// } + filename = "MyZoznamStvoritela.txt"; + System.out.println("Subor na spracovanie " + filename); + } + + public void openAndRead(){ + try { + myFile = new File(filename); + fileScanner = new Scanner(myFile); + + while(fileScanner.hasNextLine()){ + lineContainer.add(fileScanner.nextLine()); + } + } + catch (FileNotFoundException e){ + System.out.println("Nenasiel som subor."); + e.printStackTrace(); + } + } + + public void processMessage(){ + for(int i = 0; i < lineContainer.size(); i++){ + String temp = lineContainer.get(i); + Integer count = uniqueWords.getOrDefault(temp, 0); + count += 1; + uniqueWords.put(temp, count); + } + System.out.println("Zoznam tvorov"); + uniqueWords.forEach((key, value) -> System.out.println(key + ":" + value)); + } + +} diff --git a/MyFirstUniverseFinal/src/tools/MessageWriter.java b/MyFirstUniverseFinal/src/tools/MessageWriter.java new file mode 100644 index 0000000..809ca8f --- /dev/null +++ b/MyFirstUniverseFinal/src/tools/MessageWriter.java @@ -0,0 +1,35 @@ +package tools; + +import com.company.creature.Creature; + +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; + +public class MessageWriter { + + private ArrayList arrayCreature; + private int countCreature; + + public MessageWriter(ArrayList arrayCreature){ + this.arrayCreature = arrayCreature; + this.countCreature = arrayCreature.size(); + } + + public void WriteMessage(){ + try { + FileWriter myWriter = new FileWriter("MyZoznamStvoritela.txt"); + + for(int i = 0; i < countCreature; i++){ + String creature = arrayCreature.get(i).getClass().getSimpleName(); + myWriter.write(creature + '\n'); + } + myWriter.close(); + System.out.println("Tvory ktore boli zapisane do suboru."); + } + catch (IOException e) { + System.out.println("Dakde stala chyba"); + e.printStackTrace(); + } + } +} diff --git a/MyFirstUniverseFinal/zoznamStvorenia.txt b/MyFirstUniverseFinal/zoznamStvorenia.txt new file mode 100644 index 0000000..f42ebfd --- /dev/null +++ b/MyFirstUniverseFinal/zoznamStvorenia.txt @@ -0,0 +1,70 @@ +lev +lev +lev +lev +lev +lev +slon +slon +slon +slon +slon +slon +slon +slon +had +had +had +had +velhad +velhad +velhad +velhad +velhad +velhad +velhad +velhad +velhad +velhad +velhad +velhad +opica +opica +opica +opica +bocian +opica +bocian +bocian +opica +hroch +hroch +opica +simpanz +simpanz +delfín +delfín +delfín +kapor +delfín +sleď +sleď +sleď +delfín +losos +losos +losos +losos +dinosaurusrex +dinosaurusrex +dinosaurusrex +lienka +lienka +lienka +lienka +zajac +líška +zajac +líška +zajac +líška \ No newline at end of file