diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 1b749e01df206e6ef0171830aab2c0f47eff4356..518fae0ed48e89d02722cbafb724b72d484918a8 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -9,20 +9,20 @@
+
-
-
+
-
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 965b7c90c81e99d62b204aeb2d281a3becf70368..189ff21ed23151bc41d1180ab129fc6a59f425e1 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,4 +1,3 @@
-
diff --git a/byv-state-patttern-16/src/main/java/com/boyunv/state/example02/TrafficLight.java b/byv-state-patttern-16/src/main/java/com/boyunv/state/example02/TrafficLight.java
new file mode 100644
index 0000000000000000000000000000000000000000..5673faa1e10b02a94b6a8d6be78f01542da2d453
--- /dev/null
+++ b/byv-state-patttern-16/src/main/java/com/boyunv/state/example02/TrafficLight.java
@@ -0,0 +1,45 @@
+package com.boyunv.state.example02;
+/*
+ *@description
+ * 交通灯类 红灯 禁 黄灯 警示 绿灯 通行
+ *@author boyunv
+ *@create 2023/8/28 22:58
+ *@version 1.0
+ */
+
+public class TrafficLight {
+ //初始化状态
+ private String state=" 红色";
+
+ //切换为绿灯,通行状态
+ public void switchToGreen(){
+ if ("绿".equals(state)){
+ System.out.println("当前为绿灯没不需要切换");
+ } else if ("红".equals(state)) {
+ System.out.println("红灯不能切换为绿灯");
+ } else if ("黄".equals(state)) {
+ state="绿";
+ System.out.println("绿灯亮起========> 时长");
+ }
+ }
+ //切换为黄灯,通行状态
+ public void switchToYellow(){
+ if ("黄".equals(state)){
+ System.out.println("当前为黄灯没不需要切换");
+ } else if ("绿".equals(state)||"红".equals(state)) {
+ state="黄";
+ System.out.println("黄灯亮起========> 时长10秒");
+ }
+ }
+ //切换为红灯,禁止状态
+ public void switchToRed (){
+ if ("红".equals(state)){
+ System.out.println("当前为红灯没不需要切换");
+ } else if ("绿".equals(state)) {
+ System.out.println("绿灯不能切换为红灯");
+ } else if ("黄".equals(state)) {
+ state="红";
+ System.out.println("红灯亮起========> 时长");
+ }
+ }
+}