责任链+sate

dev_1027
xiaoshengjie 2 years ago
parent 77222b80fc
commit 9e116a4e90

1
.idea/.gitignore vendored

@ -6,3 +6,4 @@
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
/.idea

@ -0,0 +1,11 @@
w
java:S2234"ZParameters to collider have the same names but not the same order as the method arguments.(¼˜‹Ï8õôäíÁ0
P
java:S2209"5Change this instance-reference to a static reference.(ÅùÝ¥ýÿÿÿÿ
P
java:S2209"5Change this instance-reference to a static reference.(ÅùÝ¥ýÿÿÿÿ
P
java:S2209""5Change this instance-reference to a static reference.(˜ÏÓ¦üÿÿÿÿ
P
java:S2209""5Change this instance-reference to a static reference.(˜ÏÓ¦üÿÿÿÿ

@ -1,2 +1,4 @@
t java:S120"ZRename this package name to match the regular expression '^[a-z_]+(\.[a-z_][a-z0-9_]*)*$'.(„Ùæšþÿÿÿÿ
X java:S125"<This block of commented-out lines of code should be removed.(Â<>Öä8͹ ÂÁ0
7
java:S1220""Move this file to a named package.8ι ÂÁ0

@ -0,0 +1,4 @@
X java:S125"<This block of commented-out lines of code should be removed.(<28>É“ë8äñ­âÁ0
7
java:S1220""Move this file to a named package.8äñ­âÁ0

@ -1,11 +1,4 @@
o java:S115 "ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.(´µ†£
t java:S115"ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.( §Ûàüÿÿÿÿ
<
java:S1170"!Make this final field static too.(Í¥ä›ùÿÿÿÿ
:
java:S1659"Declare "y" on a separate line.(±šß¯ùÿÿÿÿ
B
java:S1602%",Remove useless curly braces around statement(¥—ýð
Q java:S1254"<This block of commented-out lines of code should be removed.(óÆ<C3B3>Ò
V java:S125a"<This block of commented-out lines of code should be removed.(«åÀ™øÿÿÿÿ
X java:S125"<This block of commented-out lines of code should be removed.(<28>É“ë8ÉéŸÂÁ0
7
java:S1220""Move this file to a named package.8ÊéŸÂÁ0

@ -0,0 +1,3 @@
u
java:S2234"ZParameters to collider have the same names but not the same order as the method arguments.(Øåå¶ýÿÿÿÿ

@ -1,9 +1,4 @@
t java:S115"ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.(µöëæøÿÿÿÿ
t java:S115"ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.(àê°—þÿÿÿÿ
:
java:S1659"Declare "y" on a separate line.(±šß¯ùÿÿÿÿ
V java:S125#"<This block of commented-out lines of code should be removed.(Ûµ€çüÿÿÿÿ
Q java:S125'"<This block of commented-out lines of code should be removed.(Ò¸ô×
>
java:S1604"(Make this anonymous inner class a lambda(Éãî
] java:S125"<This block of commented-out lines of code should be removed.(ÿ£Ùùüÿÿÿÿ8ƒÄŸÂÁ0
7
java:S1220""Move this file to a named package.8ƒÄŸÂÁ0

@ -1,40 +1,4 @@
t java:S115"ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.(«¶ó•ûÿÿÿÿ
t java:S115"ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.(“ƒÎ³øÿÿÿÿ
K
java:S2387")"x" is the name of a field in "BaseTank".(±šß¯ùÿÿÿÿ8÷Š™˜Á0
K
java:S2387")"y" is the name of a field in "BaseTank".(±šß¯ùÿÿÿÿ8øŠ™˜Á0
O
java:S2387"-"group" is the name of a field in "BaseTank".(<28>ãîçúÿÿÿÿ8ùŠ™˜Á0
<
java:S1170"!Make this final field static too.(ñ‹œÞþÿÿÿÿ
:
java:S1659"Declare "y" on a separate line.(±šß¯ùÿÿÿÿ
W
java:S1161":Add the "@Override" annotation above this method signature(´Ç½ ˜Á0
\
java:S1161!":Add the "@Override" annotation above this method signature(ÛöϬúÿÿÿÿ8„˜Á0
] java:S125&"<This block of commented-out lines of code should be removed.(äüø©øÿÿÿÿ8¶ûŠ˜Á0
X java:S125*"<This block of commented-out lines of code should be removed.(ã…éã8½ÁŠ˜Á0
V java:S125/"<This block of commented-out lines of code should be removed.(<28>㪳ýÿÿÿÿ
> java:S1084")Either remove or fill this block of code.(<28>”ý¾
W
java:S1161B":Add the "@Override" annotation above this method signature(Äêñð8‰˜Á0
Q java:S1259"<This block of commented-out lines of code should be removed.(½·¥¯
\
java:S1161F":Add the "@Override" annotation above this method signature(<28>°¿´üÿÿÿÿ˜Á0
\
java:S1161R":Add the "@Override" annotation above this method signature(ôѽþüÿÿÿÿ˜Á0
\
java:S1161V":Add the "@Override" annotation above this method signature(‰§¸Êþÿÿÿÿ8˜Á0
S java:S106h"9Replace this use of System.out or System.err by a logger.(ɳëñýÿÿÿÿ
W java:S125 "<This block of commented-out lines of code should be removed.(¿ÿÅ<C3BF>ýÿÿÿÿ
Q
java:S2209¡"5Change this instance-reference to a static reference.(ÐÇÕ§ÿÿÿÿÿ
Q
java:S2209¢"5Change this instance-reference to a static reference.(¬öלùÿÿÿÿ
j
java:S1104"OMake dir a static final constant or non-public and provide accessors if needed.(³Ó‚ªüÿÿÿÿ
k
java:S1104"UMake tankFrame a static final constant or non-public and provide accessors if needed.(¼¹’’
X java:S125"<This block of commented-out lines of code should be removed.(<28>É“ë8ÍÿŸÂÁ0
7
java:S1220""Move this file to a named package.8ÎÿŸÂÁ0

