AccountChest.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:Gringotts- 作者:
/**
 * Determine whether the chest of another AccountChest would be connected to this chest.
 * @param chest another AccountChest
 * @return whether the chest of another AccountChest would be connected to this chest
 */
public boolean connected(AccountChest chest) {

    // no valid account chest anymore -> no connection
    if (! updateValid())
        return false;

    if (chestLocation().equals(chest.chestLocation()))
        return true;

    // no double chest -> no further connection possible
    if (! (inventory() instanceof DoubleChestInventory))
        return false;

    Location myLoc = chestLocation();
    for (Chest c : chest.connectedChests())
        if (c.getLocation().equals(myLoc))
            return true;

    return false;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号