switch(command) {
            case "sellbuff":
            case "sellbuffs":
                {
                    SellBuffsManager.getInstance().sendSellMenu(activeChar);
                    break;
                }
        }

/*
 *
 * This file is part of the L2JOrg project.
 *
 */
package custom.SellBuff;

import org.l2j.gameserver.Config;
import org.l2j.gameserver.engine.item.ItemEngine;
import org.l2j.gameserver.engine.skill.api.Skill;
import org.l2j.gameserver.handler.BypassHandler;
import org.l2j.gameserver.handler.IBypassHandler;
import org.l2j.gameserver.handler.IVoicedCommandHandler;
import org.l2j.gameserver.handler.VoicedCommandHandler;
import org.l2j.gameserver.instancemanager.SellBuffsManager;
import org.l2j.gameserver.model.actor.Creature;
import org.l2j.gameserver.model.actor.Npc;
import org.l2j.gameserver.model.actor.instance.Player;
import org.l2j.gameserver.model.events.AbstractScript;
import org.l2j.gameserver.model.holders.SellBuffHolder;
import org.l2j.gameserver.model.item.ItemTemplate;
import org.l2j.gameserver.util.GameUtils;
import org.l2j.gameserver.world.World;
import java.util.StringTokenizer;
import static org.l2j.commons.util.Util.isInteger;
import static org.l2j.gameserver.util.MathUtil.isInsideRadius3D;

/**
 * Sell Buffs voice command
 * @author St3eT
 */
public class SellBuff implements IVoicedCommandHandler, IBypassHandler {

    private static final String[] VOICED_COMMANDS = { "sellbuff", "sellbuffs" };

    private static final String[] BYPASS_COMMANDS = { "sellbuffadd", "sellbuffaddskill", "sellbuffedit", "sellbuffchangeprice", "sellbuffremove", "sellbuffbuymenu", "sellbuffbuyskill", "sellbuffstart", "sellbuffstop" };

    public SellBuff() {
        if (Config.SELLBUFF_ENABLED) {
            BypassHandler.getInstance().registerHandler(this);
            VoicedCommandHandler.getInstance().registerHandler(this);
        }
    }

    @Override
    public boolean useBypass(String command, Player player, Creature target) {
        String cmd = "";
        String params = "";
        final StringTokenizer st = new StringTokenizer(command, " ");
        if (st.hasMoreTokens()) {
            cmd = st.nextToken();
        }
        while (st.hasMoreTokens()) {
            params += st.nextToken() + (st.hasMoreTokens() ? " " : "");
        }
        if (cmd.isEmpty()) {
            return false;
        }
        return useBypass(cmd, player, params);
    }

    @Override
    public boolean useVoicedCommand(String command, Player activeChar, String params) {

        return true;
    }

