設計模式詳解

1.創建類型

1.1 簡單工廠

@startuml
' 抽象產品接口
interface Product {+ Operation(): string
}' 具體產品A
class ConcreteProductA {+ Operation(): string
}' 具體產品B
class ConcreteProductB {+ Operation(): string
}' 工廠類
class Factory {+ CreateProduct(type: string): Product
}' 關系定義
ConcreteProductA --|> Product
ConcreteProductB --|> Product
Factory --> Product: 創建 >
@enduml

代碼示例

// 產品接口
interface Shape {void draw();
}// 具體產品:圓形
class Circle implements Shape {@Overridepublic void draw() {System.out.println("繪制圓形");}
}// 具體產品:矩形
class Rectangle implements Shape {@Overridepublic void draw() {System.out.println("繪制矩形");}
}// 簡單工廠類
class ShapeFactory {// 根據類型創建不同形狀public static Shape getShape(String type) {if (type == null) {return null;}if (type.equalsIgnoreCase("CIRCLE")) {return new Circle();} else if (type.equalsIgnoreCase("RECTANGLE")) {return new Rectangle();}return null;}
}
package mainimport "fmt"// 產品接口
type Shape interface {Draw()
}// 具體產品:圓形
type Circle struct{}func (c *Circle) Draw() {fmt.Println("繪制圓形")
}// 具體產品:矩形
type Rectangle struct{}func (r *Rectangle) Draw() {fmt.Println("繪制矩形")
}// 簡單工廠
type ShapeFactory struct{}func (f *ShapeFactory) CreateShape(shapeType string) Shape {switch shapeType {case "circle":return &Circle{}case "rectangle":return &Rectangle{}default:return nil}
}

1.2 工廠方法

@startuml
interface Product {+ operation(): void
}class ConcreteProductA implements Product {+ operation(): void
}class ConcreteProductB implements Product {+ operation(): void
}interface Factory {+ createProduct(): Product
}class ConcreteFactoryA implements Factory {+ createProduct(): Product
}class ConcreteFactoryB implements Factory {+ createProduct(): Product
}Factory <|-- ConcreteFactoryA
Factory <|-- ConcreteFactoryB
Product <|-- ConcreteProductA
Product <|-- ConcreteProductB
ConcreteFactoryA --> ConcreteProductA: creates
ConcreteFactoryB --> ConcreteProductB: creates
@enduml

代碼示例

