# BudgetDatabaseCheckCircularDependencyServiceImpl.java

    package cloud.wconnect.rateshop.service.budgetdatabase.impl;

    import cloud.wconnect.rateshop.cons.budgetdatabase.ClassificationCons;
    import cloud.wconnect.rateshop.cons.budgetdatabase.VariableTypeEnum;
    import cloud.wconnect.rateshop.entity.budgetdatabase.*;
    import cloud.wconnect.rateshop.service.budgetdatabase.*;
    import com.baomidou.dynamic.datasource.annotation.DS;
    import org.apache.commons.collections.CollectionUtils;
    import org.apache.commons.lang3.StringUtils;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.context.annotation.Lazy;
    import org.springframework.stereotype.Service;

    import java.util.List;
    import java.util.Objects;
    import java.util.stream.Collectors;

    /**
     *
     * @author: yyt
     * 2025-11-29
     */
    @Service
    @DS("rate_shop")
    public class BudgetDatabaseCheckCircularDependencyServiceImpl implements IBudgetDatabaseCheckCircularDependencyService {

        @Lazy
        @Autowired
        private IBudgetDatabaseConfigVariableService budgetDatabaseConfigVariableService;
        @Lazy
        @Autowired
        private IBudgetDatabaseConfigVariableRoomService budgetDatabaseConfigVariableRoomService;
        @Autowired
        private IBudgetDatabaseConfigVariableFbService budgetDatabaseConfigVariableFbService;
        @Autowired
        private IBudgetDatabaseConfigVariableOtherService budgetDatabaseConfigVariableOtherService;
        @Lazy
        @Autowired
        private IBudgetDatabaseConfigRoomTabItemService budgetDatabaseConfigRoomTabItemService;
        @Autowired
        private IBudgetDatabaseConfigFbTabItemService budgetDatabaseConfigFbTabItemService;
        @Autowired
        private IBudgetDatabaseConfigOtherTabItemService budgetDatabaseConfigOtherTabItemService;
        @Autowired
        private IBudgetDatabaseConfigRoomTabService budgetDatabaseConfigRoomTabService;
        @Autowired
        private IBudgetDatabaseConfigFbTabService budgetDatabaseConfigFbTabService;
        @Autowired
        private IBudgetDatabaseConfigOtherTabService budgetDatabaseConfigOtherTabService;

        /**
         * 检查循环依赖
         *
         * @param propertyId              资产 id
         * @param budgetYear              预算年份
         * @param budgetRevenueVariableId 预算收入变量 id
         * @param key                     标识
         * @param type                    1.revenue 2.room
         * @return 是否存在循环依赖
         * @author yyt
         * @date 2025/11/29
         **/
        @Override
        public boolean checkCircularDependency(Integer propertyId, Integer budgetYear, Integer budgetRevenueVariableId, String key, Integer type) {
            // 查询 room / fb / other 配置
            List<Integer> roomTabIds = budgetDatabaseConfigRoomTabService.list(propertyId, budgetYear)
                    .stream().map(BudgetDatabaseConfigRoomTab::getId).collect(Collectors.toList());
            List<BudgetDatabaseConfigRoomTabItem> roomTabItems = budgetDatabaseConfigRoomTabItemService.listByTabIds(roomTabIds);

            List<Integer> fbTabIds = budgetDatabaseConfigFbTabService.list(propertyId, budgetYear)
                    .stream().map(BudgetDatabaseConfigFbTab::getId).collect(Collectors.toList());
            List<BudgetDatabaseConfigFbTabItem> fbTabItems = budgetDatabaseConfigFbTabItemService.listByTabIds(fbTabIds);

            List<Integer> otherTabIds = budgetDatabaseConfigOtherTabService.list(propertyId, budgetYear)
                    .stream().map(BudgetDatabaseConfigOtherTab::getId).collect(Collectors.toList());
            List<BudgetDatabaseConfigOtherTabItem> otherTabItems = budgetDatabaseConfigOtherTabItemService.listByTabIds(otherTabIds);

            // 查询 room / fb / other 变量配置
            List<Integer> allVariableIds = budgetDatabaseConfigVariableService.list(propertyId, budgetYear)
                    .stream().map(BudgetDatabaseConfigVariable::getId).collect(Collectors.toList());
            List<BudgetDatabaseConfigVariableRoom> variableRooms = budgetDatabaseConfigVariableRoomService.listByVariableIds(allVariableIds);
            List<BudgetDatabaseConfigVariableFb> variableFbs = budgetDatabaseConfigVariableFbService.listByVariableIds(allVariableIds);
            List<BudgetDatabaseConfigVariableOther> variableOthers = budgetDatabaseConfigVariableOtherService.listByVariableIds(allVariableIds);

           return checkCircularDependency(roomTabItems, fbTabItems, otherTabItems, variableRooms, variableFbs, variableOthers, budgetRevenueVariableId, key, type);
        }

        /**
         * 检查循环依赖
         *
         * @param allRoomItems      room 配置
         * @param allFbItems        fb 配置
         * @param allOtherItems     other 配置
         * @param allVariableRooms  room 变量配置
         * @param allVariableFbs    fb 变量配置
         * @param allVariableOthers other 变量配置
         * @param variableId        变量 id
         * @param key               标识
         * @param type               1.revenue 2.room
         * @return 是否存在循环依赖
         * @author yyt
         * @date 2025/11/29
         **/
        private boolean checkCircularDependency(List<BudgetDatabaseConfigRoomTabItem> allRoomItems,
                           List<BudgetDatabaseConfigFbTabItem> allFbItems, List<BudgetDatabaseConfigOtherTabItem> allOtherItems,
                           List<BudgetDatabaseConfigVariableRoom> allVariableRooms, List<BudgetDatabaseConfigVariableFb> allVariableFbs,
                           List<BudgetDatabaseConfigVariableOther> allVariableOthers, Integer variableId, String key, Integer type) {
            // 查询当前变量配置下的指标，是否有依赖当前指标的情况
            List<BudgetDatabaseConfigVariableRoom> variableRooms = allVariableRooms.stream()
                    .filter(variableRoom -> variableRoom.getVariableId().equals(variableId))
                    .toList();
            List<BudgetDatabaseConfigVariableFb> variableFbs = allVariableFbs.stream()
                    .filter(variableFb -> variableFb.getVariableId().equals(variableId))
                    .toList();
            List<BudgetDatabaseConfigVariableOther> variableOthers = allVariableOthers.stream()
                    .filter(variableOther -> variableOther.getVariableId().equals(variableId))
                    .toList();
            if (CollectionUtils.isEmpty(variableRooms) && CollectionUtils.isEmpty(variableFbs) && CollectionUtils.isEmpty(variableOthers)) {
                return false;
            }

            if (CollectionUtils.isNotEmpty(variableRooms)) {
                List<Integer> roomIds = variableRooms.stream().map(BudgetDatabaseConfigVariableRoom::getItemId).toList();
                List<BudgetDatabaseConfigRoomTabItem> roomTabItems = allRoomItems.stream()
                        .filter(roomTabItem -> roomIds.contains(roomTabItem.getId()))
                        .toList();
                for (BudgetDatabaseConfigRoomTabItem roomTabItem : roomTabItems) {
                    String currentKey = StringUtils.joinWith(":", ClassificationCons.ROOM, roomTabItem.getId());
                    if (checkKey(currentKey, key)) {
                        return true;
                    }

                    if (Objects.equals(type, VariableTypeEnum.REVENUE.getCode())) {
                        // 若开启 revenue，则递归查询下级指标
                        if (roomTabItem.getEnableBudgetRevenue()) {
                            boolean circularDependency = checkCircularDependency(allRoomItems, allFbItems, allOtherItems, allVariableRooms, allVariableFbs, allVariableOthers,
                                    roomTabItem.getBudgetRevenueVariableId(), key, type);
                            if (circularDependency) {
                                return true;
                            }
                        }
                    } else {
                        if (roomTabItem.getEnableBudgetRoom()) {
                            boolean circularDependency = checkCircularDependency(allRoomItems, allFbItems, allOtherItems, allVariableRooms, allVariableFbs, allVariableOthers,
                                    roomTabItem.getBudgetRoomVariableId(), key, type);
                            if (circularDependency) {
                                return true;
                            }
                        }
                    }
                }
            }

            if (CollectionUtils.isNotEmpty(variableFbs)) {
                List<Integer> fbIds = variableFbs.stream().map(BudgetDatabaseConfigVariableFb::getItemId).toList();
                List<BudgetDatabaseConfigFbTabItem> fbTabItems = allFbItems.stream()
                        .filter(fbTabItem -> fbIds.contains(fbTabItem.getId()))
                        .toList();
                for (BudgetDatabaseConfigFbTabItem fbTabItem : fbTabItems) {
                    String currentKey = StringUtils.joinWith(":", ClassificationCons.FB, fbTabItem.getId());
                    if (checkKey(currentKey, key)) {
                        return true;
                    }

                    if (Objects.equals(type, VariableTypeEnum.REVENUE.getCode())) {
                        if (fbTabItem.getEnableBudgetRevenue()) {
                            boolean circularDependency = checkCircularDependency(allRoomItems, allFbItems, allOtherItems, allVariableRooms, allVariableFbs, allVariableOthers,
                                    fbTabItem.getBudgetRevenueVariableId(), key, type);
                            if (circularDependency) {
                                return true;
                            }
                        }
                    } else {
                        if (fbTabItem.getEnableBudgetRoom()) {
                            boolean circularDependency = checkCircularDependency(allRoomItems, allFbItems, allOtherItems, allVariableRooms, allVariableFbs, allVariableOthers,
                                    fbTabItem.getBudgetRoomVariableId(), key, type);
                            if (circularDependency) {
                                return true;
                            }
                        }
                    }
                }
            }
            if (CollectionUtils.isNotEmpty(variableOthers)) {
                List<Integer> otherIds = variableOthers.stream().map(BudgetDatabaseConfigVariableOther::getItemId).toList();
                List<BudgetDatabaseConfigOtherTabItem> otherTabItems = allOtherItems.stream()
                        .filter(otherTabItem -> otherIds.contains(otherTabItem.getId()))
                        .toList();
                for (BudgetDatabaseConfigOtherTabItem otherTabItem : otherTabItems) {
                    String currentKey = StringUtils.joinWith(":", ClassificationCons.OTHER, otherTabItem.getId());
                    if (checkKey(currentKey, key)) {
                        return true;
                    }

                    if (Objects.equals(type, VariableTypeEnum.REVENUE.getCode())) {
                        if (otherTabItem.getEnableBudgetRevenue()) {
                            boolean circularDependency = checkCircularDependency(allRoomItems, allFbItems, allOtherItems, allVariableRooms, allVariableFbs, allVariableOthers,
                                    otherTabItem.getBudgetRevenueVariableId(), key, type);
                            if (circularDependency) {
                                return true;
                            }
                        }
                    } else {
                        if (otherTabItem.getEnableBudgetRoom()) {
                            boolean circularDependency = checkCircularDependency(allRoomItems, allFbItems, allOtherItems, allVariableRooms, allVariableFbs, allVariableOthers,
                                    otherTabItem.getBudgetRoomVariableId(), key, type);
                            if (circularDependency) {
                                return true;
                            }
                        }
                    }
                }
            }

            return false;
        }

        /**
         * 检查 key 是否相等
         *
         * @param currentKey 当前 key
         * @param key        标识
         * @return 是否相等
         * @author yyt
         * @date 2025/11/29
         **/
        private boolean checkKey(String currentKey, String key) {
            return currentKey.equals(key);
        }

        /**
         * 检查循环依赖
         *
         * @param classification 1.room 2.fb 3.other
         * @param config         变量配置
         * @param itemIds        指标 id
         * @param type           1.revenue 2.room
         * @return 是否存在循环依赖
         * @author yyt
         * @date 2025/11/29
         **/
        @Override
        public boolean checkCircularDependencyByVariable(Integer classification, BudgetDatabaseConfigVariable config, List<Integer> itemIds, Integer type) {
            Integer variableId = config.getId();
            Integer propertyId = config.getPropertyId();
            Integer budgetYear = config.getBudgetYear();

            // 查询 room / fb / other 配置
            List<Integer> roomTabIds = budgetDatabaseConfigRoomTabService.list(propertyId, budgetYear)
                    .stream().map(BudgetDatabaseConfigRoomTab::getId).collect(Collectors.toList());
            List<BudgetDatabaseConfigRoomTabItem> roomTabItems = budgetDatabaseConfigRoomTabItemService.listByTabIds(roomTabIds);

            List<Integer> fbTabIds = budgetDatabaseConfigFbTabService.list(propertyId, budgetYear)
                    .stream().map(BudgetDatabaseConfigFbTab::getId).collect(Collectors.toList());
            List<BudgetDatabaseConfigFbTabItem> fbTabItems = budgetDatabaseConfigFbTabItemService.listByTabIds(fbTabIds);

            List<Integer> otherTabIds = budgetDatabaseConfigOtherTabService.list(propertyId, budgetYear)
                    .stream().map(BudgetDatabaseConfigOtherTab::getId).collect(Collectors.toList());
            List<BudgetDatabaseConfigOtherTabItem> otherTabItems = budgetDatabaseConfigOtherTabItemService.listByTabIds(otherTabIds);

            // 查询 room / fb / other 变量配置
            List<Integer> allVariableIds = budgetDatabaseConfigVariableService.list(propertyId, budgetYear)
                    .stream().map(BudgetDatabaseConfigVariable::getId).collect(Collectors.toList());
            List<BudgetDatabaseConfigVariableRoom> variableRooms = budgetDatabaseConfigVariableRoomService.listByVariableIds(allVariableIds);
            List<BudgetDatabaseConfigVariableFb> variableFbs = budgetDatabaseConfigVariableFbService.listByVariableIds(allVariableIds);
            List<BudgetDatabaseConfigVariableOther> variableOthers = budgetDatabaseConfigVariableOtherService.listByVariableIds(allVariableIds);

            switch (classification) {
                case ClassificationCons.ROOM -> {
                    if (Objects.equals(type, VariableTypeEnum.REVENUE.getCode())) {
                        List<BudgetDatabaseConfigRoomTabItem> enableRevenueItems = roomTabItems.stream()
                                .filter(item -> itemIds.contains(item.getId()))
                                .filter(BudgetDatabaseConfigRoomTabItem::getEnableBudgetRevenue).toList();
                        if (CollectionUtils.isEmpty(enableRevenueItems)) return false;

                        for (BudgetDatabaseConfigRoomTabItem roomTabItem : enableRevenueItems) {
                            boolean circularDependency = checkCircularDependencyByVariable(roomTabItems, fbTabItems, otherTabItems, variableRooms, variableFbs, variableOthers, roomTabItem.getBudgetRevenueVariableId(), variableId, type);
                            if (circularDependency) return true;
                        }
                    } else {
                        List<BudgetDatabaseConfigRoomTabItem> enableRoomItems = roomTabItems.stream()
                                .filter(item -> itemIds.contains(item.getId()))
                                .filter(BudgetDatabaseConfigRoomTabItem::getEnableBudgetRoom).toList();
                        if (CollectionUtils.isEmpty(enableRoomItems)) return false;

                        for (BudgetDatabaseConfigRoomTabItem roomTabItem : enableRoomItems) {
                            boolean circularDependency = checkCircularDependencyByVariable(roomTabItems, fbTabItems, otherTabItems, variableRooms, variableFbs, variableOthers, roomTabItem.getBudgetRoomVariableId(), variableId, type);
                            if (circularDependency) return true;
                        }
                    }
                }

                case ClassificationCons.FB -> {
                    if (Objects.equals(type, VariableTypeEnum.REVENUE.getCode())) {
                        List<BudgetDatabaseConfigFbTabItem> enableRevenueItems = fbTabItems.stream()
                                .filter(item -> itemIds.contains(item.getId()))
                                .filter(BudgetDatabaseConfigFbTabItem::getEnableBudgetRevenue).toList();
                        if (CollectionUtils.isEmpty(enableRevenueItems)) return false;

                        for (BudgetDatabaseConfigFbTabItem item : enableRevenueItems) {
                            boolean circularDependency = checkCircularDependencyByVariable(roomTabItems, fbTabItems, otherTabItems, variableRooms, variableFbs, variableOthers, item.getBudgetRevenueVariableId(), variableId, type);
                            if (circularDependency) return true;
                        }
                    } else {
                        List<BudgetDatabaseConfigFbTabItem> enableRoomItems = fbTabItems.stream()
                                .filter(item -> itemIds.contains(item.getId()))
                                .filter(BudgetDatabaseConfigFbTabItem::getEnableBudgetRoom).toList();
                        if (CollectionUtils.isEmpty(enableRoomItems)) return false;

                        for (BudgetDatabaseConfigFbTabItem item : enableRoomItems) {
                            boolean circularDependency = checkCircularDependencyByVariable(roomTabItems, fbTabItems, otherTabItems, variableRooms, variableFbs, variableOthers, item.getBudgetRoomVariableId(), variableId, type);
                            if (circularDependency) return true;
                        }
                    }
                }

                case ClassificationCons.OTHER -> {
                    if (Objects.equals(type, VariableTypeEnum.REVENUE.getCode())) {
                        List<BudgetDatabaseConfigOtherTabItem> enableRevenueItems = otherTabItems.stream()
                                .filter(item -> itemIds.contains(item.getId()))
                                .filter(BudgetDatabaseConfigOtherTabItem::getEnableBudgetRevenue).toList();
                        if (CollectionUtils.isEmpty(enableRevenueItems)) return false;

                        for (BudgetDatabaseConfigOtherTabItem item : enableRevenueItems) {
                            boolean circularDependency = checkCircularDependencyByVariable(roomTabItems, fbTabItems, otherTabItems, variableRooms, variableFbs, variableOthers, item.getBudgetRevenueVariableId(), variableId, type);
                            if (circularDependency) return true;
                        }
                    }
                }
            }

            return false;
        }

        /**
         * 检查循环依赖
         *
         * @param allRoomItems      room 配置
         * @param allFbItems        fb 配置
         * @param allOtherItems     other 配置
         * @param allVariableRooms  room 变量配置
         * @param allVariableFbs    fb 变量配置
         * @param allVariableOthers other 变量配置
         * @param variableId        变量 id
         * @param checkVariableId   校验变量 id
         * @param type              1.revenue 2.room
         * @return 是否存在循环依赖
         * @author yyt
         * @date 2025/11/29
         **/
        @Override
        public boolean checkCircularDependencyByVariable(List<BudgetDatabaseConfigRoomTabItem> allRoomItems, List<BudgetDatabaseConfigFbTabItem> allFbItems,
                          List<BudgetDatabaseConfigOtherTabItem> allOtherItems, List<BudgetDatabaseConfigVariableRoom> allVariableRooms,
                          List<BudgetDatabaseConfigVariableFb> allVariableFbs, List<BudgetDatabaseConfigVariableOther> allVariableOthers,
                          Integer variableId, Integer checkVariableId, Integer type) {
            // 查询当前变量配置下的指标，是否有依赖当前变量的情况
            List<BudgetDatabaseConfigVariableRoom> variableRooms = allVariableRooms.stream()
                    .filter(variableRoom -> variableRoom.getVariableId().equals(variableId))
                    .toList();
            List<BudgetDatabaseConfigVariableFb> variableFbs = allVariableFbs.stream()
                    .filter(variableFb -> variableFb.getVariableId().equals(variableId))
                    .toList();
            List<BudgetDatabaseConfigVariableOther> variableOthers = allVariableOthers.stream()
                    .filter(variableOther -> variableOther.getVariableId().equals(variableId))
                    .toList();
            if (CollectionUtils.isEmpty(variableRooms) && CollectionUtils.isEmpty(variableFbs) && CollectionUtils.isEmpty(variableOthers)) {
                return false;
            }

            if (CollectionUtils.isNotEmpty(variableRooms)) {
                List<Integer> roomIds = variableRooms.stream().map(BudgetDatabaseConfigVariableRoom::getItemId).toList();
                List<BudgetDatabaseConfigRoomTabItem> roomTabItems = allRoomItems.stream()
                        .filter(roomTabItem -> roomIds.contains(roomTabItem.getId()))
                        .toList();
                for (BudgetDatabaseConfigRoomTabItem roomTabItem : roomTabItems) {
                    if (Objects.equals(type, VariableTypeEnum.REVENUE.getCode())) {
                        if (roomTabItem.getEnableBudgetRevenue()) {
                            Integer revenueVariableId = roomTabItem.getBudgetRevenueVariableId();
                            if (checkVariableId(revenueVariableId, checkVariableId)) {
                                return true;
                            }

                            boolean circularDependency = checkCircularDependencyByVariable(allRoomItems, allFbItems, allOtherItems, allVariableRooms, allVariableFbs, allVariableOthers,
                                    revenueVariableId, checkVariableId, type);
                            if (circularDependency) return true;
                        }
                    } else {
                        if (roomTabItem.getEnableBudgetRoom()) {
                            Integer roomVariableId = roomTabItem.getBudgetRoomVariableId();
                            if (checkVariableId(roomVariableId, checkVariableId)) {
                                return true;
                            }

                            boolean circularDependency = checkCircularDependencyByVariable(allRoomItems, allFbItems, allOtherItems, allVariableRooms, allVariableFbs, allVariableOthers,
                                    roomVariableId, checkVariableId, type);
                            if (circularDependency) return true;
                        }
                    }
                }
            }

            if (CollectionUtils.isNotEmpty(variableFbs)) {
                List<Integer> fbIds = variableFbs.stream().map(BudgetDatabaseConfigVariableFb::getItemId).toList();
                List<BudgetDatabaseConfigFbTabItem> fbTabItems = allFbItems.stream()
                        .filter(fbTabItem -> fbIds.contains(fbTabItem.getId()))
                        .toList();
                for (BudgetDatabaseConfigFbTabItem fbTabItem : fbTabItems) {
                    if (Objects.equals(type, VariableTypeEnum.REVENUE.getCode())) {
                        if (fbTabItem.getEnableBudgetRevenue()) {
                            Integer revenueVariableId = fbTabItem.getBudgetRevenueVariableId();
                            if (checkVariableId(revenueVariableId, checkVariableId)) {
                                return true;
                            }

                            boolean circularDependency = checkCircularDependencyByVariable(allRoomItems, allFbItems, allOtherItems, allVariableRooms, allVariableFbs, allVariableOthers,
                                    revenueVariableId, checkVariableId, type);
                            if (circularDependency) return true;
                        }
                    } else {
                        if (fbTabItem.getEnableBudgetRoom()) {
                            Integer roomVariableId = fbTabItem.getBudgetRoomVariableId();
                            if (checkVariableId(roomVariableId, checkVariableId)) {
                                return true;
                            }

                            boolean circularDependency = checkCircularDependencyByVariable(allRoomItems, allFbItems, allOtherItems, allVariableRooms, allVariableFbs, allVariableOthers,
                                    roomVariableId, checkVariableId, type);
                            if (circularDependency) return true;
                        }
                    }
                }
            }
            if (CollectionUtils.isNotEmpty(variableOthers)) {
                List<Integer> otherIds = variableOthers.stream().map(BudgetDatabaseConfigVariableOther::getItemId).toList();
                List<BudgetDatabaseConfigOtherTabItem> otherTabItems = allOtherItems.stream()
                        .filter(otherTabItem -> otherIds.contains(otherTabItem.getId()))
                        .toList();
                for (BudgetDatabaseConfigOtherTabItem otherTabItem : otherTabItems) {
                    if (Objects.equals(type, VariableTypeEnum.REVENUE.getCode())) {
                        if (otherTabItem.getEnableBudgetRevenue()) {
                            Integer revenueVariableId = otherTabItem.getBudgetRevenueVariableId();
                            if (checkVariableId(revenueVariableId, checkVariableId)) {
                                return true;
                            }

                            boolean circularDependency = checkCircularDependencyByVariable(allRoomItems, allFbItems, allOtherItems, allVariableRooms, allVariableFbs, allVariableOthers,
                                    revenueVariableId, checkVariableId, type);
                            if (circularDependency) return true;
                        }
                    } else {
                        if (otherTabItem.getEnableBudgetRoom()) {
                            Integer roomVariableId = otherTabItem.getBudgetRoomVariableId();
                            if (checkVariableId(roomVariableId, checkVariableId)) {
                                return true;
                            }

                            boolean circularDependency = checkCircularDependencyByVariable(allRoomItems, allFbItems, allOtherItems, allVariableRooms, allVariableFbs, allVariableOthers,
                                    roomVariableId, checkVariableId, type);
                            if (circularDependency) return true;
                        }
                    }
                }
            }

            return false;
        }

        /**
         * 检查变量 id
         *
         * @param variableId      变量 id
         * @param checkVariableId 校验变量 id
         * @return 是否存在循环依赖
         * @author yyt
         * @date 2025/11/29
         **/
        private boolean checkVariableId(Integer variableId, Integer checkVariableId) {
            return variableId.equals(checkVariableId);
        }

    }