    public boolean useBypass(String command, Player activeChar, String params) {
        if (!Config.SELLBUFF_ENABLED) {
            return false;
        }
        switch(command) {
            case "sellbuffstart":
                {
                    if (activeChar.isSellingBuffs() || (params == null) || params.isEmpty()) {
                        return false;
                    } else if (activeChar.getSellingBuffs().isEmpty()) {
                        activeChar.sendMessage("Your list of buffs is empty, please add some buffs first!");
                        return false;
                    } else {
                        String title = "BUFF SELL: ";
                        final StringTokenizer st = new StringTokenizer(params, " ");
                        while (st.hasMoreTokens()) {
                            title += st.nextToken() + " ";
                        }
                        if (title.length() > 40) {
                            activeChar.sendMessage("Your title cannot exceed 29 characters in length. Please try again.");
                            return false;
                        }
                        SellBuffsManager.getInstance().startSellBuffs(activeChar, title);
                    }
                    break;
                }
            case "sellbuffstop":
                {
                    if (activeChar.isSellingBuffs()) {
                        SellBuffsManager.getInstance().stopSellBuffs(activeChar);
                    }
                    break;
                }
            case "sellbuffadd":
                {
                    if (!activeChar.isSellingBuffs()) {
                        int index = 0;
                        if ((params != null) && !params.isEmpty() && isInteger(params)) {
                            index = Integer.parseInt(params);
                        }
                        SellBuffsManager.getInstance().sendBuffChoiceMenu(activeChar, index);
                    }
                    break;
                }
            case "sellbuffedit":
                {
                    if (!activeChar.isSellingBuffs()) {
                        SellBuffsManager.getInstance().sendBuffEditMenu(activeChar);
                    }
                    break;
                }
            case "sellbuffchangeprice":
                {
                    if (!activeChar.isSellingBuffs() && (params != null) && !params.isEmpty()) {
                        final StringTokenizer st = new StringTokenizer(params, " ");
                        int skillId = -1;
                        int price = -1;
                        if (st.hasMoreTokens()) {
                            skillId = Integer.parseInt(st.nextToken());
                        }
                        if (st.hasMoreTokens()) {
                            try {
                                price = Integer.parseInt(st.nextToken());
                            } catch (NumberFormatException e) {
                                activeChar.sendMessage("Too big price! Maximal price is " + Config.SELLBUFF_MAX_PRICE);
                                SellBuffsManager.getInstance().sendBuffEditMenu(activeChar);
                            }
                        }
                        if ((skillId == -1) || (price == -1)) {
                            return false;
                        }
                        final Skill skillToChange = activeChar.getKnownSkill(skillId);
                        if (skillToChange == null) {
                            return false;
                        }
                        final SellBuffHolder holder = activeChar.getSellingBuffs().stream().filter(h -> (h.getSkillId() == skillToChange.getId())).findFirst().orElse(null);
                        if ((holder != null)) {
                            activeChar.sendMessage("Price of " + activeChar.getKnownSkill(holder.getSkillId()).getName() + " has been changed to " + price + "!");
                            holder.setPrice(price);
                            SellBuffsManager.getInstance().sendBuffEditMenu(activeChar);
                        }
                    }
                    break;
                }
            case "sellbuffremove":
                {
                    if (!activeChar.isSellingBuffs() && (params != null) && !params.isEmpty()) {
                        final StringTokenizer st = new StringTokenizer(params, " ");
                        int skillId = -1;
                        if (st.hasMoreTokens()) {
                            skillId = Integer.parseInt(st.nextToken());
                        }
                        if ((skillId == -1)) {
                            return false;
                        }
                        final Skill skillToRemove = activeChar.getKnownSkill(skillId);
                        if (skillToRemove == null) {
                            return false;
                        }
                        final SellBuffHolder holder = activeChar.getSellingBuffs().stream().filter(h -> (h.getSkillId() == skillToRemove.getId())).findFirst().orElse(null);
                        if ((holder != null) && activeChar.getSellingBuffs().remove(holder)) {
                            activeChar.sendMessage("Skill " + activeChar.getKnownSkill(holder.getSkillId()).getName() + " has been removed!");
                            SellBuffsManager.getInstance().sendBuffEditMenu(activeChar);
                        }
                    }
                    break;
                }
            case "sellbuffaddskill":
                {
                    if (!activeChar.isSellingBuffs() && (params != null) && !params.isEmpty()) {
                        final StringTokenizer st = new StringTokenizer(params, " ");
                        int skillId = -1;
                        long price = -1;
                        if (st.hasMoreTokens()) {
                            skillId = Integer.parseInt(st.nextToken());
                        }
                        if (st.hasMoreTokens()) {
                            try {
                                price = Integer.parseInt(st.nextToken());
                            } catch (NumberFormatException e) {
                                activeChar.sendMessage("Too big price! Maximal price is " + Config.SELLBUFF_MIN_PRICE);
                                SellBuffsManager.getInstance().sendBuffEditMenu(activeChar);
                            }
                        }
                        if ((skillId == -1) || (price == -1)) {
                            return false;
                        }
                        final Skill skillToAdd = activeChar.getKnownSkill(skillId);
                        if (skillToAdd == null) {
                            return false;
                        } else if (price < Config.SELLBUFF_MIN_PRICE) {
                            activeChar.sendMessage("Too small price! Minimal price is " + Config.SELLBUFF_MIN_PRICE);
                            return false;
                        } else if (price > Config.SELLBUFF_MAX_PRICE) {
                            activeChar.sendMessage("Too big price! Maximal price is " + Config.SELLBUFF_MAX_PRICE);
                            return false;
                        } else if (activeChar.getSellingBuffs().size() >= Config.SELLBUFF_MAX_BUFFS) {
                            activeChar.sendMessage("You already reached max count of buffs! Max buffs is: " + Config.SELLBUFF_MAX_BUFFS);
                            return false;
                        } else if (!SellBuffsManager.getInstance().isInSellList(activeChar, skillToAdd)) {
                            activeChar.getSellingBuffs().add(new SellBuffHolder(skillToAdd.getId(), price));
                            activeChar.sendMessage(skillToAdd.getName() + " has been added!");
                            SellBuffsManager.getInstance().sendBuffChoiceMenu(activeChar, 0);
                        }
                    }
                    break;
                }
            case "sellbuffbuymenu":
                {
                    if ((params != null) && !params.isEmpty()) {
                        final StringTokenizer st = new StringTokenizer(params, " ");
                        int objId = -1;
                        int index = 0;
                        if (st.hasMoreTokens()) {
                            objId = Integer.parseInt(st.nextToken());
                        }
                        if (st.hasMoreTokens()) {
                            index = Integer.parseInt(st.nextToken());
                        }
                        final Player seller = World.getInstance().findPlayer(objId);
                        if (seller != null) {
                            if (!seller.isSellingBuffs() || !isInsideRadius3D(activeChar, seller, Npc.INTERACTION_DISTANCE)) {
                                return false;
                            }
                            SellBuffsManager.getInstance().sendBuffMenu(activeChar, seller, index);
                        }
                    }
                    break;
                }
            case "sellbuffbuyskill":
                {
                    if ((params != null) && !params.isEmpty()) {
                        final StringTokenizer st = new StringTokenizer(params, " ");
                        int objId = -1;
                        int skillId = -1;
                        int index = 0;
                        if (st.hasMoreTokens()) {
                            objId = Integer.parseInt(st.nextToken());
                        }
                        if (st.hasMoreTokens()) {
                            skillId = Integer.parseInt(st.nextToken());
                        }
                        if (st.hasMoreTokens()) {
                            index = Integer.parseInt(st.nextToken());
                        }
                        if ((skillId == -1) || (objId == -1)) {
                            return false;
                        }
                        final Player seller = World.getInstance().findPlayer(objId);
                        if (seller == null) {
                            return false;
                        }
                        final Skill skillToBuy = seller.getKnownSkill(skillId);
                        if (!seller.isSellingBuffs() || !GameUtils.checkIfInRange(Npc.INTERACTION_DISTANCE, activeChar, seller, true) || (skillToBuy == null)) {
                            return false;
                        }
                        if (seller.getCurrentMp() < (skillToBuy.getMpConsume() * Config.SELLBUFF_MP_MULTIPLER)) {
                            activeChar.sendMessage(seller.getName() + " has no enough mana for " + skillToBuy.getName() + "!");
                            SellBuffsManager.getInstance().sendBuffMenu(activeChar, seller, index);
                            return false;
                        }
                        final SellBuffHolder holder = seller.getSellingBuffs().stream().filter(h -> (h.getSkillId() == skillToBuy.getId())).findFirst().orElse(null);
                        if (holder != null) {
                            if (AbstractScript.getQuestItemsCount(activeChar, Config.SELLBUFF_PAYMENT_ID) >= holder.getPrice()) {
                                AbstractScript.takeItems(activeChar, Config.SELLBUFF_PAYMENT_ID, holder.getPrice());
                                AbstractScript.giveItems(seller, Config.SELLBUFF_PAYMENT_ID, holder.getPrice());
                                seller.reduceCurrentMp(skillToBuy.getMpConsume() * Config.SELLBUFF_MP_MULTIPLER);
                                skillToBuy.activateSkill(seller, activeChar);
                            } else {
                                final ItemTemplate item = ItemEngine.getInstance().getTemplate(Config.SELLBUFF_PAYMENT_ID);
                                if (item != null) {
                                    activeChar.sendMessage("Not enough " + item.getName() + "!");
                                } else {
                                    activeChar.sendMessage("Not enough items!");
                                }
                            }
                        }
                        SellBuffsManager.getInstance().sendBuffMenu(activeChar, seller, index);
                    }
                    break;
                }
        }
        return true;
    }

    @Override
    public String[] getVoicedCommandList() {
        return VOICED_COMMANDS;
    }

    @Override
    public String[] getBypassList() {
        return BYPASS_COMMANDS;
    }
}


while (st.hasMoreTokens()) {
                            title += st.nextToken() + " ";
                        }

/*
 *
 * This file is part of the L2JOrg project.
 *
 */
package custom.SellBuff;

import org.l2j.gameserver.Config;
import org.l2j.gameserver.engine.item.ItemEngine;
import org.l2j.gameserver.engine.skill.api.Skill;
import org.l2j.gameserver.handler.BypassHandler;
import org.l2j.gameserver.handler.IBypassHandler;
import org.l2j.gameserver.handler.IVoicedCommandHandler;
import org.l2j.gameserver.handler.VoicedCommandHandler;
import org.l2j.gameserver.instancemanager.SellBuffsManager;
import org.l2j.gameserver.model.actor.Creature;
import org.l2j.gameserver.model.actor.Npc;
import org.l2j.gameserver.model.actor.instance.Player;
import org.l2j.gameserver.model.events.AbstractScript;
import org.l2j.gameserver.model.holders.SellBuffHolder;
import org.l2j.gameserver.model.item.ItemTemplate;
import org.l2j.gameserver.util.GameUtils;
import org.l2j.gameserver.world.World;
import java.util.StringTokenizer;
import static org.l2j.commons.util.Util.isInteger;
import static org.l2j.gameserver.util.MathUtil.isInsideRadius3D;