// 產品接口
interface Product {void operation();
}// 具體產品A
class ConcreteProductA implements Product {@Overridepublic void operation() {System.out.println("執行ConcreteProductA的操作");}
}// 具體產品B
class ConcreteProductB implements Product {@Overridepublic void operation() {System.out.println("執行ConcreteProductB的操作");}
}// 工廠接口
interface Factory {Product createProduct();
}// 具體工廠A,負責創建ProductA
class ConcreteFactoryA implements Factory {@Overridepublic Product createProduct() {return new ConcreteProductA();}
}// 具體工廠B,負責創建ProductB
class ConcreteFactoryB implements Factory {@Overridepublic Product createProduct() {return new ConcreteProductB();}
}// 客戶端代碼
public class FactoryMethodDemo {public static void main(String[] args) {// 使用工廠A創建產品AFactory factoryA = new ConcreteFactoryA();Product productA = factoryA.createProduct();productA.operation();// 使用工廠B創建產品BFactory factoryB = new ConcreteFactoryB();Product productB = factoryB.createProduct();productB.operation();}
}

package mainimport "fmt"// 產品接口
type Product interface {Operation()
}// 具體產品A
type ConcreteProductA struct{}func (p *ConcreteProductA) Operation() {fmt.Println("執行ConcreteProductA的操作")
}// 具體產品B
type ConcreteProductB struct{}func (p *ConcreteProductB) Operation() {fmt.Println("執行ConcreteProductB的操作")
}// 工廠接口
type Factory interface {CreateProduct() Product
}// 具體工廠A
type ConcreteFactoryA struct{}func (f *ConcreteFactoryA) CreateProduct() Product {return &ConcreteProductA{}
}// 具體工廠B
type ConcreteFactoryB struct{}func (f *ConcreteFactoryB) CreateProduct() Product {return &ConcreteProductB{}
}// 客戶端代碼
func main() {// 使用工廠A創建產品Avar factoryA Factory = &ConcreteFactoryA{}productA := factoryA.CreateProduct()productA.Operation()// 使用工廠B創建產品Bvar factoryB Factory = &ConcreteFactoryB{}productB := factoryB.CreateProduct()productB.Operation()
}

1.3 抽象工廠

@startuml
interface AbstractFactory {+ createProductA(): AbstractProductA+ createProductB(): AbstractProductB
}class ConcreteFactory1 implements AbstractFactory {+ createProductA(): AbstractProductA+ createProductB(): AbstractProductB
}class ConcreteFactory2 implements AbstractFactory {+ createProductA(): AbstractProductA+ createProductB(): AbstractProductB
}interface AbstractProductA {+ operationA(): void
}class ProductA1 implements AbstractProductA {+ operationA(): void
}class ProductA2 implements AbstractProductA {+ operationA(): void
}interface AbstractProductB {+ operationB(): void+ anotherOperationB(AbstractProductA): void
}class ProductB1 implements AbstractProductB {+ operationB(): void+ anotherOperationB(AbstractProductA): void
}class ProductB2 implements AbstractProductB {+ operationB(): void+ anotherOperationB(AbstractProductA): void
}AbstractFactory <|-- ConcreteFactory1
AbstractFactory <|-- ConcreteFactory2
AbstractProductA <|-- ProductA1
AbstractProductA <|-- ProductA2
AbstractProductB <|-- ProductB1
AbstractProductB <|-- ProductB2ConcreteFactory1 --> ProductA1: creates
ConcreteFactory1 --> ProductB1: creates
ConcreteFactory2 --> ProductA2: creates
ConcreteFactory2 --> ProductB2: creates
ProductB1 --> AbstractProductA: uses
ProductB2 --> AbstractProductA: uses
@enduml

代碼示例

// 抽象產品A
interface AbstractProductA {void operationA();
}// 具體產品A1
class ProductA1 implements AbstractProductA {@Overridepublic void operationA() {System.out.println("ProductA1的操作");}
}// 具體產品A2
class ProductA2 implements AbstractProductA {@Overridepublic void operationA() {System.out.println("ProductA2的操作");}
}// 抽象產品B
interface AbstractProductB {void operationB();void anotherOperationB(AbstractProductA productA);
}// 具體產品B1
class ProductB1 implements AbstractProductB {@Overridepublic void operationB() {System.out.println("ProductB1的操作");}@Overridepublic void anotherOperationB(AbstractProductA productA) {System.out.println("ProductB1與" + productA.getClass().getSimpleName() + "交互");}
}// 具體產品B2
class ProductB2 implements AbstractProductB {@Overridepublic void operationB() {System.out.println("ProductB2的操作");}@Overridepublic void anotherOperationB(AbstractProductA productA) {System.out.println("ProductB2與" + productA.getClass().getSimpleName() + "交互");}
}// 抽象工廠
interface AbstractFactory {AbstractProductA createProductA();AbstractProductB createProductB();
}// 具體工廠1
class ConcreteFactory1 implements AbstractFactory {@Overridepublic AbstractProductA createProductA() {return new ProductA1();}@Overridepublic AbstractProductB createProductB() {return new ProductB1();}
}// 具體工廠2
class ConcreteFactory2 implements AbstractFactory {@Overridepublic AbstractProductA createProductA() {return new ProductA2();}@Overridepublic AbstractProductB createProductB() {return new ProductB2();}
}// 客戶端代碼
public class AbstractFactoryDemo {public static void main(String[] args) {// 使用工廠1創建產品族1AbstractFactory factory1 = new ConcreteFactory1();AbstractProductA productA1 = factory1.createProductA();AbstractProductB productB1 = factory1.createProductB();productA1.operationA();productB1.operationB();productB1.anotherOperationB(productA1);// 使用工廠2創建產品族2AbstractFactory factory2 = new ConcreteFactory2();AbstractProductA productA2 = factory2.createProductA();AbstractProductB productB2 = factory2.createProductB();productA2.operationA();productB2.operationB();productB2.anotherOperationB(productA2);}
}
package mainimport "fmt"// 抽象產品A
type AbstractProductA interface {OperationA()
}// 具體產品A1
type ProductA1 struct{}func (p *ProductA1) OperationA() {fmt.Println("ProductA1的操作")
}// 具體產品A2
type ProductA2 struct{}func (p *ProductA2) OperationA() {fmt.Println("ProductA2的操作")
}// 抽象產品B
type AbstractProductB interface {OperationB()AnotherOperationB(AbstractProductA)
}// 具體產品B1
type ProductB1 struct{}func (p *ProductB1) OperationB() {fmt.Println("ProductB1的操作")
}func (p *ProductB1) AnotherOperationB(productA AbstractProductA) {fmt.Printf("ProductB1與%T交互\n", productA)
}// 具體產品B2
type ProductB2 struct{}func (p *ProductB2) OperationB() {fmt.Println("ProductB2的操作")
}func (p *ProductB2) AnotherOperationB(productA AbstractProductA) {fmt.Printf("ProductB2與%T交互\n", productA)
}// 抽象工廠
type AbstractFactory interface {CreateProductA() AbstractProductACreateProductB() AbstractProductB
}// 具體工廠1
type ConcreteFactory1 struct{}func (f *ConcreteFactory1) CreateProductA() AbstractProductA {return &ProductA1{}
}func (f *ConcreteFactory1) CreateProductB() AbstractProductB {return &ProductB1{}
}// 具體工廠2
type ConcreteFactory2 struct{}func (f *ConcreteFactory2) CreateProductA() AbstractProductA {return &ProductA2{}
}func (f *ConcreteFactory2) CreateProductB() AbstractProductB {return &ProductB2{}
}// 客戶端代碼
func main() {// 使用工廠1創建產品族1var factory1 AbstractFactory = &ConcreteFactory1{}productA1 := factory1.CreateProductA()productB1 := factory1.CreateProductB()productA1.OperationA()productB1.OperationB()productB1.AnotherOperationB(productA1)// 使用工廠2創建產品族2var factory2 AbstractFactory = &ConcreteFactory2{}productA2 := factory2.CreateProductA()productB2 := factory2.CreateProductB()productA2.OperationA()productB2.OperationB()productB2.AnotherOperationB(productA2)
}

1.4 原型模式

@startuml
interface Prototype {+ clone(): Prototype
}class ConcretePrototypeA implements Prototype {- fieldA: String+ clone(): Prototype+ setFieldA(String): void+ getFieldA(): String
}class ConcretePrototypeB implements Prototype {- fieldB: int+ clone(): Prototype+ setFieldB(int): void+ getFieldB(): int
}class Client {+ operation(): void
}Client --> Prototype: uses
@enduml

代碼示例

// 原型接口
interface Prototype {Prototype clone();
}// 具體原型A
class ConcretePrototypeA implements Prototype {private String fieldA;public ConcretePrototypeA(String fieldA) {this.fieldA = fieldA;}// 實現克隆方法@Overridepublic Prototype clone() {return new ConcretePrototypeA(this.fieldA);}public String getFieldA() {return fieldA;}public void setFieldA(String fieldA) {this.fieldA = fieldA;}
}// 具體原型B
class ConcretePrototypeB implements Prototype {private int fieldB;public ConcretePrototypeB(int fieldB) {this.fieldB = fieldB;}// 實現克隆方法@Overridepublic Prototype clone() {return new ConcretePrototypeB(this.fieldB);}public int getFieldB() {return fieldB;}public void setFieldB(int fieldB) {this.fieldB = fieldB;}
}// 客戶端代碼
public class PrototypeDemo {public static void main(String[] args) {// 創建原型實例Prototype prototypeA = new ConcretePrototypeA("初始值A");Prototype prototypeB = new ConcretePrototypeB(100);// 克隆對象Prototype cloneA = prototypeA.clone();Prototype cloneB = prototypeB.clone();// 修改克隆對象的屬性(不會影響原型)((ConcretePrototypeA) cloneA).setFieldA("修改后的值A");((ConcretePrototypeB) cloneB).setFieldB(200);// 打印結果System.out.println("原型A: " + ((ConcretePrototypeA) prototypeA).getFieldA());System.out.println("克隆A: " + ((ConcretePrototypeA) cloneA).getFieldA());System.out.println("原型B: " + ((ConcretePrototypeB) prototypeB).getFieldB());System.out.println("克隆B: " + ((ConcretePrototypeB) cloneB).getFieldB());}
}

package mainimport "fmt"// 原型接口
type Prototype interface {Clone() Prototype
}// 具體原型A
type ConcretePrototypeA struct {FieldA string
}func (c *ConcretePrototypeA) Clone() Prototype {return &ConcretePrototypeA{FieldA: c.FieldA}
}// 具體原型B
type ConcretePrototypeB struct {FieldB int
}func (c *ConcretePrototypeB) Clone() Prototype {return &ConcretePrototypeB{FieldB: c.FieldB}
}// 客戶端代碼
func main() {// 創建原型實例prototypeA := &ConcretePrototypeA{FieldA: "初始值A"}prototypeB := &ConcretePrototypeB{FieldB: 100}// 克隆對象cloneA := prototypeA.Clone().(*ConcretePrototypeA)cloneB := prototypeB.Clone().(*ConcretePrototypeB)// 修改克隆對象的屬性(不會影響原型)cloneA.FieldA = "修改后的值A"cloneB.FieldB = 200// 打印結果fmt.Printf("原型A: %s\n", prototypeA.FieldA)fmt.Printf("克隆A: %s\n", cloneA.FieldA)fmt.Printf("原型B: %d\n", prototypeB.FieldB)fmt.Printf("克隆B: %d\n", cloneB.FieldB)
}

1.5 建造者模式

@startuml
class Product {- parts: List<String>+ addPart(String): void+ show(): void
}interface Builder {+ buildPartA(): void+ buildPartB(): void+ getResult(): Product
}class ConcreteBuilder1 implements Builder {- product: Product+ buildPartA(): void+ buildPartB(): void+ getResult(): Product
}class ConcreteBuilder2 implements Builder {- product: Product+ buildPartA(): void+ buildPartB(): void+ getResult(): Product
}class Director {- builder: Builder+ setBuilder(Builder): void+ construct(): void
}Director --> Builder: uses
Builder --> Product: creates
@enduml

代碼示例

import java.util.ArrayList;
import java.util.List;// 產品類
class Product {private List<String> parts = new ArrayList<>();public void addPart(String part) {parts.add(part);}public void show() {System.out.println("產品組成:");for (String part : parts) {System.out.println("- " + part);}}
}// 建造者接口
interface Builder {void buildPartA();void buildPartB();Product getResult();
}// 具體建造者1
class ConcreteBuilder1 implements Builder {private Product product = new Product();@Overridepublic void buildPartA() {product.addPart("部件A1");}@Overridepublic void buildPartB() {product.addPart("部件B1");}@Overridepublic Product getResult() {return product;}
}// 具體建造者2
class ConcreteBuilder2 implements Builder {private Product product = new Product();@Overridepublic void buildPartA() {product.addPart("部件A2");}@Overridepublic void buildPartB() {product.addPart("部件B2");}@Overridepublic Product getResult() {return product;}
}// 指揮者
class Director {private Builder builder;public void setBuilder(Builder builder) {this.builder = builder;}public void construct() {builder.buildPartA();builder.buildPartB();}
}// 客戶端代碼
public class BuilderDemo {public static void main(String[] args) {Director director = new Director();// 使用建造者1構建產品Builder builder1 = new ConcreteBuilder1();director.setBuilder(builder1);director.construct();Product product1 = builder1.getResult();product1.show();// 使用建造者2構建產品Builder builder2 = new ConcreteBuilder2();director.setBuilder(builder2);director.construct();Product product2 = builder2.getResult();product2.show();}
}

package mainimport "fmt"// 產品類
type Product struct {parts []string
}func (p *Product) AddPart(part string) {p.parts = append(p.parts, part)
}func (p *Product) Show() {fmt.Println("產品組成:")for _, part := range p.parts {fmt.Printf("- %s\n", part)}
}// 建造者接口
type Builder interface {BuildPartA()BuildPartB()GetResult() *Product
}// 具體建造者1
type ConcreteBuilder1 struct {product *Product
}func NewConcreteBuilder1() *ConcreteBuilder1 {return &ConcreteBuilder1{product: &Product{},}
}func (b *ConcreteBuilder1) BuildPartA() {b.product.AddPart("部件A1")
}func (b *ConcreteBuilder1) BuildPartB() {b.product.AddPart("部件B1")
}func (b *ConcreteBuilder1) GetResult() *Product {return b.product
}// 具體建造者2
type ConcreteBuilder2 struct {product *Product
}func NewConcreteBuilder2() *ConcreteBuilder2 {return &ConcreteBuilder2{product: &Product{},}
}func (b *ConcreteBuilder2) BuildPartA() {b.product.AddPart("部件A2")
}func (b *ConcreteBuilder2) BuildPartB() {b.product.AddPart("部件B2")
}func (b *ConcreteBuilder2) GetResult() *Product {return b.product
}// 指揮者
type Director struct {builder Builder
}func (d *Director) SetBuilder(builder Builder) {d.builder = builder
}func (d *Director) Construct() {d.builder.BuildPartA()d.builder.BuildPartB()
}// 客戶端代碼
func main() {director := &Director{}// 使用建造者1構建產品builder1 := NewConcreteBuilder1()director.SetBuilder(builder1)director.Construct()product1 := builder1.GetResult()product1.Show()// 使用建造者2構建產品builder2 := NewConcreteBuilder2()director.SetBuilder(builder2)director.Construct()product2 := builder2.GetResult()product2.Show()
}

2.行為類型

3.結構類型

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/919933.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/919933.shtml
英文地址,請注明出處:http://en.pswp.cn/news/919933.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

前端查漏補缺

插槽默認、具名&#xff08;多個插槽&#xff09;、作用域&#xff08;接收子組件數據&#xff09;//具名 <div class"container"><header><slot name"header"></slot></header><main><slot></slot></…

網絡協議UDP、TCP

一、網絡協議 UDPUDP用戶數據報協議&#xff1a;傳輸層網絡編程模型B/S模型&#xff1a;browser/server&#xff08;瀏覽器/服務器&#xff09;客戶端是通用的客戶端&#xff08;瀏覽器&#xff09;一般只做服務器開發客戶端要加載的數據均來自服務器C/S模型&#xff1a;client…

STM32 TIM_SelectInputTrigger()函數

一、函數功能與定位?TIM_SelectInputTrigger()是STM32定時器外設的關鍵配置函數&#xff0c;用于設置從模式定時器的觸發源&#xff08;Trigger Source&#xff09;?。其核心作用是將定時器的內部事件或外部信號映射為觸發信號&#xff08;TRGI&#xff09;&#xff0c;進而控…

Lecture 6 Kernels, Triton 課程筆記

本講座&#xff1a;基準測試/分析 編寫內核 總結 編程模型&#xff08;PyTorch、Triton、PTX&#xff09;與硬件之間的差距 > 性能奧秘 理解擴展的基準測試 用于理解 PyTorch 函數內部結構的分析&#xff08;用內核觸底&#xff09; 看 PTX 匯編&#xff0c;了解 CUDA 內核…

Spring Boot 整合網易163郵箱發送郵件實現找回密碼功能

在開發用戶系統時&#xff0c;發送郵件是一項常見需求&#xff0c;例如用戶忘記密碼時&#xff0c;通過郵箱發送驗證碼來驗證身份并重置密碼。本文將結合 Spring Boot 和 163 郵箱&#xff0c;演示如何實現郵件發送功能。 一、前提條件 普通用戶的 163 郵箱可以在 Spring Boot…

如何在mac玩windows游戲?3個工具推薦,不用換電腦!

Mac電腦雖然很流暢&#xff0c;但它也存在局限性&#xff0c;其中一點游戲玩家應該深有體會&#xff0c;那就是無法直接玩Windows專屬游戲&#xff0c;只能對著琳瑯滿目的游戲望眼欲穿。別急&#xff0c;我有辦法讓你在mac玩windows游戲&#xff0c;下面就來分享我的經驗。一、…

自回歸(Auto-Regressive, AR),自回歸圖像生成過程

根據論文中“**T2I Generation via Next-Token Prediction**”一節&#xff0c;自回歸&#xff08;Auto-Regressive, AR&#xff09;文本到圖像&#xff08;T2I&#xff09;模型的圖像生成過程可分為三個主要步驟&#xff0c;其原理和損失函數如下&#xff1a;---### &#x1f…

在mysql中,modify ,change ,rename to的作用是什么

在 MySQL 中&#xff0c;MODIFY、CHANGE 和 RENAME TO 都是 ALTER TABLE 語句的一部分&#xff0c;用于修改表的結構&#xff0c;但它們的作用和使用場景有所不同。1. MODIFY作用&#xff1a;用于修改表中現有列的定義&#xff0c;但不能修改列名。你可以使用 MODIFY 來更改列的…

【JVM】JVM的內存結構是怎樣的?

JVM的內存結構是Java程序運行時內存管理的核心&#xff0c;不同區域有明確的職責。 一、整體劃分 包括兩大部分&#xff0c;分為線程私有區域(隨線程創建/銷毀&#xff0c;無需垃圾回收)和線程共享區域(所有線程共用&#xff0c;需要垃圾回收管理)。 線程私有區域&#xff1a;程…

青少年軟件編程(python五級)等級考試試卷-客觀題(2023年12月)

更多內容和歷年真題請查看網站&#xff1a;【試卷中心 -----> 電子學會 ----> 機器人技術 ----> 五級】 網站鏈接 青少年軟件編程歷年真題模擬題實時更新 青少年軟件編程&#xff08;python五級&#xff09;等級考試試卷-客觀題&#xff08;2023年12月&#xff0…

網絡編程-創建TCP協議服務器

int socket(int domain, int type, int protocol);頭文件&#xff1a; #include <sys/socket.h>#include <netinet/in.h> #include <netinet/ip.h>int skt_tcpfd;int domain;skt_tcpfdsocket(AF_INET,SOCK_STREAM,0);int bind(int sockfd, const struct soc…

ruoyi框架角色分配用戶

分配用戶&#xff0c;不要將當前正在登錄的用戶綁定。否則&#xff0c;在加入當前用戶之后&#xff0c;取消或者添加其他用戶時會被注銷當前登錄。

Java Stream常見函數與應用案例

1. Java Stream核心概念與基礎函數 1.1 Stream API的設計哲學與核心特性 Java Stream API的設計哲學源于函數式編程范式&#xff0c;其核心特性體現在數據處理模式的轉變上。與傳統集合操作相比&#xff0c;Stream API采用聲明式編程風格&#xff0c;支持鏈式調用&#xff0c;顯…

【Canvas與徽章】中國制造金色玻璃光徽章

【成圖】【代碼】<!DOCTYPE html> <html lang"utf-8"> <meta http-equiv"Content-Type" content"text/html; charsetutf-8"/> <head><title>中國制造金色玻璃光徽章 Draft1</title><style type"tex…

終結系統裸奔:Debian老舊版本安全加固終極指南

核心警示:Debian 8與10已結束官方支持,暴露于0day漏洞風險中。本文提供的加固方案僅為遷移前的臨時防護措施,非長久之計。 一、老舊Debian系統的致命隱患 支持狀態: Debian 8(Jessie):2018年終止安全更新 Debian 10(Buster):2024年7月結束主流支持 風險清單: 無補…

Ape.Volo項目源碼學習(1:源碼下載及運行)

Ape.Volo項目是基于 .Net 8 、SqlSugar、Vue2.x、RBAC、前后端分離開箱則用的中后臺快速開發框架&#xff0c;其使用Async/Await異步編程&#xff0c;支持CodeFirst模式、RabbitMQ/RedisMQ消息隊列、CORS 跨域配置、數據庫操作&#xff08;讀寫分離、多庫、分表&#xff09;、支…

2-4.Python 編碼基礎 - 流程控制(判斷語句、循環語句、break 語句與 continue 語句)

一、判斷語句 1、if 語句 &#xff08;1&#xff09;基本格式 if 【判斷條件】:【滿足條件時執行的代碼塊】&#xff08;2&#xff09;演示 number 10if number > 0:print("這個數是正數")# 輸出結果這個數是正數2、if - else 語句 &#xff08;1&#xff09;基本…

大模型自我進化框架SE-Agent:開啟軟件工程自動化新時代

一、引言&#xff1a;當大模型學會“自我進化” 在軟件開發領域&#xff0c;傳統模式下人類工程師面對復雜任務時&#xff0c;往往需要經歷反復調試、多輪迭代才能產出高質量代碼。而隨著大語言模型&#xff08;LLM&#xff09;的興起&#xff0c;一種名為**SE-Agent&#xff…

UE官方文檔學習 C++ TAarry 查詢(四)多種查詢方式

一.IndexofByKey 返回索引通過值&#xff0c;返回來查找鍵。二IndexOfByPredicate通過定義二元謂詞&#xff0c;來判定是否有符合謂詞判定的元素。符合條件True的&#xff0c;才返回Index。這里所謂Lamda,函數就是 把函數當作參數輸入&#xff0c;里面的參數值傳遞前加個[]。這…

根據Wireshark捕獲數據包時間和長度繪制電腦發射信號波形

下一期&#xff1a; 根據Wireshark捕獲數據包時間和長度繪制路由器發送給電腦數據的信號波形-CSDN博客 一、Wireshark采集數據 數據格式&#xff1a; 在我的另一篇博客中詳細介紹了怎么導出數據&#xff1a; Wireshark導出數據包時間和長度-CSDN博客 通過MATLAB加載數據&a…