-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreature.java
More file actions
103 lines (103 loc) · 2.72 KB
/
Copy pathCreature.java
File metadata and controls
103 lines (103 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package lab4;
import java.util.Objects;
public class Creature {
private String name;
private int age;
private Place location;
private Facts fact;
private boolean wantToAdmire;
public Creature(){
name = "Безымянный";
age = 10;
}
public Creature(String name){
this.name = name;
age = 10;
}
public Creature(String name, int age){
this.name = name;
this.age = age;
}
public boolean getWantToAdmire() {
return wantToAdmire;
}
public void setWantToAdmire(boolean wantToAdmire) {
this.wantToAdmire = wantToAdmire;
}
public Place getLocation() {
return location;
}
public void setLocation(Place location) {
this.location = location;
System.out.println(getName() + " находится на территории " + location.getInformation() + ".");
}
public Facts getFact() {
return fact;
}
public String showFact() {
return fact.getThesis();
}
public void setFact(String object1, String object2, String relation) {
fact = new Facts(object1, object2, relation);
}
public void setFact(Entity object1, Entity object2, String relation) {
fact = new Facts(object1, object2, relation);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void setAge(int age) {
this.age = age;
}
public int getAge () {
return age;
}
public String sit() {
String s = getName() + " сидит";
return s;
}
public String realizeRelation() {
String s = getName() + " понимает, что " + getFact();
return s;
}
public String eat(FoodAndDrinks food) {
String s = getName() + " ест " + food.getInformation() + " " + this.getLocation().getSpecificPlace();
return s;
}
public String drink(FoodAndDrinks drink) {
String s = getName() + " пьет " + drink.getInformation() + " " + this.getLocation().getSpecificPlace();
return s;
}
public String say(String line) {
String s = getName() + " сказал " + line;
return s;
}
public int hashCode() {
int r = Objects.hashCode(getName());
return r;
}
public boolean equals(Object hero1) {
if (hero1 == this) {
return true;
}
if (hero1 == null || getClass() != hero1.getClass()) {
return false;
}
Creature hero2 = (Creature) hero1;
return getName() == hero2.getName();
}
public String toString() {
return getName();
}
public String admire(String object) {
String s = getName() + " любуется тем, что " + object;
return s;
}
public String disregard(String object) {
String s = getName() + " не обращает никакого внимания на то, что " + object;
return s;
}
}