/**
 * Sell Buffs voice command
 * @author St3eT
 */
public class SellBuff implements IVoicedCommandHandler, IBypassHandler {

    private static final String[] VOICED_COMMANDS = { "sellbuff", "sellbuffs" };

    private static final String[] BYPASS_COMMANDS = { "sellbuffadd", "sellbuffaddskill", "sellbuffedit", "sellbuffchangeprice", "sellbuffremove", "sellbuffbuymenu", "sellbuffbuyskill", "sellbuffstart", "sellbuffstop" };

    public SellBuff() {
        if (Config.SELLBUFF_ENABLED) {
            BypassHandler.getInstance().registerHandler(this);
            VoicedCommandHandler.getInstance().registerHandler(this);
        }
    }

    @Override
    public boolean useBypass(String command, Player player, Creature target) {
        String cmd = "";
        String params = "";
        final StringTokenizer st = new StringTokenizer(command, " ");
        if (st.hasMoreTokens()) {
            cmd = st.nextToken();
        }
        while (st.hasMoreTokens()) {
            params += st.nextToken() + (st.hasMoreTokens() ? " " : "");
        }
        if (cmd.isEmpty()) {
            return false;
        }
        return useBypass(cmd, player, params);
    }

    @Override
    public boolean useVoicedCommand(String command, Player activeChar, String params) {
        switch(command) {
            case "sellbuff":
            case "sellbuffs":
                {
                    SellBuffsManager.getInstance().sendSellMenu(activeChar);
                    break;
                }
        }
        return true;
    }

    public boolean useBypass(String command, Player activeChar, String params) {
        if (!Config.SELLBUFF_ENABLED) {
            return false;
        }
        switch(command) {
            case "sellbuffstart":
                {
                    if (activeChar.isSellingBuffs() || (params == null) || params.isEmpty()) {
                        return false;
                    } else if (activeChar.getSellingBuffs().isEmpty()) {
                        activeChar.sendMessage("Your list of buffs is empty, please add some buffs first!");
                        return false;
                    } else {
                        String title = "BUFF SELL: ";
                        final StringTokenizer st = new StringTokenizer(params, " ");

                        if (title.length() > 40) {
                            activeChar.sendMessage("Your title cannot exceed 29 characters in length. Please try again.");
                            return false;
                        }
                        SellBuffsManager.getInstance().startSellBuffs(activeChar, title);
                    }
                    break;
                }
            case "sellbuffstop":
                {
                    if (activeChar.isSellingBuffs()) {
                        SellBuffsManager.getInstance().stopSellBuffs(activeChar);
                    }
                    break;
                }
            case "sellbuffadd":
                {
                    if (!activeChar.isSellingBuffs()) {
                        int index = 0;
                        if ((params != null) && !params.isEmpty() && isInteger(params)) {
                            index = Integer.parseInt(params);
                        }
                        SellBuffsManager.getInstance().sendBuffChoiceMenu(activeChar, index);
                    }
                    break;
                }
            case "sellbuffedit":
                {
                    if (!activeChar.isSellingBuffs()) {
                        SellBuffsManager.getInstance().sendBuffEditMenu(activeChar);
                    }
                    break;
                }
            case "sellbuffchangeprice":
                {
                    if (!activeChar.isSellingBuffs() && (params != null) && !params.isEmpty()) {
                        final StringTokenizer st = new StringTokenizer(params, " ");
                        int skillId = -1;
                        int price = -1;
                        if (st.hasMoreTokens()) {
                            skillId = Integer.parseInt(st.nextToken());
                        }
                        if (st.hasMoreTokens()) {
                            try {
                                price = Integer.parseInt(st.nextToken());
                            } catch (NumberFormatException e) {
                                activeChar.sendMessage("Too big price! Maximal price is " + Config.SELLBUFF_MAX_PRICE);
                                SellBuffsManager.getInstance().sendBuffEditMenu(activeChar);
                            }
                        }
                        if ((skillId == -1) || (price == -1)) {
                            return false;
                        }
                        final Skill skillToChange = activeChar.getKnownSkill(skillId);
                        if (skillToChange == null) {
                            return false;
                        }
                        final SellBuffHolder holder = activeChar.getSellingBuffs().stream().filter(h -> (h.getSkillId() == skillToChange.getId())).findFirst().orElse(null);
                        if ((holder != null)) {
                            activeChar.sendMessage("Price of " + activeChar.getKnownSkill(holder.getSkillId()).getName() + " has been changed to " + price + "!");
                            holder.setPrice(price);
                            SellBuffsManager.getInstance().sendBuffEditMenu(activeChar);
                        }
                    }
                    break;
                }
            case "sellbuffremove":
                {
                    if (!activeChar.isSellingBuffs() && (params != null) && !params.isEmpty()) {
                        final StringTokenizer st = new StringTokenizer(params, " ");
                        int skillId = -1;
                        if (st.hasMoreTokens()) {
                            skillId = Integer.parseInt(st.nextToken());
                        }
                        if ((skillId == -1)) {
                            return false;
                        }
                        final Skill skillToRemove = activeChar.getKnownSkill(skillId);
                        if (skillToRemove == null) {
                            return false;
                        }
                        final SellBuffHolder holder = activeChar.getSellingBuffs().stream().filter(h -> (h.getSkillId() == skillToRemove.getId())).findFirst().orElse(null);
                        if ((holder != null) && activeChar.getSellingBuffs().remove(holder)) {
                            activeChar.sendMessage("Skill " + activeChar.getKnownSkill(holder.getSkillId()).getName() + " has been removed!");
                            SellBuffsManager.getInstance().sendBuffEditMenu(activeChar);
                        }
                    }
                    break;
                }
            case "sellbuffaddskill":
                {
                    if (!activeChar.isSellingBuffs() && (params != null) && !params.isEmpty()) {
                        final StringTokenizer st = new StringTokenizer(params, " ");
                        int skillId = -1;
                        long price = -1;
                        if (st.hasMoreTokens()) {
                            skillId = Integer.parseInt(st.nextToken());
                        }
                        if (st.hasMoreTokens()) {
                            try {
                                price = Integer.parseInt(st.nextToken());
                            } catch (NumberFormatException e) {
                                activeChar.sendMessage("Too big price! Maximal price is " + Config.SELLBUFF_MIN_PRICE);
                                SellBuffsManager.getInstance().sendBuffEditMenu(activeChar);
                            }
                        }
                        if ((skillId == -1) || (price == -1)) {
                            return false;
                        }
                        final Skill skillToAdd = activeChar.getKnownSkill(skillId);
                        if (skillToAdd == null) {
                            return false;
                        } else if (price < Config.SELLBUFF_MIN_PRICE) {
                            activeChar.sendMessage("Too small price! Minimal price is " + Config.SELLBUFF_MIN_PRICE);
                            return false;
                        } else if (price > Config.SELLBUFF_MAX_PRICE) {
                            activeChar.sendMessage("Too big price! Maximal price is " + Config.SELLBUFF_MAX_PRICE);
                            return false;
                        } else if (activeChar.getSellingBuffs().size() >= Config.SELLBUFF_MAX_BUFFS) {
                            activeChar.sendMessage("You already reached max count of buffs! Max buffs is: " + Config.SELLBUFF_MAX_BUFFS);
                            return false;
                        } else if (!SellBuffsManager.getInstance().isInSellList(activeChar, skillToAdd)) {
                            activeChar.getSellingBuffs().add(new SellBuffHolder(skillToAdd.getId(), price));
                            activeChar.sendMessage(skillToAdd.getName() + " has been added!");
                            SellBuffsManager.getInstance().sendBuffChoiceMenu(activeChar, 0);
                        }
                    }
                    break;
                }
            case "sellbuffbuymenu":
                {
                    if ((params != null) && !params.isEmpty()) {
                        final StringTokenizer st = new StringTokenizer(params, " ");
                        int objId = -1;
                        int index = 0;
                        if (st.hasMoreTokens()) {
                            objId = Integer.parseInt(st.nextToken());
                        }
                        if (st.hasMoreTokens()) {
                            index = Integer.parseInt(st.nextToken());
                        }
                        final Player seller = World.getInstance().findPlayer(objId);
                        if (seller != null) {
                            if (!seller.isSellingBuffs() || !isInsideRadius3D(activeChar, seller, Npc.INTERACTION_DISTANCE)) {
                                return false;
                            }
                            SellBuffsManager.getInstance().sendBuffMenu(activeChar, seller, index);
                        }
                    }
                    break;
                }
            case "sellbuffbuyskill":
                {
                    if ((params != null) && !params.isEmpty()) {
                        final StringTokenizer st = new StringTokenizer(params, " ");
                        int objId = -1;
                        int skillId = -1;
                        int index = 0;
                        if (st.hasMoreTokens()) {
                            objId = Integer.parseInt(st.nextToken());
                        }
                        if (st.hasMoreTokens()) {
                            skillId = Integer.parseInt(st.nextToken());
                        }
                        if (st.hasMoreTokens()) {
                            index = Integer.parseInt(st.nextToken());
                        }
                        if ((skillId == -1) || (objId == -1)) {
                            return false;
                        }
                        final Player seller = World.getInstance().findPlayer(objId);
                        if (seller == null) {
                            return false;
                        }
                        final Skill skillToBuy = seller.getKnownSkill(skillId);
                        if (!seller.isSellingBuffs() || !GameUtils.checkIfInRange(Npc.INTERACTION_DISTANCE, activeChar, seller, true) || (skillToBuy == null)) {
                            return false;
                        }
                        if (seller.getCurrentMp() < (skillToBuy.getMpConsume() * Config.SELLBUFF_MP_MULTIPLER)) {
                            activeChar.sendMessage(seller.getName() + " has no enough mana for " + skillToBuy.getName() + "!");
                            SellBuffsManager.getInstance().sendBuffMenu(activeChar, seller, index);
                            return false;
                        }
                        final SellBuffHolder holder = seller.getSellingBuffs().stream().filter(h -> (h.getSkillId() == skillToBuy.getId())).findFirst().orElse(null);
                        if (holder != null) {
                            if (AbstractScript.getQuestItemsCount(activeChar, Config.SELLBUFF_PAYMENT_ID) >= holder.getPrice()) {
                                AbstractScript.takeItems(activeChar, Config.SELLBUFF_PAYMENT_ID, holder.getPrice());
                                AbstractScript.giveItems(seller, Config.SELLBUFF_PAYMENT_ID, holder.getPrice());
                                seller.reduceCurrentMp(skillToBuy.getMpConsume() * Config.SELLBUFF_MP_MULTIPLER);
                                skillToBuy.activateSkill(seller, activeChar);
                            } else {
                                final ItemTemplate item = ItemEngine.getInstance().getTemplate(Config.SELLBUFF_PAYMENT_ID);
                                if (item != null) {
                                    activeChar.sendMessage("Not enough " + item.getName() + "!");
                                } else {
                                    activeChar.sendMessage("Not enough items!");
                                }
                            }
                        }
                        SellBuffsManager.getInstance().sendBuffMenu(activeChar, seller, index);
                    }
                    break;
                }
        }
        return true;
    }