@ -1,5 +1,3 @@
V
java:S1610 ";Convert the abstract class "BaseExplode" into an interface.(âå·ëøÿÿÿÿ
P
java:S1128"5Remove this unused import 'com.study.tank.TankFrame'.(ÒþÒšüÿÿÿÿ
java:S1610 ";Convert the abstract class "BaseExplode" into an interface.(âå·ëøÿÿÿÿ

@ -0,0 +1,3 @@
W
java:S1128"5Remove this unused import 'com.study.tank.GameModel'.(<28>ÈòÀÿÿÿÿÿ8‡ÁîíÁ0

@ -0,0 +1,4 @@
X java:S125"<This block of commented-out lines of code should be removed.(<28>É“ë8䥟ÂÁ0
7
java:S1220""Move this file to a named package.8奟ÂÁ0

@ -1,10 +0,0 @@
:
java:S1659
"Declare "y" on a separate line.(‰«¥’üÿÿÿÿ
o
java:S1104
"MMake x a static final constant or non-public and provide accessors if needed.(‰«¥’üÿÿÿÿ8‰ÉÃëÁ0
o
java:S1104
"MMake y a static final constant or non-public and provide accessors if needed.(‰«¥’üÿÿÿÿ8‰ÉÃëÁ0

@ -1,9 +0,0 @@
o java:S115"ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.(´µ†£
t java:S115"ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.( §Ûàüÿÿÿÿ
<
java:S1170"!Make this final field static too.(Í¥ä›ùÿÿÿÿ
:
java:S1659"Declare "y" on a separate line.(±šß¯ùÿÿÿÿ
B
java:S1602&",Remove useless curly braces around statement(¥—ýð

@ -0,0 +1,12 @@
Q java:S125"<This block of commented-out lines of code should be removed.(¸äˆ
P
java:S2209"5Change this instance-reference to a static reference.(¯œÿ§ùÿÿÿÿ
P
java:S2209"5Change this instance-reference to a static reference.(¯œÿ§ùÿÿÿÿ
J
java:S2209"5Change this instance-reference to a static reference.(ЙÉq
J
java:S2209"5Change this instance-reference to a static reference.(ЙÉq
B
java:S1128"%Remove this unused import 'java.awt'.(ï´µ©8<>¿îíÁ0

