generated from jetbrains-academy/java-course-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
95 additions
and
177 deletions.
There are no files selected for viewing
30 changes: 24 additions & 6 deletions
30
...lyPullUpRefactoringPractice/src/main/java/jetbrains/refactoring/course/moving/Animal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,32 @@ | ||
package jetbrains.refactoring.course.moving; | ||
|
||
public interface Animal { | ||
public abstract class Animal { | ||
|
||
void eat(); | ||
protected final String name; | ||
protected final int age; | ||
|
||
void sleep(); | ||
public Animal(String name, int age) { | ||
this.name = name; | ||
this.age = age; | ||
} | ||
|
||
void bark(); | ||
void eat() { | ||
System.out.println(name + " is eating."); | ||
} | ||
|
||
void meow(); | ||
void sleep() { | ||
System.out.println(name + " is sleeping."); | ||
} | ||
|
||
void play(); | ||
void bark() { | ||
System.out.println(name + " is barking."); | ||
} | ||
|
||
void meow() { | ||
System.out.println(name + " is meowing."); | ||
} | ||
|
||
void play() { | ||
System.out.println(name + " is playing."); | ||
} | ||
} |
33 changes: 2 additions & 31 deletions
33
...ApplyPullUpRefactoringPractice/src/main/java/jetbrains/refactoring/course/moving/Cat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,8 @@ | ||
package jetbrains.refactoring.course.moving; | ||
|
||
public class Cat implements Animal { | ||
|
||
private final String name; | ||
private final int age; | ||
public class Cat extends Animal { | ||
|
||
public Cat(String name, int age) { | ||
this.name = name; | ||
this.age = age; | ||
} | ||
|
||
@Override | ||
public void eat() { | ||
System.out.println(name + " the cat is eating."); | ||
} | ||
|
||
@Override | ||
public void sleep() { | ||
System.out.println(name + " the cat is sleeping."); | ||
} | ||
|
||
@Override | ||
public void bark() { | ||
System.out.println(name + " the animal is barking."); | ||
} | ||
|
||
@Override | ||
public void meow() { | ||
System.out.println(name + " the animal is meowing."); | ||
} | ||
|
||
@Override | ||
public void play() { | ||
System.out.println(name + " the cat is playing."); | ||
super(name, age); | ||
} | ||
} |
33 changes: 2 additions & 31 deletions
33
...ApplyPullUpRefactoringPractice/src/main/java/jetbrains/refactoring/course/moving/Dog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,8 @@ | ||
package jetbrains.refactoring.course.moving; | ||
|
||
public class Dog implements Animal { | ||
|
||
private final String name; | ||
private final int age; | ||
public class Dog extends Animal { | ||
|
||
public Dog(String name, int age) { | ||
this.name = name; | ||
this.age = age; | ||
} | ||
|
||
@Override | ||
public void eat() { | ||
System.out.println(name + " the dog is eating."); | ||
} | ||
|
||
@Override | ||
public void sleep() { | ||
System.out.println(name + " the dog is sleeping."); | ||
} | ||
|
||
@Override | ||
public void bark() { | ||
System.out.println(name + " the dog is barking."); | ||
} | ||
|
||
@Override | ||
public void meow() { | ||
System.out.println(name + " the animal is meowing."); | ||
} | ||
|
||
@Override | ||
public void play() { | ||
System.out.println(name + " the dog is playing."); | ||
super(name, age); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 18 additions & 4 deletions
22
...PushDownRefactoringPractice/src/main/java/jetbrains/refactoring/course/moving/Animal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
package jetbrains.refactoring.course.moving; | ||
|
||
public interface Animal { | ||
public abstract class Animal { | ||
|
||
void eat(); | ||
protected final String name; | ||
protected final int age; | ||
|
||
void sleep(); | ||
public Animal(String name, int age) { | ||
this.name = name; | ||
this.age = age; | ||
} | ||
|
||
void play(); | ||
void eat() { | ||
System.out.println(name + " is eating."); | ||
} | ||
|
||
void sleep() { | ||
System.out.println(name + " is sleeping."); | ||
} | ||
|
||
void play() { | ||
System.out.println(name + " is playing."); | ||
} | ||
} |
27 changes: 4 additions & 23 deletions
27
...plyPushDownRefactoringPractice/src/main/java/jetbrains/refactoring/course/moving/Cat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,12 @@ | ||
package jetbrains.refactoring.course.moving; | ||
|
||
public class Cat implements Animal { | ||
|
||
private final String name; | ||
private final int age; | ||
public class Cat extends Animal { | ||
|
||
public Cat(String name, int age) { | ||
this.name = name; | ||
this.age = age; | ||
} | ||
|
||
@Override | ||
public void eat() { | ||
System.out.println(name + " the cat is eating."); | ||
} | ||
|
||
@Override | ||
public void sleep() { | ||
System.out.println(name + " the cat is sleeping."); | ||
} | ||
|
||
public void meow() { | ||
System.out.println(name + " the animal is meowing."); | ||
super(name, age); | ||
} | ||
|
||
@Override | ||
public void play() { | ||
System.out.println(name + " the cat is playing."); | ||
void meow() { | ||
System.out.println(name + " is meowing."); | ||
} | ||
} |
27 changes: 4 additions & 23 deletions
27
...plyPushDownRefactoringPractice/src/main/java/jetbrains/refactoring/course/moving/Dog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,12 @@ | ||
package jetbrains.refactoring.course.moving; | ||
|
||
public class Dog implements Animal { | ||
|
||
private final String name; | ||
private final int age; | ||
public class Dog extends Animal { | ||
|
||
public Dog(String name, int age) { | ||
this.name = name; | ||
this.age = age; | ||
} | ||
|
||
@Override | ||
public void eat() { | ||
System.out.println(name + " the dog is eating."); | ||
} | ||
|
||
@Override | ||
public void sleep() { | ||
System.out.println(name + " the dog is sleeping."); | ||
} | ||
|
||
public void bark() { | ||
System.out.println(name + " the dog is barking."); | ||
super(name, age); | ||
} | ||
|
||
@Override | ||
public void play() { | ||
System.out.println(name + " the dog is playing."); | ||
void bark() { | ||
System.out.println(name + " is barking."); | ||
} | ||
} |
26 changes: 21 additions & 5 deletions
26
...llUpAndPushDownRefactorings/src/main/java/jetbrains/refactoring/course/moving/Animal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
package jetbrains.refactoring.course.moving; | ||
|
||
public interface Animal { | ||
public abstract class Animal { | ||
|
||
void eat(); | ||
protected final String name; | ||
protected final int age; | ||
|
||
void sleep(); | ||
public Animal(String name, int age) { | ||
this.name = name; | ||
this.age = age; | ||
} | ||
|
||
void bark(); | ||
void eat() { | ||
System.out.println(name + " is eating."); | ||
} | ||
|
||
void meow(); | ||
void sleep() { | ||
System.out.println(name + " is sleeping."); | ||
} | ||
|
||
void bark() { | ||
System.out.println(name + " is barking."); | ||
} | ||
|
||
void meow() { | ||
System.out.println(name + " is meowing."); | ||
} | ||
} |
30 changes: 3 additions & 27 deletions
30
...ePullUpAndPushDownRefactorings/src/main/java/jetbrains/refactoring/course/moving/Cat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,12 @@ | ||
package jetbrains.refactoring.course.moving; | ||
|
||
public class Cat implements Animal { | ||
|
||
private final String name; | ||
private final int age; | ||
public class Cat extends Animal { | ||
|
||
public Cat(String name, int age) { | ||
this.name = name; | ||
this.age = age; | ||
} | ||
|
||
@Override | ||
public void eat() { | ||
System.out.println(name + " the cat is eating."); | ||
} | ||
|
||
@Override | ||
public void sleep() { | ||
System.out.println(name + " the cat is sleeping."); | ||
} | ||
|
||
@Override | ||
public void bark() { | ||
System.out.println(name + " the animal is barking."); | ||
} | ||
|
||
@Override | ||
public void meow() { | ||
System.out.println(name + " the animal is meowing."); | ||
super(name, age); | ||
} | ||
|
||
public void play() { | ||
System.out.println(name + " the cat is playing."); | ||
System.out.println(name + " is playing."); | ||
} | ||
} |
30 changes: 3 additions & 27 deletions
30
...ePullUpAndPushDownRefactorings/src/main/java/jetbrains/refactoring/course/moving/Dog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,12 @@ | ||
package jetbrains.refactoring.course.moving; | ||
|
||
public class Dog implements Animal { | ||
|
||
private final String name; | ||
private final int age; | ||
public class Dog extends Animal { | ||
|
||
public Dog(String name, int age) { | ||
this.name = name; | ||
this.age = age; | ||
} | ||
|
||
@Override | ||
public void eat() { | ||
System.out.println(name + " the dog is eating."); | ||
} | ||
|
||
@Override | ||
public void sleep() { | ||
System.out.println(name + " the dog is sleeping."); | ||
} | ||
|
||
@Override | ||
public void bark() { | ||
System.out.println(name + " the dog is barking."); | ||
} | ||
|
||
@Override | ||
public void meow() { | ||
System.out.println(name + " the animal is meowing."); | ||
super(name, age); | ||
} | ||
|
||
public void play() { | ||
System.out.println(name + " the dog is playing."); | ||
System.out.println(name + " is playing."); | ||
} | ||
} |