    @Override
    public String[] getVoicedCommandList() {
        return VOICED_COMMANDS;
    }

    @Override
    public String[] getBypassList() {
        return BYPASS_COMMANDS;
    }
}


while (src < this.ranges.length) {
            result[wp++] = this.ranges[src++];
            result[wp++] = this.ranges[src++];
        }

package org.apache.xmlbeans.impl.regex;

/**
 * This class represents a character class such as [a-z] or a period.
 */
final class RangeToken extends Token implements java.io.Serializable {

    int[] ranges;

    boolean sorted;

    boolean compacted;

    RangeToken icaseCache = null;

    int[] map = null;

    int nonMapIndex;

    RangeToken(int type) {
        super(type);
        this.setSorted(false);
    }

    // for RANGE or NRANGE
    protected void addRange(int start, int end) {
        this.icaseCache = null;
        int r1, r2;
        if (start <= end) {
            r1 = start;
            r2 = end;
        } else {
            r1 = end;
            r2 = start;
        }
        if (this.ranges == null) {
            this.ranges = new int[2];
            this.ranges[0] = r1;
            this.ranges[1] = r2;
            this.setSorted(true);
        } else {
            int pos = this.ranges.length;
            if (this.ranges[pos - 1] + 1 == r1) {
                this.ranges[pos - 1] = r2;
                return;
            }
            int[] temp = new int[pos + 2];
            System.arraycopy(this.ranges, 0, temp, 0, pos);
            this.ranges = temp;
            if (this.ranges[pos - 1] >= r1) {
                this.setSorted(false);
            }
            this.ranges[pos++] = r1;
            this.ranges[pos] = r2;
            if (!this.sorted) {
                this.sortRanges();
            }
        }
    }

    private boolean isSorted() {
        return this.sorted;
    }

    private void setSorted(boolean sort) {
        this.sorted = sort;
        if (!sort) {
            this.compacted = false;
        }
    }

    private boolean isCompacted() {
        return this.compacted;
    }

    private void setCompacted() {
        this.compacted = true;
    }

