package com.gezi; import java.util.List; /** * 作者:是一个鸽子啊 * 时间:2020/06/07 */ public class BoxChoose01 extends BaseBoxChoose { /** * 装箱 * * @param fly 飞机 * @param boxList 箱子 */ public BoxChoose01(Fly fly, List<Box> boxList) { super(fly, boxList); this.root = new FlyBlock(fly.getLength(), fly.getWidth()); } /** * 给箱子安排位置 */ @Override public void fit() { //设置当前根的节点,就是第一个箱子的宽高 for (Box box : boxList) { //看看这个箱子适合放在哪里 FlyBlock flyBlock = findCarBlock(this.root, box.getLength(), box.getWidth(), box); //如果当前位置可以放这个箱子 if (flyBlock != null) { //记录当前箱子旁边剩余空间 box.setFit(splitCarBlock(flyBlock, box.getLength(), box.getWidth())); box.setFly(fly); fly.addBox(box); } } } }

lironggang LV38
2023年3月26日
最代码官方 LV168
2020年6月9日

yimaoermao LV1
2024年11月28日
Boss绝 LV9
2024年7月1日
3334004690 LV10
2024年6月22日
lironggang LV38
2023年3月26日
libing1860
2022年5月30日
暂无贡献等级
murat7
2022年5月7日
暂无贡献等级
1057148049 LV11
2022年2月8日
woaini12788 LV7
2022年1月14日
my1999 LV2
2021年12月20日
xp95323 LV15
2021年11月9日