Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillShakhov committed Jul 17, 2020
0 parents commit 67b1dab
Show file tree
Hide file tree
Showing 28 changed files with 488 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Project exclude paths
/out/
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/artifacts/lab4.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/description.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/project-template.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: Main

12 changes: 12 additions & 0 deletions lab4.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?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>

42 changes: 42 additions & 0 deletions src/Act.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
public class Act {
Dots d = new Dots();
void one(){
Everything everything = new Everything("Все");


System.out.println(everything+d.dot(DotsType.SPACE)+everything.look()+d.dot(DotsType.AND)+everything.turnBack());
}
void two(){
Shadow shadow = new Shadow("тень");
shadow.addDescription("Какая-то");

Corner corner = new Corner("углу");
corner.addDescription("темном");

Wall wall = new Wall("стена", corner.getDescription(0)+d.dot(DotsType.SPACE)+corner);


System.out.println(shadow.getDescription(0)+d.dot(DotsType.SPACE)+shadow+d.dot(DotsType.SPACE)+shadow.separate(wall.whereIs()));
}
void three(){
Something something = new Something("Что-то");
something.addDescription("серое");
something.addDescription("сморщенное");
Floor floor = new Floor("пол", "гостинной");

Light light = new Light("света");
light.addDescription("солнечого");

Mustache mustache = new Mustache("усами");
mustache.addDescription("седыми");

Family family = new Family("семью муми-троллей");


System.out.println(something+d.dot(DotsType.SPACE)+something.getDescription(0)+d.dot(DotsType.AND)+something.getDescription(1)
+d.dot(DotsType.SPACE)+something.shuffled(floor+d.dot(DotsType.SPACE)+floor.whereIs())+d.dot(DotsType.COMMA)
+something.blinked(light.getDescription(0)+d.dot(DotsType.SPACE)+light)+d.dot(DotsType.AND)
+something.shake(mustache.getDescription(0)+d.dot(DotsType.SPACE)+mustache)+d.dot(DotsType.COMMA)
+something.look(family.toString())+d.dot(DotsType.DOT));
}
}
14 changes: 14 additions & 0 deletions src/Corner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import java.util.ArrayList;

public class Corner extends Thing {

public Corner(String name) {
super(name);
}

public Corner(String name, ArrayList<String> des) {
super(name, des);
}


}
9 changes: 9 additions & 0 deletions src/Dots.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
public class Dots {
public String dot(DotsType dt){
if (dt == DotsType.SPACE){return " ";}
if (dt == DotsType.AND){return " и ";}
if (dt == DotsType.COMMA){return ", ";}
if (dt == DotsType.DOT){return ".";}
else return "null";
}
}
6 changes: 6 additions & 0 deletions src/DotsType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public enum DotsType {
SPACE,
COMMA,
DOT,
AND
}
12 changes: 12 additions & 0 deletions src/Everything.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
public class Everything extends Thing {
Everything(String name){
super(name);

}
String look(){
return "посмотрели";
}
String turnBack(){
return "обернулись";
}
}
11 changes: 11 additions & 0 deletions src/Family.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import java.util.ArrayList;

public class Family extends Thing {
public Family(String name) {
super(name);
}

public Family(String name, ArrayList<String> des) {
super(name, des);
}
}
11 changes: 11 additions & 0 deletions src/Floor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public class Floor extends Place {
public Floor(String name) {
super(name);
}

public Floor(String name, String whereIs) {
super(name, whereIs);
}
}


8 changes: 8 additions & 0 deletions src/IPlace.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
public interface IPlace {
String getName();
String whereIs();

String toString();
boolean equals(Object obj);
int hashCode();
}
8 changes: 8 additions & 0 deletions src/IThing.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
public interface IThing {
String getName();
String getDescription(int i);

String toString();
boolean equals(Object pbj);
int hashCode();
}
5 changes: 5 additions & 0 deletions src/Light.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public class Light extends Thing {
public Light(String name) {
super(name);
}
}
54 changes: 54 additions & 0 deletions src/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
public class Main {
/*
Все обернулись и посмотрели. Какая-то тень отделилась от стены в темном углу.
Что-то серое и сморщенное прошаркало по полу гостиной, заморгало от солнечного света и затрясло седыми усами,
враждебно оглядывая семью муми-троллей.
*/
public static void main(String[] args) {

/*Everything everything = new Everything("Все");
Shadow shadow = new Shadow("тень");
shadow.addDescription("Какая-то");
Corner corner = new Corner("углу");
corner.addDescription("темном");
Wall wall = new Wall("стена", corner.getDescription(0)+d.dot(DotsType.SPACE)+corner);
Something something = new Something("Что-то");
something.addDescription("серое");
something.addDescription("сморщенное");
Floor floor = new Floor("пол", "гостинной");
Light light = new Light("света");
light.addDescription("солнечого");
Mustache mustache = new Mustache("усами");
mustache.addDescription("седыми");
Family family = new Family("семью муми-троллей");
Act act = new Act();
*/
/*
System.out.println(everything+d.dot(DotsType.SPACE)+everything.look()+d.dot(DotsType.AND)+everything.turnBack());
System.out.println(shadow.getDescription(0)+d.dot(DotsType.SPACE)+shadow+d.dot(DotsType.SPACE)+shadow.separate(wall.whereIs()));
System.out.println(something+d.dot(DotsType.SPACE)+something.getDescription(0)+d.dot(DotsType.AND)+something.getDescription(1)
+d.dot(DotsType.SPACE)+something.shuffled(floor+d.dot(DotsType.SPACE)+floor.whereIs())+d.dot(DotsType.COMMA)
+something.blinked(light.getDescription(0)+d.dot(DotsType.SPACE)+light)+d.dot(DotsType.AND)
+something.shake(mustache.getDescription(0)+d.dot(DotsType.SPACE)+mustache)+d.dot(DotsType.COMMA)
+something.look(family.toString())+d.dot(DotsType.DOT));
*/
Act act = new Act();
act.one();
act.two();
act.three();
}
}
Loading

0 comments on commit 67b1dab

Please sign in to comment.