    protected void sortRanges() {
        if (this.isSorted()) {
            return;
        }
        if (this.ranges == null) {
            return;
        }
        // Bubble sort
        // this.ranges has few elements.
        for (int i = this.ranges.length - 4; i >= 0; i -= 2) {
            for (int j = 0; j <= i; j += 2) {
                if (this.ranges[j] > this.ranges[j + 2] || this.ranges[j] == this.ranges[j + 2] && this.ranges[j + 1] > this.ranges[j + 3]) {
                    int tmp;
                    tmp = this.ranges[j + 2];
                    this.ranges[j + 2] = this.ranges[j];
                    this.ranges[j] = tmp;
                    tmp = this.ranges[j + 3];
                    this.ranges[j + 3] = this.ranges[j + 1];
                    this.ranges[j + 1] = tmp;
                }
            }
        }
        this.setSorted(true);
    }

    /**
     * this.ranges is sorted.
     */
    @SuppressWarnings("ConstantConditions")
    protected void compactRanges() {
        boolean DEBUG = false;
        if (this.ranges == null || this.ranges.length <= 2) {
            return;
        }
        if (this.isCompacted()) {
            return;
        }
        // Index of writing point
        int base = 0;
        // Index of processing point
        int target = 0;
        while (target < this.ranges.length) {
            if (base != target) {
                this.ranges[base] = this.ranges[target++];
                this.ranges[base + 1] = this.ranges[target++];
            } else {
                target += 2;
            }
            int baseend = this.ranges[base + 1];
            while (target < this.ranges.length) {
                if (baseend + 1 < this.ranges[target]) {
                    break;
                }
                if (baseend + 1 == this.ranges[target]) {
                    if (DEBUG) {
                        System.err.println("Token#compactRanges(): Compaction: [" + this.ranges[base] + ", " + this.ranges[base + 1] + "], [" + this.ranges[target] + ", " + this.ranges[target + 1] + "] -> [" + this.ranges[base] + ", " + this.ranges[target + 1] + "]");
                    }
                    this.ranges[base + 1] = this.ranges[target + 1];
                    baseend = this.ranges[base + 1];
                    target += 2;
                } else if (baseend >= this.ranges[target + 1]) {
                    if (DEBUG) {
                        System.err.println("Token#compactRanges(): Compaction: [" + this.ranges[base] + ", " + this.ranges[base + 1] + "], [" + this.ranges[target] + ", " + this.ranges[target + 1] + "] -> [" + this.ranges[base] + ", " + this.ranges[base + 1] + "]");
                    }
                    target += 2;
                } else if (baseend < this.ranges[target + 1]) {
                    if (DEBUG) {
                        System.err.println("Token#compactRanges(): Compaction: [" + this.ranges[base] + ", " + this.ranges[base + 1] + "], [" + this.ranges[target] + ", " + this.ranges[target + 1] + "] -> [" + this.ranges[base] + ", " + this.ranges[target + 1] + "]");
                    }
                    this.ranges[base + 1] = this.ranges[target + 1];
                    baseend = this.ranges[base + 1];
                    target += 2;
                } else {
                    throw new RuntimeException("Token#compactRanges(): Internel Error: [" + this.ranges[base] + "," + this.ranges[base + 1] + "] [" + this.ranges[target] + "," + this.ranges[target + 1] + "]");
                }
            }
            base += 2;
        }
        if (base != this.ranges.length) {
            int[] result = new int[base];
            System.arraycopy(this.ranges, 0, result, 0, base);
            this.ranges = result;
        }
        this.setCompacted();
    }

    protected void mergeRanges(Token token) {
        RangeToken tok = (RangeToken) token;
        this.sortRanges();
        tok.sortRanges();
        if (tok.ranges == null) {
            return;
        }
        this.icaseCache = null;
        this.setSorted(true);
        if (this.ranges == null) {
            this.ranges = new int[tok.ranges.length];
            System.arraycopy(tok.ranges, 0, this.ranges, 0, tok.ranges.length);
            return;
        }
        int[] result = new int[this.ranges.length + tok.ranges.length];
        for (int i = 0, j = 0, k = 0; i < this.ranges.length || j < tok.ranges.length; ) {
            if (i >= this.ranges.length) {
                result[k++] = tok.ranges[j++];
                result[k++] = tok.ranges[j++];
            } else if (j >= tok.ranges.length) {
                result[k++] = this.ranges[i++];
                result[k++] = this.ranges[i++];
            } else if (tok.ranges[j] < this.ranges[i] || tok.ranges[j] == this.ranges[i] && tok.ranges[j + 1] < this.ranges[i + 1]) {
                result[k++] = tok.ranges[j++];
                result[k++] = tok.ranges[j++];
            } else {
                result[k++] = this.ranges[i++];
                result[k++] = this.ranges[i++];
            }
        }
        this.ranges = result;
    }

    protected void subtractRanges(Token token) {
        if (token.type == NRANGE) {
            this.intersectRanges(token);
            return;
        }
        RangeToken tok = (RangeToken) token;
        if (tok.ranges == null || this.ranges == null) {
            return;
        }
        this.icaseCache = null;
        this.sortRanges();
        this.compactRanges();
        tok.sortRanges();
        tok.compactRanges();
        int[] result = new int[this.ranges.length + tok.ranges.length];
        int wp = 0, src = 0, sub = 0;
        while (src < this.ranges.length && sub < tok.ranges.length) {
            int srcbegin = this.ranges[src];
            int srcend = this.ranges[src + 1];
            int subbegin = tok.ranges[sub];
            int subend = tok.ranges[sub + 1];
            if (srcend < subbegin) {
                // Not overlapped
                // Reuse sub
                result[wp++] = this.ranges[src++];
                result[wp++] = this.ranges[src++];
            } else if (srcend >= subbegin && srcbegin <= subend) {
                // Overlapped
                if (subbegin <= srcbegin && srcend <= subend) {
                    // res: empty
                    // Reuse sub
                    src += 2;
                } else if (subbegin <= srcbegin) {
                    this.ranges[src] = subend + 1;
                    sub += 2;
                } else if (srcend <= subend) {
                    // Reuse sub
                    result[wp++] = srcbegin;
                    result[wp++] = subbegin - 1;
                    src += 2;
                } else {
                    // res:    o-o    o-o
                    // Reuse src(=right res)
                    result[wp++] = srcbegin;
                    result[wp++] = subbegin - 1;
                    this.ranges[src] = subend + 1;
                    sub += 2;
                }
            } else if (subend < srcbegin) {
                // Not overlapped
                sub += 2;
            } else {
                throw new RuntimeException("Token#subtractRanges(): Internal Error: [" + this.ranges[src] + "," + this.ranges[src + 1] + "] - [" + tok.ranges[sub] + "," + tok.ranges[sub + 1] + "]");
            }
        }

        this.ranges = new int[wp];
        System.arraycopy(result, 0, this.ranges, 0, wp);
        // this.ranges is sorted and compacted.
    }

