【面向对象项目之图书馆管理系统】

项目需求

不同的用户有不同的菜单,然后进行操作。 

设计思路

通过需求我们可以提取图书类,书架类
图书类存放图书的基本信息,书架类存放书本及其它的数量,以及操作图书的方法等等。
接口类(用来操作书架里面的图书)-》写具体的操作实现类

其次提取出用户类,用户类分为普通用户类 管理员类

基本框架代码:

package book;
/*** @Auther: TheMyth* @Date: 2022-11-16 - 11 - 16 - 20:59* @Description: com.bookmanagement.book* @version: 1.0*/
public class Book {//书类private String name;//书名private String author;//作者private int price;//价格private String type;//类型private boolean isBorrowed;//是否被借出public Book(String name, String author, int price, String type) {//这里没构造isBorrowed是因为它的默认值是false,意味着刚开始书都是未被借出的this.name = name;this.author = author;this.price = price;this.type = type;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getAuthor() {return author;}public void setAuthor(String author) {this.author = author;}public int getPrice() {return price;}public void setPrice(int price) {this.price = price;}public String getType() {return type;}public void setType(String type) {this.type = type;}public boolean isBorrowed() {return isBorrowed;}public void setBorrowed(boolean borrowed) {isBorrowed = borrowed;}@Overridepublic String toString() {return "Book{" +"name='" + name + '\'' +", author='" + author + '\'' +", price=" + price +", type='" + type + '\'' +", isBorrowed=" + isBorrowed +'}';}
}
package book;
/*** @Auther: TheMyth* @Date: 2022-11-17 - 11 - 17 - 23:55* @Description: com.bookmanagement.book* @version: 1.0*/
public class BookList {//书架类public static final int DEFAULT_SIZE = 10;private Book[] books = new Book[DEFAULT_SIZE];private int usedSize;//当前books数组当中的数量public int getUsedSize() {return usedSize;}public void setUsedSize(int usedSize) {this.usedSize = usedSize;}
}
package operate;
import book.BookList;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:37* @Description: operate* @version: 1.0*/
public interface Ioperation {//图书的操作接口void work(BookList bookList);//操作书架类中的书数组
}
package operate;
import book.BookList;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:48* @Description: operate* @version: 1.0*/
public class AddOperation implements Ioperation {@Overridepublic void work(BookList bookList) {System.out.println("新增图书!");}
}
package operate;
import book.BookList;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:53* @Description: operate* @version: 1.0*/
public class BrrowOperation implements Ioperation {@Overridepublic void work(BookList bookList) {System.out.println("借阅图书!");}
}
package operate;
import book.BookList;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:50* @Description: operate* @version: 1.0*/
public class DeleteOperation implements Ioperation {@Overridepublic void work(BookList bookList) {System.out.println("删除图书!");}
}
package operate;
import book.BookList;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:51* @Description: operate* @version: 1.0*/
public class ExitOperation implements Ioperation {@Overridepublic void work(BookList bookList) {System.out.println("退出系统!");}
}
package operate;
import book.BookList;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:49* @Description: operate* @version: 1.0*/
public class FindOperation implements Ioperation {@Overridepublic void work(BookList bookList) {System.out.println("查找图书!");}
}
package operate;
import book.BookList;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:52* @Description: operate* @version: 1.0*/
public class ReturnOperation implements Ioperation {@Overridepublic void work(BookList bookList) {System.out.println("归还图书!");}
}
package operate;
import book.BookList;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:51* @Description: operate* @version: 1.0*/
public class ShowOperation implements Ioperation {@Overridepublic void work(BookList bookList) {System.out.println("显示图书!");}
}
package user;
import book.BookList;
import operate.Ioperation;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:34* @Description: user* @version: 1.0*/
public abstract class User {protected String name;protected Ioperation[] ioperations;//操作方法的接口数组,存放操作方法的实现类public User(String name) {this.name = name;}//因为菜单在这儿不需要具体的实现,所以将菜单定义为抽象方法,自然User也变成了抽象类public abstract int menu();//通过用户的选择,来实现不同的操作,调用接口数组里面的操作实现类的方法public void doWork(int choice, BookList bookList) {this.ioperations[choice].work(bookList);//通过接口数组下标得到具体的操作实现类,再调用操作类的方法}
}
package user;
import operate.*;
import java.util.Scanner;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:35* @Description: user* @version: 1.0*/
public class NormalUser extends User {public NormalUser(String name) {super(name);/*this.ioperations = new Ioperation[4];ioperations[0] = new ExitOperation();ioperations[1] = new FindOperation();ioperations[2] = new BrrowOperation();ioperations[3] = new ReturnOperation();*///动态初始化接口数组的变量  (接口数组存放操作的实现类)this.ioperations = new Ioperation[]{new ExitOperation(),new FindOperation(),new BrrowOperation(),new ReturnOperation()};}@Overridepublic int menu() {System.out.println("❀❀*********❀❀❀**********❀❀");System.out.println("hello🌻 " + name + " 欢迎来到图书管理系统🕌");System.out.println("         1️⃣查找图书!");System.out.println("         2️⃣借阅图书!");System.out.println("         3️⃣归还图书!");System.out.println("         0️⃣退出系统!");System.out.println("❀❀*********❀❀❀**********❀❀");System.out.println("请输入你的操作👉:");Scanner scanner = new Scanner(System.in);int choice = scanner.nextInt();return choice;}
}
package user;
import operate.*;
import java.util.Scanner;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:34* @Description: user* @version: 1.0*/
public class AdminUser extends User {public AdminUser(String name) {super(name);this.ioperations = new Ioperation[]{new ExitOperation(),new FindOperation(),new AddOperation(),new DeleteOperation(),new ShowOperation()};}@Overridepublic int menu() {//因为要根据不同的输入,做不同的操作,所以返回值用int接受System.out.println("❀❀*********❀❀❀**********❀❀");System.out.println("hello🌻 " + name + " 欢迎来到图书管理系统🕌");System.out.println("         1️⃣查找图书!");System.out.println("         2️⃣新增图书!");System.out.println("         3️⃣删除图书!");System.out.println("         4️⃣显示图书!");System.out.println("         0️⃣退出系统!");System.out.println("❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀");System.out.println("请输入你的操作👉:");Scanner scanner = new Scanner(System.in);int choice = scanner.nextInt();return choice;}
}
import book.BookList;
import user.AdminUser;
import user.NormalUser;
import user.User;
import java.util.Scanner;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 9:53* @Description: PACKAGE_NAME* @version: 1.0*/
public class Main {public static User login() {//父类当作方法的返回值,返回的是一个具体的子类对象(向上转型)Scanner scanner = new Scanner(System.in);System.out.println("请输入你的姓名:");String name = scanner.nextLine();System.out.println("请输入你的身份:1-》管理员 0-》普通用户");int choice = scanner.nextInt();if (1 == choice) {return new AdminUser(name);} else {return new NormalUser(name);}}//这是一个main方法,是程序的入口:public static void main(String[] args) {BookList bookList = new BookList();User user = login();//根据返回的不同用户,调用不同的菜单while (true) {int choice = user.menu();//接受操作数,根据操作数调用不同的操作方法//根据 choice 和 user 来确定调用哪个对象的哪个操作user.doWork(choice, bookList);}}
}

此时的框架已经搭建好了,只需要写具体操作实现类的业务逻辑。

Book类的toString方法修改:

BookList类新增getBook方法: 

ShowOperation类修改:

ExitOperation类修改: 

FindOperation类修改: 

BookList类新增setBook方法:

AddOpration类:

BookLisk类重载setBook方法:

DeleteOperation类:

 

BorrowOperation类: 

 

ReturnOperation类:

最终代码

package book;
/*** @Auther: TheMyth* @Date: 2022-11-16 - 11 - 16 - 20:59* @Description: book* @version: 1.0*/
public class Book {//书类private String name;//书名private String author;//作者private int price;//价格private String type;//类型private boolean isBorrowed;//是否被借出public Book(String name, String author, int price, String type) {//这里没构造isBorrowed是因为它的默认值是false,意味着刚开始书都是未被借出的this.name = name;this.author = author;this.price = price;this.type = type;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getAuthor() {return author;}public void setAuthor(String author) {this.author = author;}public int getPrice() {return price;}public void setPrice(int price) {this.price = price;}public String getType() {return type;}public void setType(String type) {this.type = type;}public boolean isBorrowed() {return isBorrowed;}public void setBorrowed(boolean borrowed) {isBorrowed = borrowed;}@Overridepublic String toString() {return "Book{" +"name='" + name + '\'' +", author='" + author + '\'' +", price=" + price +", type='" + type + '\'' +//", isBorrowed=" + isBorrowed +(isBorrowed == false ? " 未被借出" : " 已被借出") +'}';}
}
package book;
/*** @Auther: TheMyth* @Date: 2022-11-17 - 11 - 17 - 23:55* @Description: book* @version: 1.0*/
public class BookList {//书架类public static final int DEFAULT_SIZE = 10;private Book[] books = new Book[DEFAULT_SIZE];private int usedSize;//当前books数组当中的数量public BookList() {books[0] = new Book("数据结构", "张三", 40, "计算机类");books[1] = new Book("计算机组成原理", "李四", 45, "计算机类");books[2] = new Book("操作系统", "王五", 50, "计算机类");books[3] = new Book("计算机网络", "themyth", 35, "计算机类");books[4] = new Book("Java程序设计", "Holis", 25, "计算机类");this.usedSize = 5;}//因为存放Book类的数组是被封装的,所以要提供方法来获取书,通过下标pos得到具体的一本书public Book getBook(int pos) {return this.books[pos];//返回的是下标为pos的书}//在书架的最后一本书位置后面接着存放一本书public void setBook(Book book) {this.books[usedSize] = book;//[0, usedSize - 1]这个区间是原来每本书的下标}//在书架的指定位置增加一本书public void setBook(int pos, Book book) {this.books[pos] = book;}public int getUsedSize() {return usedSize;}public void setUsedSize(int usedSize) {this.usedSize = usedSize;}
}
package operate;
import book.BookList;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:37* @Description: operate* @version: 1.0*/
public interface Ioperation {//图书的操作接口void work(BookList bookList);//操作书架类中的书数组
}
package operate;
import book.Book;
import book.BookList;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:51* @Description: operate* @version: 1.0*/
public class ShowOperation implements Ioperation {@Overridepublic void work(BookList bookList) {System.out.println("显示图书!");int currentSize = bookList.getUsedSize();//得到书架类当前书的数量for (int i = 0; i < currentSize; i++) {//System.out.println(bookList[i]);bookList只是一个引用,不是数组Book book = bookList.getBook(i);//通过下标的变换,得到不同的书System.out.println(book);//因为这里重写了toString,可以直接打印书的详细信息}}
}
package operate;
import book.BookList;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:51* @Description: operate* @version: 1.0*/
public class ExitOperation implements Ioperation {@Overridepublic void work(BookList bookList) {System.out.println("退出系统!");System.exit(0);//退出JVM}
}
package operate;
import book.Book;
import book.BookList;
import java.util.Scanner;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:49* @Description: operate* @version: 1.0*/
public class FindOperation implements Ioperation {@Overridepublic void work(BookList bookList) {System.out.println("查找图书!");Scanner scanner = new Scanner(System.in);System.out.println("请输入你要查找的书名:");String findBookName = scanner.nextLine();int currentSize = bookList.getUsedSize();for (int i = 0; i < currentSize; i++) {Book book = bookList.getBook(i);if (findBookName.equals(book.getName())) {System.out.println("找到了这本书!");System.out.println(book);return;}}System.out.println("查无此书!");}
}
package operate;
import book.Book;
import book.BookList;
import java.util.Scanner;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:48* @Description: operate* @version: 1.0*/
public class AddOperation implements Ioperation {@Overridepublic void work(BookList bookList) {System.out.println("新增图书!");Scanner scanner = new Scanner(System.in);System.out.println("请输入书名:");String addBookName = scanner.nextLine();System.out.println("请输入作者:");String author = scanner.nextLine();System.out.println("请输入价格:");int price = scanner.nextInt();System.out.println("请输入类型:");String type = scanner.next();//注意这儿不能用nextLine(),因为会读取上面的回车符,导致不能录入类型Book book = new Book(addBookName, author, price, type);int currentSize = bookList.getUsedSize();for (int i = 0; i < currentSize; i++) {Book tmpBook = bookList.getBook(i);if (addBookName.equals(tmpBook.getName())) {System.out.println("已经有这本书了,不能存入了!");return;}}bookList.setBook(book);//修改usedSizebookList.setUsedSize(currentSize + 1);}
}
package operate;
import book.Book;
import book.BookList;
import java.util.Scanner;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:50* @Description: operate* @version: 1.0*/
public class DeleteOperation implements Ioperation {@Overridepublic void work(BookList bookList) {System.out.println("删除图书!");Scanner scanner = new Scanner(System.in);System.out.println("请输入要删除的书名:");String deleteBookName = scanner.nextLine();int index = -1;int currentSize = bookList.getUsedSize();for (int i = 0; i < currentSize; i++) {Book tmpBook = bookList.getBook(i);if (deleteBookName.equals(tmpBook.getName())) {index = i;break;}}if (index != -1) {for (int j = index; j < currentSize - 1; j++) {//j <= currentSize - 2//bookList[j] = bookList[j + 1];Book book = bookList.getBook(j + 1);bookList.setBook(j, book);}//书本数量减少一本bookList.setUsedSize(currentSize - 1);//因为删除的是对象,要把最后一个元素置为nullbookList.setBook(currentSize - 1, null);System.out.println("删除成功!");} else {System.out.println("这本书不存在,无法删除!");}}
}
package operate;
import book.Book;
import book.BookList;
import java.util.Scanner;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:53* @Description: operate* @version: 1.0*/
public class BrrowOperation implements Ioperation {@Overridepublic void work(BookList bookList) {System.out.println("借阅图书!");System.out.println("输入你要借阅的图书:");Scanner scanner = new Scanner(System.in);String borrowBookName = scanner.nextLine();int currentSize = bookList.getUsedSize();for (int i = 0; i < currentSize; i++) {Book tmpbook = bookList.getBook(i);if (borrowBookName.equals(tmpbook.getName()) && !tmpbook.isBorrowed()) {//tmpbook.isBorrowed() == falsetmpbook.setBorrowed(true);System.out.println("借阅成功!");return;}/*if (borrowBookName.equals(bookList.getBook(i).getName()) && !bookList.getBook(i).isBorrowed()) {bookList.getBook(i).setBorrowed(true);System.out.println("借阅成功!");}*/}System.out.println("没有这本书!");}
}
package operate;
import book.Book;
import book.BookList;
import java.util.Scanner;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:52* @Description: operate* @version: 1.0*/
public class ReturnOperation implements Ioperation {@Overridepublic void work(BookList bookList) {System.out.println("归还图书!");System.out.println("输入你要归还的图书:");Scanner scanner = new Scanner(System.in);String returnBookName = scanner.nextLine();int currentSize = bookList.getUsedSize();for (int i = 0; i < currentSize; i++) {Book tmpbook = bookList.getBook(i);if (returnBookName.equals(tmpbook.getName()) && tmpbook.isBorrowed()) {//tmpbook.isBorrowed() == turetmpbook.setBorrowed(false);System.out.println("归还成功!");return;}}}
}
package user;
import book.BookList;
import operate.Ioperation;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:34* @Description: user* @version: 1.0*/
public abstract class User {protected String name;protected Ioperation[] ioperations;//接口数组存放操作的实现类public User(String name) {this.name = name;}//因为菜单在这儿不需要具体的实现,所以将菜单定义为抽象方法,自然User也变成了抽象类public abstract int menu();//通过用户的选择,来实现不同的操作,调用接口数组里面的操作实现类的方法public void doWork(int choice, BookList bookList) {this.ioperations[choice].work(bookList);//通过接口数组下标得到具体的操作实现类,再调用操作类的方法}
}
package user;
import operate.*;
import java.util.Scanner;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:35* @Description: user* @version: 1.0*/
public class NormalUser extends User {public NormalUser(String name) {super(name);/*this.ioperations = new Ioperation[4];ioperations[0] = new ExitOperation();ioperations[1] = new FindOperation();ioperations[2] = new BrrowOperation();ioperations[3] = new ReturnOperation();*///动态初始化接口数组的变量  (接口数组存放操作的实现类)this.ioperations = new Ioperation[]{new ExitOperation(),new FindOperation(),new BrrowOperation(),new ReturnOperation()};}@Overridepublic int menu() {System.out.println("❀❀*********❀❀❀**********❀❀");System.out.println("hello🌻 " + name + " 欢迎来到图书管理系统🕌");System.out.println("         1️⃣查找图书!");System.out.println("         2️⃣借阅图书!");System.out.println("         3️⃣归还图书!");System.out.println("         0️⃣退出系统!");System.out.println("❀❀*********❀❀❀**********❀❀");System.out.println("请输入你的操作👉:");Scanner scanner = new Scanner(System.in);int choice = scanner.nextInt();return choice;}
}
package user;
import operate.*;
import java.util.Scanner;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 0:34* @Description: user* @version: 1.0*/
public class AdminUser extends User {public AdminUser(String name) {super(name);this.ioperations = new Ioperation[]{new ExitOperation(),new FindOperation(),new AddOperation(),new DeleteOperation(),new ShowOperation()};}@Overridepublic int menu() {//因为要根据不同的输入,做不同的操作,所以返回值用int接受System.out.println("❀❀*********❀❀❀**********❀❀");System.out.println("hello🌻 " + name + " 欢迎来到图书管理系统🕌");System.out.println("         1️⃣查找图书!");System.out.println("         2️⃣新增图书!");System.out.println("         3️⃣删除图书!");System.out.println("         4️⃣显示图书!");System.out.println("         0️⃣退出系统!");System.out.println("❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀");System.out.println("请输入你的操作👉:");Scanner scanner = new Scanner(System.in);int choice = scanner.nextInt();return choice;}
}
import book.BookList;
import user.AdminUser;
import user.NormalUser;
import user.User;
import java.util.Scanner;
/*** @Auther: TheMyth* @Date: 2022-11-18 - 11 - 18 - 9:53* @Description: PACKAGE_NAME* @version: 1.0*/
public class Main {public static User login() {//父类当作方法的返回值,返回的是一个具体的子类对象(向上转型)Scanner scanner = new Scanner(System.in);System.out.println("请输入你的姓名:");String name = scanner.nextLine();System.out.println("请输入你的身份:1-》管理员 0-》普通用户");int choice = scanner.nextInt();if (1 == choice) {return new AdminUser(name);} else {return new NormalUser(name);}}//这是一个main方法,是程序的入口:public static void main(String[] args) {BookList bookList = new BookList();User user = login();//根据返回的不同用户,调用不同的菜单while (true) {int choice = user.menu();//接受操作数,根据操作数调用不同的操作方法//根据 choice 和 user 来确定调用哪个对象的哪个操作user.doWork(choice, bookList);}}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/314389.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

LeetCode74二分搜索优化:二维矩阵中的高效查找策略

题目描述 力扣地址 给你一个满足下述两条属性的 m x n 整数矩阵&#xff1a; 每行中的整数从左到右按非严格递增顺序排列。每行的第一个整数大于前一行的最后一个整数。 给你一个整数 target &#xff0c;如果 target 在矩阵中&#xff0c;返回 true &#xff1b;否则&…

PE解释器之前期准备工作

一&#xff1a;什么是PE解释器 PE解释器通常指的是Portable Executable&#xff08;PE&#xff09;文件格式的解释器。PE是一种可执行文件和库文件的标准格式&#xff0c;主要用于32位和64位版本的Windows操作系统。PE文件包含程序的二进制代码、数据、资源以及与可执行文件相关…

RK3568平台 Android13 GKI架构开发方式

一.GKI简介 GKI&#xff1a;Generic Kernel Image 通用内核映像。 Android13 GMS和EDLA认证的一个难点是google强制要求要支持GKI。GKI通用内核映像&#xff0c;是google为了解决内核碎片化的问题&#xff0c;而设计的通过提供统一核心内核并将SoC和板级驱动从核心内核移至可加…

2024年山东省中职“网络安全”试题——B-3:Web安全之综合渗透测试

B-3&#xff1a;Web安全之综合渗透测试 服务器场景名称&#xff1a;Server2010&#xff08;关闭链接&#xff09; 服务器场景操作系统&#xff1a;"需要环境有问题加q" 使用渗透机场景Kali中的工具扫描服务器&#xff0c;通过扫描服务器得到web端口&#xff0c;登陆…

envoy在arm机器上的编译整理

版本信息&#xff1a; 操作系统:GUN Linux操作系统AARCH64架构。istio-proxy版本&#xff1a;istio-proxy1.15.2 编译环境搭建&#xff1a; 设置代理&#xff0c;确保可以访问Google等外网&#xff0c;这里envoy的第一次编译需要从外网下载依赖库。// 备注&#xff1a;这里一定…

爬虫实战-微博评论爬取

简介 最近在做NLP方面的研究&#xff0c;以前一直在做CV方面。最近由于chatgpt&#xff0c;所以对NLP就非常感兴趣。索性就开始研究起来了。 其实我们都知道&#xff0c;无论是CV方向还是NLP方向的模型实现&#xff0c;都是离不开数据的。哪怕是再先进的代码&#xff0c;都是…

深度学习|3.6 激活函数 3.7 为什么需要非线性激活函数

激活函数 主要有sigmoid函数、tanh函数、relu函数和leaky relu函数 tanh函数相比sigmoid函数是具有优势的&#xff0c;因为tanh函数使得输出值的平均值为0&#xff0c;而sigmoid函数使得输出值的平均值为1/2&#xff0c;对下一层来说tanh输出的0更好进行处理。 激活函数tanh…

Debezium发布历史40

原文地址&#xff1a; https://debezium.io/blog/2018/09/20/materializing-aggregate-views-with-hibernate-and-debezium/ 欢迎关注留言&#xff0c;我是收集整理小能手&#xff0c;工具翻译&#xff0c;仅供参考&#xff0c;笔芯笔芯. 使用 Hibernate 和 Debezium 实现聚合…

【排序算法】【二叉树】【滑动窗口】LeetCode220: 存在重复元素 III

作者推荐 【二叉树】【单调双向队列】LeetCode239:滑动窗口最大值 本文涉及的基础知识点 C算法&#xff1a;滑动窗口总结 题目 给你一个整数数组 nums 和两个整数 indexDiff 和 valueDiff 。 找出满足下述条件的下标对 (i, j)&#xff1a; i ! j, abs(i - j) < indexDi…

Vue 插槽:让你的组件更具扩展性(上)

&#x1f90d; 前端开发工程师&#xff08;主业&#xff09;、技术博主&#xff08;副业&#xff09;、已过CET6 &#x1f368; 阿珊和她的猫_CSDN个人主页 &#x1f560; 牛客高级专题作者、在牛客打造高质量专栏《前端面试必备》 &#x1f35a; 蓝桥云课签约作者、已在蓝桥云…

PiflowX组件-JDBCWrite

JDBCWrite组件 组件说明 使用JDBC驱动向任意类型的关系型数据库写入数据。 计算引擎 flink 有界性 Sink: Batch Sink: Streaming Append & Upsert Mode 组件分组 Jdbc 端口 Inport&#xff1a;默认端口 outport&#xff1a;默认端口 组件属性 名称展示名称默…

Halcon开运算opening

Halcon开运算 文章目录 Halcon开运算 开运算的计算步骤是先腐蚀&#xff0c;后膨胀。通过腐蚀运算能去除小的非关键区域&#xff0c;也可以把离得很近的元素分隔开&#xff0c;再通过膨胀填补过度腐蚀留下的空隙。因此&#xff0c;通过开运算能去除一些孤立的、细小的点&#x…