gggf
This commit is contained in:
parent
f1b5195724
commit
e5ec8b4a06
8
MyFirstUniverse/.idea/.gitignore
vendored
Normal file
8
MyFirstUniverse/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
1
MyFirstUniverse/.idea/description.html
Normal file
1
MyFirstUniverse/.idea/description.html
Normal file
@ -0,0 +1 @@
|
||||
<html>Simple <b>Java</b> application that includes a class with <code>main()</code> method</html>
|
||||
7
MyFirstUniverse/.idea/discord.xml
Normal file
7
MyFirstUniverse/.idea/discord.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DiscordProjectSettings">
|
||||
<option name="show" value="ASK" />
|
||||
<option name="description" value="" />
|
||||
</component>
|
||||
</project>
|
||||
6
MyFirstUniverse/.idea/encodings.xml
Normal file
6
MyFirstUniverse/.idea/encodings.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
12
MyFirstUniverse/.idea/misc.xml
Normal file
12
MyFirstUniverse/.idea/misc.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="ProjectKey">
|
||||
<option name="state" value="project://e2804f05-5315-4fc6-a121-c522a6c26470" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_19" default="true" project-jdk-name="19" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
MyFirstUniverse/.idea/modules.xml
Normal file
8
MyFirstUniverse/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/MyFirstUniverse.iml" filepath="$PROJECT_DIR$/MyFirstUniverse.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
3
MyFirstUniverse/.idea/project-template.xml
Normal file
3
MyFirstUniverse/.idea/project-template.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<template>
|
||||
<input-field default="com.company">IJ_BASE_PACKAGE</input-field>
|
||||
</template>
|
||||
124
MyFirstUniverse/.idea/uiDesigner.xml
Normal file
124
MyFirstUniverse/.idea/uiDesigner.xml
Normal file
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
9
MyFirstUniverse/.idea/vcs.xml
Normal file
9
MyFirstUniverse/.idea/vcs.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitSharedSettings">
|
||||
<option name="synchronizeBranchProtectionRules" value="false" />
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/svet" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
11
MyFirstUniverse/MyFirstUniverse.iml
Normal file
11
MyFirstUniverse/MyFirstUniverse.iml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
MyFirstUniverse/out/production/OOP/com/company/Main.class
Normal file
BIN
MyFirstUniverse/out/production/OOP/com/company/Main.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
42
MyFirstUniverse/src/com/company/Main.java
Normal file
42
MyFirstUniverse/src/com/company/Main.java
Normal file
@ -0,0 +1,42 @@
|
||||
package com.company;
|
||||
|
||||
import com.company.cosmicbody.Planet;
|
||||
import com.company.cosmicbody.SolarSystem;
|
||||
import com.company.cosmicbody.Star;
|
||||
import com.company.universe.PlanetaryNebula;
|
||||
import com.company.universe.Universe;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Universe myuniverse = new Universe();
|
||||
myuniverse.startUniverse();
|
||||
|
||||
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);
|
||||
|
||||
Planet Mercury = new Planet("Mercury", 1333, 6083);
|
||||
Planet Venus = new Planet("Venus", 4867, 938);
|
||||
Planet Earth = new Planet("Earth", 100000, 108321);
|
||||
Planet Mars = new Planet("Mars", 641, 16318);
|
||||
Planet Jupiter = new Planet("Jupiter", 3, 71313);
|
||||
Planet Saturn = new Planet("Saturn", 1000, 108408);
|
||||
Planet Uranus = new Planet("Uranus", 1000, 202156);
|
||||
Planet Neptune = new Planet("Neptune", 7050, 620654);
|
||||
|
||||
Star sun = new Star("Sun", 1.392, 1.40927, 1499726.85);
|
||||
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);
|
||||
|
||||
|
||||
myuniverse.stopUniverse();
|
||||
}
|
||||
}
|
||||
13
MyFirstUniverse/src/com/company/cosmicbody/CosmicBody.java
Normal file
13
MyFirstUniverse/src/com/company/cosmicbody/CosmicBody.java
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
103
MyFirstUniverse/src/com/company/cosmicbody/Planet.java
Normal file
103
MyFirstUniverse/src/com/company/cosmicbody/Planet.java
Normal file
@ -0,0 +1,103 @@
|
||||
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;
|
||||
}
|
||||
|
||||
private 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 am very poor.");
|
||||
}
|
||||
}
|
||||
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);
|
||||
} else {
|
||||
decreaseGravity(0.1);
|
||||
}
|
||||
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public double getDiameter() {
|
||||
return diameter;
|
||||
}
|
||||
|
||||
private void setDiameter(double diameter) {
|
||||
this.diameter = diameter;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
private 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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// public Planet() {
|
||||
// this.name = "Zem";
|
||||
// this.weight = 5972200;
|
||||
// this.diameter = 12756;
|
||||
// }
|
||||
|
||||
}
|
||||
40
MyFirstUniverse/src/com/company/cosmicbody/SolarSystem.java
Normal file
40
MyFirstUniverse/src/com/company/cosmicbody/SolarSystem.java
Normal file
@ -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("Mars", 432432, 432432);
|
||||
objectCounter++;
|
||||
|
||||
orbitalBody[objectCounter] = new Planet("Venusa", 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;
|
||||
}
|
||||
}
|
||||
64
MyFirstUniverse/src/com/company/cosmicbody/Star.java
Normal file
64
MyFirstUniverse/src/com/company/cosmicbody/Star.java
Normal file
@ -0,0 +1,64 @@
|
||||
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;
|
||||
}
|
||||
|
||||
public Star(){
|
||||
this.name = "naname";
|
||||
this.weight = 1000^35;
|
||||
this.temperature = 500000;
|
||||
}
|
||||
|
||||
void on(){
|
||||
this.light = true;
|
||||
this.temperature = temperature + 10000;
|
||||
}
|
||||
|
||||
void off(){
|
||||
this.light = false;
|
||||
this.temperature = temperature - 1000;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
21
MyFirstUniverse/src/com/company/cosmicbody/Сomet.java
Normal file
21
MyFirstUniverse/src/com/company/cosmicbody/Сomet.java
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
28
MyFirstUniverse/src/com/company/universe/Galaxy.java
Normal file
28
MyFirstUniverse/src/com/company/universe/Galaxy.java
Normal file
@ -0,0 +1,28 @@
|
||||
package com.company.universe;
|
||||
|
||||
import com.company.cosmicbody.SolarSystem;
|
||||
|
||||
public class Galaxy {
|
||||
|
||||
private String name;
|
||||
private SolarSystem[] systems = new SolarSystem[500000000];
|
||||
private int objectCounter;
|
||||
|
||||
public Galaxy(String name) {
|
||||
this.name = name;
|
||||
this.objectCounter = 0;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.company.universe;
|
||||
|
||||
public class PlanetaryNebula {
|
||||
|
||||
private String name;
|
||||
private long size;
|
||||
private long lifeDuration;
|
||||
private long x, y , z;
|
||||
|
||||
// public PlanetaryNebula(){
|
||||
// size = 0;
|
||||
// lifeDuration = 0;
|
||||
// x = 0; y = 0; z=0;
|
||||
// }
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
39
MyFirstUniverse/src/com/company/universe/Universe.java
Normal file
39
MyFirstUniverse/src/com/company/universe/Universe.java
Normal file
@ -0,0 +1,39 @@
|
||||
package com.company.universe;
|
||||
|
||||
public class Universe {
|
||||
private boolean state;
|
||||
private long size;
|
||||
|
||||
public Universe() {
|
||||
state = false;
|
||||
size = 0;
|
||||
}
|
||||
|
||||
public void startUniverse(){
|
||||
state = true;
|
||||
System.out.println("World is ready\n");
|
||||
increaseSize();
|
||||
decreaseSize(10000);
|
||||
}
|
||||
|
||||
public void stopUniverse(){
|
||||
state = false;
|
||||
System.out.println("\nWorld 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\n");
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user