    /**
     * @param token Ignore whether it is NRANGE or not.
     */
    protected void intersectRanges(Token token) {
        RangeToken tok = (RangeToken) token;
        if (tok.ranges == null || this.ranges == null) {
            return;
        }
        this.icaseCache = null;
        this.sortRanges();
        this.compactRanges();
        tok.sortRanges();
        tok.compactRanges();
        int[] result = new int[this.ranges.length + tok.ranges.length];
        int wp = 0, src1 = 0, src2 = 0;
        while (src1 < this.ranges.length && src2 < tok.ranges.length) {
            int src1begin = this.ranges[src1];
            int src1end = this.ranges[src1 + 1];
            int src2begin = tok.ranges[src2];
            int src2end = tok.ranges[src2 + 1];
            if (src1end < src2begin) {
                // Not overlapped
                // res:  empty
                // Reuse src2
                src1 += 2;
            } else if (src1end >= src2begin && src1begin <= src2end) {
                // Overlapped
                if (src2begin <= src1begin && src1end <= src2end) {
                    // Reuse src2
                    result[wp++] = src1begin;
                    result[wp++] = src1end;
                    src1 += 2;
                } else if (src2begin <= src1begin) {
                    // res:     o--o
                    // Reuse the rest of src1
                    result[wp++] = src1begin;
                    result[wp++] = src2end;
                    this.ranges[src1] = src2end + 1;
                    src2 += 2;
                } else if (src1end <= src2end) {
                    // res:           o--o
                    // Reuse src2
                    result[wp++] = src2begin;
                    result[wp++] = src1end;
                    src1 += 2;
                } else {
                    // Reuse the rest of src1
                    result[wp++] = src2begin;
                    result[wp++] = src2end;
                    this.ranges[src1] = src2end + 1;
                }
            } else if (src2end < src1begin) {
                // Not overlapped
                src2 += 2;
            } else {
                throw new RuntimeException("Token#intersectRanges(): Internal Error: [" + this.ranges[src1] + "," + this.ranges[src1 + 1] + "] & [" + tok.ranges[src2] + "," + tok.ranges[src2 + 1] + "]");
            }
        }
        while (src1 < this.ranges.length) {
            result[wp++] = this.ranges[src1++];
            result[wp++] = this.ranges[src1++];
        }
        this.ranges = new int[wp];
        System.arraycopy(result, 0, this.ranges, 0, wp);
        // this.ranges is sorted and compacted.
    }

    /**
     * for RANGE: Creates complement.
     * for NRANGE: Creates the same meaning RANGE.
     */
    static Token complementRanges(Token token) {
        if (token.type != RANGE && token.type != NRANGE) {
            throw new IllegalArgumentException("Token#complementRanges(): must be RANGE: " + token.type);
        }
        RangeToken tok = (RangeToken) token;
        tok.sortRanges();
        tok.compactRanges();
        int len = tok.ranges.length + 2;
        if (tok.ranges[0] == 0) {
            len -= 2;
        }
        int last = tok.ranges[tok.ranges.length - 1];
        if (last == UTF16_MAX) {
            len -= 2;
        }
        RangeToken ret = Token.createRange();
        ret.ranges = new int[len];
        int wp = 0;
        if (tok.ranges[0] > 0) {
            ret.ranges[wp++] = 0;
            ret.ranges[wp++] = tok.ranges[0] - 1;
        }
        for (int i = 1; i < tok.ranges.length - 2; i += 2) {
            ret.ranges[wp++] = tok.ranges[i] + 1;
            ret.ranges[wp++] = tok.ranges[i + 1] - 1;
        }
        if (last != UTF16_MAX) {
            ret.ranges[wp++] = last + 1;
            ret.ranges[wp] = UTF16_MAX;
        }
        ret.setCompacted();
        return ret;
    }

    synchronized RangeToken getCaseInsensitiveToken() {
        if (this.icaseCache != null) {
            return this.icaseCache;
        }
        RangeToken uppers = this.type == Token.RANGE ? Token.createRange() : Token.createNRange();
        for (int i = 0; i < this.ranges.length; i += 2) {
            for (int ch = this.ranges[i]; ch <= this.ranges[i + 1]; ch++) {
                if (ch > 0xffff) {
                    uppers.addRange(ch, ch);
                } else {
                    char uch = Character.toUpperCase((char) ch);
                    uppers.addRange(uch, uch);
                }
            }
        }
        RangeToken lowers = this.type == Token.RANGE ? Token.createRange() : Token.createNRange();
        for (int i = 0; i < uppers.ranges.length; i += 2) {
            for (int ch = uppers.ranges[i]; ch <= uppers.ranges[i + 1]; ch++) {
                if (ch > 0xffff) {
                    lowers.addRange(ch, ch);
                } else {
                    char uch = Character.toUpperCase((char) ch);
                    lowers.addRange(uch, uch);
                }
            }
        }
        lowers.mergeRanges(uppers);
        lowers.mergeRanges(this);
        lowers.compactRanges();
        this.icaseCache = lowers;
        return lowers;
    }

    boolean match(int ch) {
        if (this.map == null) {
            this.createMap();
        }
        boolean ret;
        if (this.type == RANGE) {
            if (ch < MAPSIZE) {
                return (this.map[ch / 32] & (1 << (ch & 0x1f))) != 0;
            }
            ret = false;
            for (int i = this.nonMapIndex; i < this.ranges.length; i += 2) {
                if (this.ranges[i] <= ch && ch <= this.ranges[i + 1]) {
                    return true;
                }
            }
        } else {
            if (ch < MAPSIZE) {
                return (this.map[ch / 32] & (1 << (ch & 0x1f))) == 0;
            }
            ret = true;
            for (int i = this.nonMapIndex; i < this.ranges.length; i += 2) {
                if (this.ranges[i] <= ch && ch <= this.ranges[i + 1]) {
                    return false;
                }
            }
        }
        return ret;
    }

    private static final int MAPSIZE = 256;

    private void createMap() {
        // 32 is the number of bits in `int'.
        int asize = MAPSIZE / 32;
        // CHANGE(radup) we need a new map, since this is not synchronized
        // and if we init the instance map with 0's it's going to be trouble
        int[] localmap = new int[asize];
        int localnonMapIndex = this.ranges.length;
        for (int i = 0; i < asize; i++) {
            localmap[i] = 0;
        }
        for (int i = 0; i < this.ranges.length; i += 2) {
            int s = this.ranges[i];
            int e = this.ranges[i + 1];
            if (s < MAPSIZE) {
                for (int j = s; j <= e && j < MAPSIZE; j++) {
                    localmap[j / 32] |= 1 << (j & 0x1f);
                }
            } else {
                localnonMapIndex = i;
                break;
            }
            if (e >= MAPSIZE) {
                localnonMapIndex = i;
                break;
            }
        }
        this.nonMapIndex = localnonMapIndex;
        this.map = localmap;
    }