@ -1,8 +1,13 @@
t java:S115 "ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.(µöëæøÿÿÿÿ
t java:S115"ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.(àê°—þÿÿÿÿ
F
java:S2387"+"x" is the name of a field in "GameObject".(±šß¯ùÿÿÿÿ
F
java:S2387"+"y" is the name of a field in "GameObject".(±šß¯ùÿÿÿÿ
:
java:S1659"Declare "y" on a separate line.(±šß¯ùÿÿÿÿ
X java:S125 "<This block of commented-out lines of code should be removed.(óÆ<C3B3>Ò8…Ï<E280A6>Á0
\
java:S1128"?Remove this unused import 'com.study.tank.factory.BaseExplode'.(–¡Ú£8ܾîíÁ0
>
java:S1604"(Make this anonymous inner class a lambda(Éãî
java:S1604"(Make this anonymous inner class a lambda(Éãî

@ -0,0 +1,5 @@
|
java:S2234"ZParameters to collider have the same names but not the same order as the method arguments.(Øåå¶ýÿÿÿÿ8í³éíÁ0
O
java:S3516 "9Refactor this method to not always return the same value.(ÈâØà

@ -1,6 +1,4 @@
K
java:S2209"5Change this instance-reference to a static reference.(õ”Ž‚
P
java:S2209"5Change this instance-reference to a static reference.(€›ººýÿÿÿÿ
t java:S120"ZRename this package name to match the regular expression '^[a-z_]+(\.[a-z_][a-z0-9_]*)*$'.(„Ùæšþÿÿÿÿ
X java:S125"<This block of commented-out lines of code should be removed.(Â<>Öä8룠ÂÁ0
7
java:S1220""Move this file to a named package.8죠ÂÁ0

