package com.learning.facade;// 主菜子系统
public class MainFood implements MealSubsystem {@Override public void order() { System.out.println("点主餐");} @Override public void prepare() { System.out.println("准备主餐");} @Override public void serve() { System.out.println("端上主餐");}
}
3.甜品子系统接口
package com.learning.facade;// 甜品子系统
public class Dessert implements MealSubsystem {@Override public void order() { System.out.println("点甜品");} @Override public void prepare() { System.out.println("准备甜品");} @Override public void serve() { System.out.println("端上甜品");}
}
4.汤子系统接口
package com.learning.facade;// 汤品子系统
public class Soup implements MealSubsystem {@Override public void order() { System.out.println("点汤");} @Override public void prepare() { System.out.println("准备汤");} @Override public void serve() { System.out.println("端上汤");}
}
4.外观类服务员
package com.learning.facade;/*** 外观类 - 服务员*/
public class Waiter {private MealSubsystem mainFood;private MealSubsystem soup; private MealSubsystem dessert; public Waiter() { this.mainFood = new MainFood();this.soup = new Soup(); this.dessert = new Dessert(); } public void orderMeal() { mainFood.order();soup.order(); dessert.order(); // 假设准备和送餐是同时进行的 prepareAndServe(); } private void prepareAndServe() { mainFood.prepare();soup.prepare(); dessert.prepare(); mainFood.serve();soup.serve(); dessert.serve(); }
}
4.客户端
package com.learning.facade;// 客户端
public class Client { public static void main(String[] args) { Waiter waiter = new Waiter();// 顾客告诉服务员点餐,服务员负责处理整个点餐、准备和送餐流程waiter.orderMeal();}
}
2022 i c p c 亚洲区域赛(南京站) P r o b l e m D − 聊天程序 \Huge{2022icpc亚洲区域赛(南京站)Problem D - 聊天程序} 2022icpc亚洲区域赛(南京站)ProblemD−聊天程序 文章目录 题意思路标程 题目链接&…
Transformer解码器
import copy
from torch import nn
from norm import Norm
from multi_head_attention import MultiHeadAttention
from feed_forward import FeedForward
from pos_encoder import PositionalEncoderdef get_clones(module, N):"""Create N…
1. 安装 Element UI npm install element-plusnext
2.引入 Element UI(在main.js中引入组件,注意要引入.css文件,图标也要单独引用) import { createApp } from vueimport ElementPlus from element-plusimport element-plus/dist/index.css…