    public String toString(int options) {
        String ret;
        if (this.type == RANGE) {
            if (this == Token.token_dot) {
                ret = ".";
            } else if (this == Token.token_0to9) {
                ret = "\\d";
            } else if (this == Token.token_wordchars) {
                ret = "\\w";
            } else if (this == Token.token_spaces) {
                ret = "\\s";
            } else {
                StringBuilder sb = new StringBuilder();
                sb.append("[");
                for (int i = 0; i < this.ranges.length; i += 2) {
                    if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0) {
                        sb.append(",");
                    }
                    if (this.ranges[i] == this.ranges[i + 1]) {
                        sb.append(escapeCharInCharClass(this.ranges[i]));
                    } else {
                        sb.append(escapeCharInCharClass(this.ranges[i]));
                        sb.append('-');
                        sb.append(escapeCharInCharClass(this.ranges[i + 1]));
                    }
                }
                sb.append("]");
                ret = sb.toString();
            }
        } else {
            if (this == Token.token_not_0to9) {
                ret = "\\D";
            } else if (this == Token.token_not_wordchars) {
                ret = "\\W";
            } else if (this == Token.token_not_spaces) {
                ret = "\\S";
            } else {
                StringBuilder sb = new StringBuilder();
                sb.append("[^");
                for (int i = 0; i < this.ranges.length; i += 2) {
                    if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0) {
                        sb.append(",");
                    }
                    if (this.ranges[i] == this.ranges[i + 1]) {
                        sb.append(escapeCharInCharClass(this.ranges[i]));
                    } else {
                        sb.append(escapeCharInCharClass(this.ranges[i]));
                        sb.append('-');
                        sb.append(escapeCharInCharClass(this.ranges[i + 1]));
                    }
                }
                sb.append("]");
                ret = sb.toString();
            }
        }
        return ret;
    }

    private static String escapeCharInCharClass(int ch) {
        String ret;
        switch(ch) {
            case '[':
            case ']':
            case '-':
            case '^':
            case ',':
            case '\\':
                ret = "\\" + (char) ch;
                break;
            case '\f':
                ret = "\\f";
                break;
            case '\n':
                ret = "\\n";
                break;
            case '\r':
                ret = "\\r";
                break;
            case '\t':
                ret = "\\t";
                break;
            case 0x1b:
                ret = "\\e";
                break;
            // case 0x0b:  ret = "\\v";  break;
            default:
                if (ch < 0x20) {
                    String pre = "0" + Integer.toHexString(ch);
                    ret = "\\x" + pre.substring(pre.length() - 2);
                } else if (ch >= 0x10000) {
                    String pre = "0" + Integer.toHexString(ch);
                    ret = "\\v" + pre.substring(pre.length() - 6);
                } else {
                    ret = "" + (char) ch;
                }
        }
        return ret;
    }
}


package org.waveprotocol.wave.client.widget.button;

/**
 * Simplified (compared to the GWT version) listener interface for mouse events -
 * this interface doesn't depend on GWT.
 */
public interface MouseListener {

    /**
     * A {@link MouseListener} that does nothing when it receives events.
     */
    public static final MouseListener NO_OP = new MouseListener() {

        @Override
        public void onMouseUp() {
        }

        @Override
        public void onMouseLeave() {
        }

        @Override
        public void onMouseEnter() {
        }

        @Override
        public void onMouseDown() {
        }

        @Override
        public void onClick() {
        }
    };

    /**
     * Called when the mouse is pressed over some widget.
     */
    void onMouseDown();

    /**
     * Called when the mouse enters some widget.
     */
    void onMouseEnter();

    /**
     * Called when the mouse leaves some widget.
     */
    void onMouseLeave();

    /**
     * Called when the mouse is released over some widget.
     */
    void onMouseUp();

    /**
     * Called when the mouse is clicked.
     */


DataReference getReference(String dataReferenceKey, NetworkDestination platform) throws CommunicationException;

package de.rcenvironment.core.datamanagement;

import java.util.Collection;
import de.rcenvironment.core.communication.common.CommunicationException;
import de.rcenvironment.core.communication.common.InstanceNodeSessionId;
import de.rcenvironment.core.communication.common.NetworkDestination;
import de.rcenvironment.core.datamanagement.commons.DataReference;

/**
 * Service that provides easy access to {@link DataReference}s by calling remote {@link DataReferenceService}s in the distributed system.
 *
 * @author Doreen Seider
 * @author Robert Mischke
 * @author Jan Flink
 */
public interface DataReferenceService {

    /**
     * Retrieves a {@link DataReference} for a given key from the Catalog.
     *
     * @param dataReferenceKey The key of the {@link DataReference} to return.
     * @param platform The {@link InstanceNodeSessionId} of the platform to query. If null the reference will be gotten from
     *        the local platform.
     * @return the found {@link DataReference} as a clone.
     * @throws CommunicationException in case of communication error
     */

    /**
     * Retrieves a {@link DataReference} for a given key by querying the Catalogs of the statically configured "known" platforms.
     *
     * @param dataReferenceKey The key of the {@link DataReference} to return.
     * @return the found {@link DataReference} as a clone.
     * @throws CommunicationException in case of communication error
     */
    // undefined storage locations are not used anymore; remove from code base
    @Deprecated
    DataReference getReference(String dataReferenceKey) throws CommunicationException;

    /**
     * Retrieves a {@link DataReference} for a given key by querying the Catalogs of the given platforms.
     *
     * @param dataReferenceKey The key of the {@link DataReference} to return.
     * @param platforms the ids of the platforms to query
     * @return the found {@link DataReference} as a clone.
     * @throws CommunicationException in case of communication error
     */
    // undefined storage locations are not used anymore; remove from code base
    @Deprecated
    DataReference getReference(String dataReferenceKey, Collection<? extends NetworkDestination> platforms) throws CommunicationException;
}


package org.aoju.bus.health.builtin.hardware;

import org.aoju.bus.core.annotation.Immutable;

/**
 * SoundCard interface.
 *
 * @author Kimi Liu
 * @version 6.3.0
 * @since JDK 1.8+
 */
@Immutable
public interface SoundCard {

    /**
     * Retrieves the driver version currently in use in machine
     *
     * @return The current and complete name of the driver version
     */
    String getDriverVersion();

    /**
     * Retrieves the full name of the card.
     *
     * @return The name of the card.
     */

    /**
     * Retrieves the codec of the Sound card
     *
     * @return The name of the codec of the sound card
     */
    String getCodec();
}


public int getCount() {
        assertUsing();
        return list.size();
    }

package alexiil.mc.lib.attributes;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.util.collection.DefaultedList;

/**
 * The base class for {@link AttributeList} and {@link ItemAttributeList}.
 */
public abstract class AbstractAttributeList<T> {

    public final Attribute<T> attribute;

    protected final DefaultedList<T> list = DefaultedList.of();

    private boolean hasFinishedAdding = false;

    public AbstractAttributeList(Attribute<T> attribute) {
        this.attribute = attribute;
    }

