You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
706 B
29 lines
706 B
package jinjieti1;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 图书馆主馆类
|
|
*/
|
|
public class Library {
|
|
private String libraryId; // 图书馆ID
|
|
private String name; // 图书馆名称
|
|
private List<BranchLibrary> branches; // 分馆列表
|
|
|
|
public Library(String libraryId, String name) {
|
|
this.libraryId = libraryId;
|
|
this.name = name;
|
|
this.branches = new ArrayList<>();
|
|
}
|
|
|
|
// 添加分馆
|
|
public void addBranch(BranchLibrary branch) {
|
|
if (!branches.contains(branch)) {
|
|
branches.add(branch);
|
|
}
|
|
}
|
|
|
|
// getter
|
|
public String getName() { return name; }
|
|
} |