Skip to content

Commit f4c4de7

Browse files
author
‘mxg133’
committed
2020-8-15
1 parent a2f9511 commit f4c4de7

36 files changed

Lines changed: 2793 additions & 16 deletions

_1DesignPattern/src/_22state/CanRaffleState.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
/**
66
* 可以抽奖的状态
7-
* @author Administrator
8-
*
97
*/
108
public class CanRaffleState extends State {
119

_1DesignPattern/src/_22state/ClientTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
/**
44
* 状态模式测试类
5-
* @author Administrator
6-
*
75
*/
86
public class ClientTest {
97

_1DesignPattern/src/_22state/DispenseOutState.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
/**
44
* 奖品发放完毕状态
55
* 说明,当我们activity 改变成 DispenseOutState, 抽奖活动结束
6-
* @author Administrator
7-
*
86
*/
97
public class DispenseOutState extends State {
108

_1DesignPattern/src/_22state/DispenseState.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
/**
44
* 发放奖品的状态
5-
* @author Administrator
6-
*
75
*/
86
public class DispenseState extends State {
97

_1DesignPattern/src/_22state/NoRaffleState.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
/**
44
* 不能抽奖状态
5-
* @author Administrator
6-
*
75
*/
86
public class NoRaffleState extends State {
97

_1DesignPattern/src/_22state/RaffleActivity.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package _22state;
22

33
/**
4-
* 抽奖活动 //
5-
*
6-
* @author Administrator
7-
*
4+
* 抽奖活动
85
*/
96
public class RaffleActivity {
107

_1DesignPattern/src/_22state/State.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
/**
44
* 状态抽象类
5-
* @author Administrator
6-
*
75
*/
86
public abstract class State {
97

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package _23strategy;
2+
3+
public class Client {
4+
5+
public static void main(String[] args) {
6+
// TODO Auto-generated method stub
7+
//测试
8+
}
9+
10+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package _23strategy;
2+
3+
public abstract class Duck {
4+
5+
public Duck() {
6+
7+
}
8+
9+
public abstract void display();//显示鸭子信息
10+
11+
public void quack() {
12+
System.out.println("鸭子嘎嘎叫~~");
13+
}
14+
15+
public void swim() {
16+
System.out.println("鸭子会游泳~~");
17+
}
18+
19+
public void fly() {
20+
System.out.println("鸭子会飞翔~~~");
21+
}
22+
23+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package _23strategy;
2+
3+
public class PekingDuck extends Duck {
4+
5+
@Override
6+
public void display() {
7+
// TODO Auto-generated method stub
8+
System.out.println("~~北京鸭~~~");
9+
}
10+
11+
//因为北京鸭不能飞翔,因此需要重写fly
12+
@Override
13+
public void fly() {
14+
// TODO Auto-generated method stub
15+
System.out.println("北京鸭不能飞翔");
16+
}
17+
18+
}

0 commit comments

Comments
 (0)