parent
af79746fe9
commit
92b0c77841
@ -0,0 +1,29 @@
|
||||
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; }
|
||||
}
|
||||
Loading…
Reference in new issue