@ -1,5 +1,5 @@
I
java:S1602",Remove useless curly braces around statement(¥—ýð8¼ª»ðÀ0
D
java:S2189""Add an end condition to this loop.(˜ïˆžÿÿÿÿÿ8<EFBFBD>ܹðÀ0
B
java:S1602 ",Remove useless curly braces around statement(¥—ýð
=
java:S2189""Add an end condition to this loop.(˜ïˆžÿÿÿÿÿ

@ -0,0 +1,2 @@
] java:S125"<This block of commented-out lines of code should be removed.(»ž<C2BB>•ûÿÿÿÿ8ઉìÁ0

@ -1,43 +1,21 @@
>
study-tank.iml,6\9\69fcf7cf0cb84aa5f9c25dd41d8b89bcf868840a
]
-src/main/java/com/study/tank/PropertyMgr.java,f\a\fa22466dc106d781e88480a5609428c6ed1e96c2
]
-src/main/java/com/study/tank/ImageManger.java,e\3\e33fa438c138d070344c0d8500f75aa75f823e55
7
pom.xml,4\4\442292b8a7efeabbe4cc176709b833b1792140ec
h
8src/main/java/com/study/tank/cor/BulletWallCollider.java,4\d\4d2d0bdb96fe770c302998b099d5c5c4d3076bc3
Y
)src/main/java/com/study/tank/Explode.java,a\7\a7a9714ccccb1e9cd6c18c07b50adb6fb63efde1
e
5src/main/java/com/study/tank/factory/RectExplode.java,6\9\69e5f1fcaeb728725015172c220b41d4f2f3235c
e
5src/main/java/com/study/tank/factory/GameFactory.java,4\0\40f02948eb790c7986e5ecd2216cd56c8d1316c0
g
7src/main/java/com/study/tank/strategy/FireStrategy.java,e\2\e2f699d7ece4648d65d8f55bbb53b4c1a97a0134
e
5src/main/java/com/study/tank/factory/BaseExplode.java,7\3\739d9cb13e6b2724f1a0fbbf0a0a279d33a10ff3
d
4src/main/java/com/study/tank/factory/BaseBullet.java,2\9\2995ce511c59d5daf350eb58870c6c2ad9774f9c
e
5src/main/java/com/study/tank/factory/RoundBullet.java,4\a\4a5d2311ad0ce6ee7cbe87839280d9b76f3a4b04
X
(src/main/java/com/study/tank/Bullet.java,9\e\9e5a3f4cb2d4a5a75750157065729f2eb8cc0a07
b
2src/main/java/com/study/tank/factory/BaseTank.java,9\d\9d993a8181111dcdfd4f4d45ff6e01eca290e383
a
1src/main/java/com/study/tank/factory/WarTank.java,7\0\70f82ce88ac6b54afd6eed03fe6951084561b5c5
e
5src/main/java/com/study/tank/factory/RectFactory.java,4\6\469cb43b51ba7e207f3767d69d0e3deded4e3c93
Z
*src/main/java/com/study/tank/TestMain.java,f\0\f05c3638610e0ce274846e174c61431121775426
h
8src/main/java/com/study/tank/factory/DefaultFactory.java,8\a\8a8f68332c66aa57898f0442651ad801e856c9d1
s
Csrc/main/java/com/study/tank/strategy/Imp/GoodTankFireStrategy.java,1\6\1652b301de6e1dadaab20f1f8c9dcf053f3cd3a7
k
;src/main/java/com/study/tank/cor/BulletAndTankCollider.java,1\5\15585a41adf5dd34de1852b9f7a2c742bebfd282
f
6src/main/java/com/study/tank/cor/WallTankCollider.java,e\3\e3fca3d11a4f0d149adf1107cfbcef6e43898bff
r
Bsrc/main/java/com/study/tank/strategy/Imp/DefaultFireStrategy.java,e\b\ebd48d685c9a0a6dded8bb1c6d2c75c717c9c10d
W
'src/main/java/com/study/tank/Audio.java,5\b\5bd8e55a95e8e3ef2459b7d56ee9a74443b8f788
[
+src/test/java/com/study/tank/ImageTest.java,9\7\97cf6348e49d166ce567c6eb53c9d085ee3b786c
s
Csrc/main/java/com/study/tank/strategy/Imp/GoodTankFireStrategy.java,1\6\1652b301de6e1dadaab20f1f8c9dcf053f3cd3a7
Z
*src/main/java/com/study/tank/TestMain.java,f\0\f05c3638610e0ce274846e174c61431121775426
]
-src/main/java/com/study/tank/PropertyMgr.java,f\a\fa22466dc106d781e88480a5609428c6ed1e96c2
f
6src/main/java/com/study/tank/cor/TankTankCollider.java,a\0\a0ea789eb1c9abbf2e2488c4025abd4ca0248ce0
c
3src/main/java/com/study/tank/cor/ColliderChain.java,8\8\888ef4a6877adc43a62f7041567ffc1e48a68df4

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

@ -69,7 +69,6 @@ public class Bullet extends GameObject {
*
*/
public void move() {
System.out.println("bullet move");
switch (dir) {
case LEFT:
x -= speed;

@ -7,6 +7,7 @@ import com.study.tank.cor.TankTankCollider;
import com.study.tank.factory.BaseTank;
import java.awt.*;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
@ -14,7 +15,7 @@ import java.util.List;
* @author xsj
* @date 2022/10/27 14:30
*/
public class GameModel {
public class GameModel implements Serializable {
public static GameModel INSTANCE = new GameModel();
static {
@ -63,4 +64,52 @@ public class GameModel {
}
}
/**
*
*/
public void save() {
File f = new File("E:/jie/tank.data");
ObjectOutputStream oos = null;
try {
if (!f.exists()){
f.getParentFile().mkdir();//创建文件上级目录
f.createNewFile();//创建文件
}
oos = new ObjectOutputStream(new FileOutputStream(f));
oos.writeObject(GameModel.INSTANCE);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (oos != null) {
try {
oos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
/**
*
*/
public void load() {
File f = new File("E:/jie/tank.data");
ObjectInputStream ois = null;
try {
ois = new ObjectInputStream(new FileInputStream(f));
INSTANCE = (GameModel) ois.readObject();
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
} finally {
if (ois != null) {
try {
ois.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}

@ -1,12 +1,13 @@
package com.study.tank;
import java.awt.*;
import java.io.Serializable;
/**
* @author xsj
* @date 2022/10/27 14:20
*/
public abstract class GameObject {
public abstract class GameObject implements Serializable {
public int x, y;
public abstract void paint(Graphics g);

@ -77,9 +77,7 @@ public class Tank extends GameObject {
@Override
public void paint(Graphics g) {
System.out.println("tank paint:" + this.toString());
if (!living) {
System.out.println("tank remove:" + this.toString());
GameModel.INSTANCE.remove(this);
return;
}

@ -107,6 +107,12 @@ public class TankFrame extends Frame {
case KeyEvent.VK_SPACE:
GameModel.INSTANCE.myTank.fire();
break;
case KeyEvent.VK_U:
GameModel.INSTANCE.save();
break;
case KeyEvent.VK_P:
GameModel.INSTANCE.load();
break;
}
setDirMethod();
}

@ -0,0 +1,10 @@
package com.study.tank.command;
/**
* @author xsj
* @date 2022/11/1 10:08
*/
public abstract class Command {
abstract void doIt();
abstract void unDo();
}

@ -0,0 +1,38 @@
package com.study.tank.command;
import java.util.ArrayList;
import java.util.List;
/**
* @author xsj
* @date 2022/11/1 10:30
*/
public class CommandChain extends Command {
int index = 0;
List<Command> commandList = new ArrayList<>();
public CommandChain() {
Content c = new Content();
this.add(new InsertCommand(c));
this.add(new CopyCommand(c));
this.add(new DeleteCommand(c));
}
public void add(Command command) {
this.commandList.add(command);
}
@Override
void doIt() {
for (int i = 0; i < commandList.size(); i++) {
commandList.get(i).doIt();
}
}
@Override
void unDo() {
for (int i = commandList.size(); i > 0; i--) {
commandList.get(i - 1).unDo();
}
}
}

@ -0,0 +1,13 @@
package com.study.tank.command;
/**
* @author xsj
* @date 2022/11/1 10:29
*/
public class CommandMain {
public static void main(String[] args) {
CommandChain chain = new CommandChain();
chain.doIt();
chain.unDo();
}
}

@ -0,0 +1,15 @@
package com.study.tank.command;
import org.springframework.beans.BeanUtils;
/**
* @author xsj
* @date 2022/11/1 10:17
*/
public class Content {
public String msg = "请操作数据-----";
public Content() {
System.out.println("原始数据:" + msg);
}
}

@ -0,0 +1,26 @@
package com.study.tank.command;
/**
* @author xsj
* @date 2022/11/1 10:09
*/
public class CopyCommand extends Command {
Content c;
private final int index = 1;
public CopyCommand(Content c) {
this.c = c;
}
@Override
void doIt() {
c.msg = c.msg + c.msg;
System.out.println("copy新数据操作后" + c.msg);
}
@Override
void unDo() {
c.msg = c.msg.substring(0, c.msg.length() / 2);
System.out.println("取消copy新数据操作后" + c.msg);
}
}

@ -0,0 +1,29 @@
package com.study.tank.command;
/**
* @author xsj
* @date 2022/11/1 10:09
*/
public class DeleteCommand extends Command {
Content c;
String delete = "";
private final int index = 2;
public DeleteCommand(Content c) {
this.c = c;
}
@Override
void doIt() {
delete = c.msg;
c.msg = "";
System.out.println("删除新数据操作后:" + c.msg);
}
@Override
void unDo() {
c.msg = delete;
System.out.println("取消删除新数据操作后:" + c.msg);
}
}

@ -0,0 +1,28 @@
package com.study.tank.command;
/**
* @author xsj
* @date 2022/11/1 10:09
*/
public class InsertCommand extends Command {
Content c;
String sortString = "baidu.com";
private final int index = 0;
public InsertCommand(Content c) {
this.c = c;
}
@Override
void doIt() {
c.msg += sortString;
System.out.println("插入新数据操作后:" + c.msg);
}
@Override
void unDo() {
c.msg = c.msg.substring(0, c.msg.length() - sortString.length());
System.out.println("取消插入新数据操作后:"+c.msg);
}
}

@ -3,10 +3,12 @@ package com.study.tank.cor;
import com.study.tank.GameModel;
import com.study.tank.GameObject;
import java.io.Serializable;
/**
* @author xsj
* @date 2022/10/27 15:39
*/
public interface Collider {
public interface Collider extends Serializable {
boolean collider(GameObject o1, GameObject o2);
}

@ -0,0 +1,49 @@
package com.study.tank.sate;
/**
* @author xsj
* @date 2022/11/1 15:42
*/
public class Car {
private String name;
private CarSatesDict sate;
private CarSate carSate;
public Car(String name,CarSatesDict sate) {
this.name = name;
this.sate = sate;
switch (sate){
case OPEN:
this.carSate = new OpenSateCar();
break;
case CLOSED:
this.carSate = new ClosedCarSate();
break;
case RUNNING:
this.carSate = new RunCarSate();
break;
case STOP:
this.carSate = new StopCarSate();
break;
}
}
void open() {
carSate.open();
}
void closed() {
carSate.closed();
}
void running() {
carSate.running();
}
void stop() {
carSate.stop();
}
}

@ -0,0 +1,17 @@
package com.study.tank.sate;
/**
* @author xsj
* @date 2022/11/1 15:53
*/
public class CarMain {
public static void main(String[] args) {
Car car = new Car("荣威", CarSatesDict.CLOSED);
car.open();
car.closed();
car.running();
car.stop();
}
}

@ -0,0 +1,12 @@
package com.study.tank.sate;
/**
* @author xsj
* @date 2022/11/1 15:44
*/
public abstract class CarSate {
abstract void open();
abstract void closed();
abstract void running();
abstract void stop();
}

@ -0,0 +1,9 @@
package com.study.tank.sate;
/**
* @author xsj
* @date 2022/11/1 15:59
*/
public enum CarSatesDict {
OPEN,CLOSED,RUNNING,STOP
}

@ -0,0 +1,28 @@
package com.study.tank.sate;
/**
* @author xsj
* @date 2022/11/1 15:49
*/
public class ClosedCarSate extends CarSate{
@Override
void open() {
System.out.println("关门状态,可以开门-------");
}
@Override
void closed() {
System.out.println("关门状态无法closed-------");
}
@Override
void running() {
System.out.println("关门状态,可以running-------");
}
@Override
void stop() {
System.out.println("关门状态,可以stop-------");
}
}

@ -0,0 +1,28 @@
package com.study.tank.sate;
/**
* @author xsj
* @date 2022/11/1 15:47
*/
public class OpenSateCar extends CarSate{
@Override
void open() {
System.out.println("开门状态无法开门-------");
}
@Override
void closed() {
System.out.println("(当前开门)可以调用closed-------");
}
@Override
void running() {
System.out.println("开门状态无法调用running-------");
}
@Override
void stop() {
System.out.println("开门状态无法调用stop-------");
}
}

@ -0,0 +1,28 @@
package com.study.tank.sate;
/**
* @author xsj
* @date 2022/11/1 16:04
*/
public class RunCarSate extends CarSate {
@Override
void open() {
System.out.println("run状态不能open-----------");
}
@Override
void closed() {
System.out.println("run状态不能closed-----------");
}
@Override
void running() {
System.out.println("run状态不需要继续running-----------");
}
@Override
void stop() {
System.out.println("run状态可以stop-----------");
}
}

@ -0,0 +1,28 @@
package com.study.tank.sate;
/**
* @author xsj
* @date 2022/11/1 16:06
*/
public class StopCarSate extends CarSate {
@Override
void open() {
System.out.println("stop状态可以open-------");
}
@Override
void closed() {
System.out.println("stop状态不可以closed-------");
}
@Override
void running() {
System.out.println("stop状态可以running-------");
}
@Override
void stop() {
System.out.println("stop状态不需要stop-------");
}
}
Loading…
Cancel
Save