    /**
     * @return The number of attribute instances added to this list.
     */

    @Nonnull
    public T get(int index) {
        assertUsing();
        return list.get(index);
    }

    @Nullable
    public T getFirstOrNull() {
        assertUsing();
        if (list.isEmpty()) {
            return null;
        }
        return list.get(0);
    }

    @Nonnull
    public T getFirst(DefaultedAttribute<T> defaulted) {
        assertUsing();
        if (list.isEmpty()) {
            return defaulted.defaultValue;
        }
        return list.get(0);
    }

    /**
     * @return A combined version of this list, or the attribute's default value if this list is empty.
     */
    @Nonnull
    public T combine(CombinableAttribute<T> combinable) {
        assertUsing();
        return combinable.combine(list);
    }

    void reset() {
        list.clear();
        hasFinishedAdding = false;
    }

    void finishAdding() {
        assertAdding();
        hasFinishedAdding = true;
    }

    protected void assertAdding() {
        assert !hasFinishedAdding;
    }

    protected void assertUsing() {
        assert hasFinishedAdding;
    }
}


void setAutoCommit(EntityContext entityContext, boolean value) throws SortServiceProviderException;

package scott.barleydb.api.core;

import scott.barleydb.api.audit.AuditInformation;
import scott.barleydb.api.config.DefinitionsSet;
import scott.barleydb.api.core.entity.EntityContext;
import scott.barleydb.api.exception.execution.SortServiceProviderException;
import scott.barleydb.api.exception.execution.jdbc.SortJdbcException;
import scott.barleydb.api.exception.execution.persist.SortPersistException;
import scott.barleydb.api.exception.execution.query.BarleyDBQueryException;
import scott.barleydb.api.persist.PersistAnalyser;
import scott.barleydb.api.persist.PersistRequest;
import scott.barleydb.api.query.QueryObject;
import scott.barleydb.api.query.RuntimeProperties;
import scott.barleydb.api.stream.QueryEntityDataInputStream;
import scott.barleydb.server.jdbc.query.QueryResult;
import scott.barleydb.api.core.QueryBatcher;

/**
 * Interface for performing queries and persisting entities
 * @author scott
 */
public interface IEntityContextServices {

    /**
     * Gets all of the definitions of the environment which this
     * entity context services executes in.
     * @return
     */
    public DefinitionsSet getDefinitionsSet();

    /**
     * Sets the auto commit mode of the entity context.
     *
     * If the mode changes to true, then any ongoing transaction will be committed.
     *
     * @param entityContext
     * @param value
     * @throws SortJdbcException if an access error occurred, if an attempted commit failed.
     *  if the auto commit mode is not supported by the environment.
     */

    /**
     * Gets the auto commit mode of the entity context.
     * @param entityContext
     * @return
     * @throws SortJdbcException if an access error occurred.
     */
    boolean getAutoCommit(EntityContext entityContext) throws SortServiceProviderException;

    /**
     * Makes the newContext join the same transaction as contextWithTransaction.<br/>
     *
     * If contextWithTransaction has no connection resources associated to it then this is a noop.
     *
     * @param newContext
     * @param contextWithTransaction
     */
    void joinTransaction(EntityContext newContext, EntityContext contextWithTransaction);

    /**
     * Commits the transaction associated with the entity context
     *
     * @param entityContext
     * @throws SortJdbcException if the commit failed, if we are in auto commit mode.
     */
    void commit(EntityContext entityContext) throws SortServiceProviderException;

    /**
     * Closes the connection  associated with the entity context transaction (if any)
     *
     * @param entityContext
     * @throws SortJdbcException if the commit failed, if we are in auto commit mode.
     */
    void close(EntityContext entityContext) throws SortServiceProviderException;

    /**
     * Rolls the transaction for the given entity context back.
     * @param entityContext
     * @throws SortJdbcException
     */
    void rollback(EntityContext entityContext) throws SortServiceProviderException;

    /**
     * Executes the query returning a stream of EntityData
     * @param entityContext
     * @param query
     * @param props
     * @return
     * @throws SortJdbcException
     * @throws BarleyDBQueryException
     */
    <T> QueryEntityDataInputStream streamQuery(EntityContext entityContext, QueryObject<T> query, RuntimeProperties props) throws SortJdbcException, BarleyDBQueryException;

    /**
     * Executes the query populating the given entity context with the result.
     *
     * @param namespace
     * @param entityContext
     * @param query
     * @param props
     * @return
     * @throws SortJdbcException
     * @throws BarleyDBQueryException
     */
    <T> QueryResult<T> execute(EntityContext entityContext, QueryObject<T> query, RuntimeProperties props) throws SortServiceProviderException, BarleyDBQueryException;

    /**
     * Executes the batch of queries populating the given entity context with the result.
     *
     * @param namespace
     * @param entityContext
     * @param queryBatcher
     * @param props
     * @return
     * @throws SortJdbcException
     * @throws BarleyDBQueryException
     */
    QueryBatcher execute(EntityContext entityContext, QueryBatcher queryBatcher, RuntimeProperties props) throws SortServiceProviderException, BarleyDBQueryException;

    /**
     * Generates audit information for a persist request. Can be used to see if there are any changes.
     *
     * @param persistRequest
     * @param runtimeProperties
     * @return
     * @throws SortJdbcException
     * @throws SortPersistException
     */
    AuditInformation compareWithDatabase(PersistRequest persistRequest, RuntimeProperties runtimeProperties) throws SortJdbcException, SortPersistException;

    /**
     * Executes the persist analysis
     *
     * @param persistAnalyser
     * @return
     * @throws SortJdbcException
     * @throws SortPersistException
     */
    PersistAnalyser execute(PersistRequest persistRequest, RuntimeProperties props) throws SortServiceProviderException, SortPersistException;

    String debugQueryString(QueryObject<Object> query, String namespace);
}


<T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException;

package cn.bugstack.springframework.beans.factory;

import cn.bugstack.springframework.beans.BeansException;
import java.util.Map;

/**
 * Extension of the {@link BeanFactory} interface to be implemented by bean factories
 * that can enumerate all their bean instances, rather than attempting bean lookup
 * by name one by one as requested by clients. BeanFactory implementations that
 * preload all their bean definitions (such as XML-based factories) may implement
 * this interface.
 * <p>
 * 博客：https://bugstack.cn - 沉淀、分享、成长，让自己和他人都能有所收获！
 * 公众号：bugstack虫洞栈
 * Create by 小傅哥(fustack)
 */
public interface ListableBeanFactory extends BeanFactory {

    /**
     * 按照类型返回 Bean 实例
     * @param type
     * @param <T>
     * @return
     * @throws BeansException
     */

    /**
     * Return the names of all beans defined in this registry.
     *
     * 返回注册表中所有的Bean名称
     */
    String[] getBeanDefinitionNames();
}