text:
package net.minecraft.command.server;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.CommandResultStats;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.SyntaxErrorException;
import net.minecraft.command.WrongUsageException;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.JsonToNBT;
import net.minecraft.nbt.NBTException;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.scoreboard.IScoreObjectiveCriteria;
import net.minecraft.scoreboard.Score;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.scoreboard.Team;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;

public class CommandScoreboard extends CommandBase
{
    private static final String __OBFID = "CL_00000896";

    public String getCommandName()
    {
        return "scoreboard";
    }

    /**
     * Return the required permission level for this command.
     */
    public int getRequiredPermissionLevel()
    {
        return 2;
    }

    public String getCommandUsage(ICommandSender sender)
    {
        return "commands.scoreboard.usage";
    }

    public void processCommand(ICommandSender sender, String[] args) throws CommandException
    {
        if (!this.func_175780_b(sender, args))
        {
            if (args.length < 1)
            {
                throw new WrongUsageException("commands.scoreboard.usage", new Object[0]);
            }
            else
            {
                if (args[0].equalsIgnoreCase("objectives"))
                {
                    if (args.length == 1)
                    {
                        throw new WrongUsageException("commands.scoreboard.objectives.usage", new Object[0]);
                    }

                    if (args[1].equalsIgnoreCase("list"))
                    {
                        this.listObjectives(sender);
                    }
                    else if (args[1].equalsIgnoreCase("add"))
                    {
                        if (args.length < 4)
                        {
                            throw new WrongUsageException("commands.scoreboard.objectives.add.usage", new Object[0]);
                        }

                        this.addObjective(sender, args, 2);
                    }
                    else if (args[1].equalsIgnoreCase("remove"))
                    {
                        if (args.length != 3)
                        {
                            throw new WrongUsageException("commands.scoreboard.objectives.remove.usage", new Object[0]);
                        }

                        this.removeObjective(sender, args[2]);
                    }
                    else
                    {
                        if (!args[1].equalsIgnoreCase("setdisplay"))
                        {
                            throw new WrongUsageException("commands.scoreboard.objectives.usage", new Object[0]);
                        }

                        if (args.length != 3 && args.length != 4)
                        {
                            throw new WrongUsageException("commands.scoreboard.objectives.setdisplay.usage", new Object[0]);
                        }

                        this.setObjectiveDisplay(sender, args, 2);
                    }
                }
                else if (args[0].equalsIgnoreCase("players"))
                {
                    if (args.length == 1)
                    {
                        throw new WrongUsageException("commands.scoreboard.players.usage", new Object[0]);
                    }

                    if (args[1].equalsIgnoreCase("list"))
                    {
                        if (args.length > 3)
                        {
                            throw new WrongUsageException("commands.scoreboard.players.list.usage", new Object[0]);
                        }

                        this.listPlayers(sender, args, 2);
                    }
                    else if (args[1].equalsIgnoreCase("add"))
                    {
                        if (args.length < 5)
                        {
                            throw new WrongUsageException("commands.scoreboard.players.add.usage", new Object[0]);
                        }

                        this.setPlayer(sender, args, 2);
                    }
                    else if (args[1].equalsIgnoreCase("remove"))
                    {
                        if (args.length < 5)
                        {
                            throw new WrongUsageException("commands.scoreboard.players.remove.usage", new Object[0]);
                        }

                        this.setPlayer(sender, args, 2);
                    }
                    else if (args[1].equalsIgnoreCase("set"))
                    {
                        if (args.length < 5)
                        {
                            throw new WrongUsageException("commands.scoreboard.players.set.usage", new Object[0]);
                        }

                        this.setPlayer(sender, args, 2);
                    }
                    else if (args[1].equalsIgnoreCase("reset"))
                    {
                        if (args.length != 3 && args.length != 4)
                        {
                            throw new WrongUsageException("commands.scoreboard.players.reset.usage", new Object[0]);
                        }

                        this.resetPlayers(sender, args, 2);
                    }
                    else if (args[1].equalsIgnoreCase("enable"))
                    {
                        if (args.length != 4)
                        {
                            throw new WrongUsageException("commands.scoreboard.players.enable.usage", new Object[0]);
                        }

                        this.func_175779_n(sender, args, 2);
                    }
                    else if (args[1].equalsIgnoreCase("test"))
                    {
                        if (args.length != 5 && args.length != 6)
                        {
                            throw new WrongUsageException("commands.scoreboard.players.test.usage", new Object[0]);
                        }

                        this.func_175781_o(sender, args, 2);
                    }
                    else
                    {
                        if (!args[1].equalsIgnoreCase("operation"))
                        {
                            throw new WrongUsageException("commands.scoreboard.players.usage", new Object[0]);
                        }

                        if (args.length != 7)
                        {
                            throw new WrongUsageException("commands.scoreboard.players.operation.usage", new Object[0]);
                        }

                        this.func_175778_p(sender, args, 2);
                    }
                }
                else if (args[0].equalsIgnoreCase("teams"))
                {
                    if (args.length == 1)
                    {
                        throw new WrongUsageException("commands.scoreboard.teams.usage", new Object[0]);
                    }

                    if (args[1].equalsIgnoreCase("list"))
                    {
                        if (args.length > 3)
                        {
                            throw new WrongUsageException("commands.scoreboard.teams.list.usage", new Object[0]);
                        }

                        this.listTeams(sender, args, 2);
                    }
                    else if (args[1].equalsIgnoreCase("add"))
                    {
                        if (args.length < 3)
                        {
                            throw new WrongUsageException("commands.scoreboard.teams.add.usage", new Object[0]);
                        }

                        this.addTeam(sender, args, 2);
                    }
                    else if (args[1].equalsIgnoreCase("remove"))
                    {
                        if (args.length != 3)
                        {
                            throw new WrongUsageException("commands.scoreboard.teams.remove.usage", new Object[0]);
                        }

                        this.removeTeam(sender, args, 2);
                    }
                    else if (args[1].equalsIgnoreCase("empty"))
                    {
                        if (args.length != 3)
                        {
                            throw new WrongUsageException("commands.scoreboard.teams.empty.usage", new Object[0]);
                        }

                        this.emptyTeam(sender, args, 2);
                    }
                    else if (args[1].equalsIgnoreCase("join"))
                    {
                        if (args.length < 4 && (args.length != 3 || !(sender instanceof EntityPlayer)))
                        {
                            throw new WrongUsageException("commands.scoreboard.teams.join.usage", new Object[0]);
                        }

                        this.joinTeam(sender, args, 2);
                    }
                    else if (args[1].equalsIgnoreCase("leave"))
                    {
                        if (args.length < 3 && !(sender instanceof EntityPlayer))
                        {
                            throw new WrongUsageException("commands.scoreboard.teams.leave.usage", new Object[0]);
                        }

                        this.leaveTeam(sender, args, 2);
                    }
                    else
                    {
                        if (!args[1].equalsIgnoreCase("option"))
                        {
                            throw new WrongUsageException("commands.scoreboard.teams.usage", new Object[0]);
                        }

                        if (args.length != 4 && args.length != 5)
                        {
                            throw new WrongUsageException("commands.scoreboard.teams.option.usage", new Object[0]);
                        }

                        this.setTeamOption(sender, args, 2);
                    }
                }
            }
        }
    }

    private boolean func_175780_b(ICommandSender p_175780_1_, String[] p_175780_2_) throws CommandException
    {
        int var3 = -1;

        for (int var4 = 0; var4 < p_175780_2_.length; ++var4)
        {
            if (this.isUsernameIndex(p_175780_2_, var4) && "*".equals(p_175780_2_[var4]))
            {
                if (var3 >= 0)
                {
                    throw new CommandException("commands.scoreboard.noMultiWildcard", new Object[0]);
                }

                var3 = var4;
            }
        }

        if (var3 < 0)
        {
            return false;
        }
        else
        {
            ArrayList var12 = Lists.newArrayList(this.getScoreboard().getObjectiveNames());
            String var5 = p_175780_2_[var3];
            ArrayList var6 = Lists.newArrayList();
            Iterator var7 = var12.iterator();

            while (var7.hasNext())
            {
                String var8 = (String)var7.next();
                p_175780_2_[var3] = var8;

                try
                {
                    this.processCommand(p_175780_1_, p_175780_2_);
                    var6.add(var8);
                }
                catch (CommandException var11)
                {
                    ChatComponentTranslation var10 = new ChatComponentTranslation(var11.getMessage(), var11.getErrorOjbects());
                    var10.getChatStyle().setColor(EnumChatFormatting.RED);
                    p_175780_1_.addChatMessage(var10);
                }
            }

            p_175780_2_[var3] = var5;
            p_175780_1_.func_174794_a(CommandResultStats.Type.AFFECTED_ENTITIES, var6.size());

            if (var6.size() == 0)
            {
                throw new WrongUsageException("commands.scoreboard.allMatchesFailed", new Object[0]);
            }
            else
            {
                return true;
            }
        }
    }

    protected Scoreboard getScoreboard()
    {
        return MinecraftServer.getServer().worldServerForDimension(0).getScoreboard();
    }

    protected ScoreObjective func_147189_a(String name, boolean edit) throws CommandException
    {
        Scoreboard var3 = this.getScoreboard();
        ScoreObjective var4 = var3.getObjective(name);

        if (var4 == null)
        {
            throw new CommandException("commands.scoreboard.objectiveNotFound", new Object[] {name});
        }
        else if (edit && var4.getCriteria().isReadOnly())
        {
            throw new CommandException("commands.scoreboard.objectiveReadOnly", new Object[] {name});
        }
        else
        {
            return var4;
        }
    }

    protected ScorePlayerTeam func_147183_a(String name) throws CommandException
    {
        Scoreboard var2 = this.getScoreboard();
        ScorePlayerTeam var3 = var2.getTeam(name);

        if (var3 == null)
        {
            throw new CommandException("commands.scoreboard.teamNotFound", new Object[] {name});
        }
        else
        {
            return var3;
        }
    }

    protected void addObjective(ICommandSender sender, String[] args, int index) throws CommandException
    {
        String var4 = args[index++];
        String var5 = args[index++];
        Scoreboard var6 = this.getScoreboard();
        IScoreObjectiveCriteria var7 = (IScoreObjectiveCriteria)IScoreObjectiveCriteria.INSTANCES.get(var5);

        if (var7 == null)
        {
            throw new WrongUsageException("commands.scoreboard.objectives.add.wrongType", new Object[] {var5});
        }
        else if (var6.getObjective(var4) != null)
        {
            throw new CommandException("commands.scoreboard.objectives.add.alreadyExists", new Object[] {var4});
        }
        else if (var4.length() > 16)
        {
            throw new SyntaxErrorException("commands.scoreboard.objectives.add.tooLong", new Object[] {var4, Integer.valueOf(16)});
        }
        else if (var4.length() == 0)
        {
            throw new WrongUsageException("commands.scoreboard.objectives.add.usage", new Object[0]);
        }
        else
        {
            if (args.length > index)
            {
                String var8 = getChatComponentFromNthArg(sender, args, index).getUnformattedText();

                if (var8.length() > 32)
                {
                    throw new SyntaxErrorException("commands.scoreboard.objectives.add.displayTooLong", new Object[] {var8, Integer.valueOf(32)});
                }

                if (var8.length() > 0)
                {
                    var6.addScoreObjective(var4, var7).setDisplayName(var8);
                }
                else
                {
                    var6.addScoreObjective(var4, var7);
                }
            }
            else
            {
                var6.addScoreObjective(var4, var7);
            }

            notifyOperators(sender, this, "commands.scoreboard.objectives.add.success", new Object[] {var4});
        }
    }

    protected void addTeam(ICommandSender p_147185_1_, String[] p_147185_2_, int p_147185_3_) throws CommandException
    {
        String var4 = p_147185_2_[p_147185_3_++];
        Scoreboard var5 = this.getScoreboard();

        if (var5.getTeam(var4) != null)
        {
            throw new CommandException("commands.scoreboard.teams.add.alreadyExists", new Object[] {var4});
        }
        else if (var4.length() > 16)
        {
            throw new SyntaxErrorException("commands.scoreboard.teams.add.tooLong", new Object[] {var4, Integer.valueOf(16)});
        }
        else if (var4.length() == 0)
        {
            throw new WrongUsageException("commands.scoreboard.teams.add.usage", new Object[0]);
        }
        else
        {
            if (p_147185_2_.length > p_147185_3_)
            {
                String var6 = getChatComponentFromNthArg(p_147185_1_, p_147185_2_, p_147185_3_).getUnformattedText();

                if (var6.length() > 32)
                {
                    throw new SyntaxErrorException("commands.scoreboard.teams.add.displayTooLong", new Object[] {var6, Integer.valueOf(32)});
                }

                if (var6.length() > 0)
                {
                    var5.createTeam(var4).setTeamName(var6);
                }
                else
                {
                    var5.createTeam(var4);
                }
            }
            else
            {
                var5.createTeam(var4);
            }

            notifyOperators(p_147185_1_, this, "commands.scoreboard.teams.add.success", new Object[] {var4});
        }
    }

    protected void setTeamOption(ICommandSender p_147200_1_, String[] p_147200_2_, int p_147200_3_) throws CommandException
    {
        ScorePlayerTeam var4 = this.func_147183_a(p_147200_2_[p_147200_3_++]);

        if (var4 != null)
        {
            String var5 = p_147200_2_[p_147200_3_++].toLowerCase();

            if (!var5.equalsIgnoreCase("color") && !var5.equalsIgnoreCase("friendlyfire") && !var5.equalsIgnoreCase("seeFriendlyInvisibles") && !var5.equalsIgnoreCase("nametagVisibility") && !var5.equalsIgnoreCase("deathMessageVisibility"))
            {
                throw new WrongUsageException("commands.scoreboard.teams.option.usage", new Object[0]);
            }
            else if (p_147200_2_.length == 4)
            {
                if (var5.equalsIgnoreCase("color"))
                {
                    throw new WrongUsageException("commands.scoreboard.teams.option.noValue", new Object[] {var5, joinNiceStringFromCollection(EnumChatFormatting.getValidValues(true, false))});
                }
                else if (!var5.equalsIgnoreCase("friendlyfire") && !var5.equalsIgnoreCase("seeFriendlyInvisibles"))
                {
                    if (!var5.equalsIgnoreCase("nametagVisibility") && !var5.equalsIgnoreCase("deathMessageVisibility"))
                    {
                        throw new WrongUsageException("commands.scoreboard.teams.option.usage", new Object[0]);
                    }
                    else
                    {
                        throw new WrongUsageException("commands.scoreboard.teams.option.noValue", new Object[] {var5, joinNiceString(Team.EnumVisible.func_178825_a())});
                    }
                }
                else
                {
                    throw new WrongUsageException("commands.scoreboard.teams.option.noValue", new Object[] {var5, joinNiceStringFromCollection(Arrays.asList(new String[]{"true", "false"}))});
                }
            }
            else
            {
                String var6 = p_147200_2_[p_147200_3_];

                if (var5.equalsIgnoreCase("color"))
                {
                    EnumChatFormatting var7 = EnumChatFormatting.getValueByName(var6);

                    if (var7 == null || var7.isFancyStyling())
                    {
                        throw new WrongUsageException("commands.scoreboard.teams.option.noValue", new Object[] {var5, joinNiceStringFromCollection(EnumChatFormatting.getValidValues(true, false))});
                    }

                    var4.func_178774_a(var7);
                    var4.setNamePrefix(var7.toString());
                    var4.setNameSuffix(EnumChatFormatting.RESET.toString());
                }
                else if (var5.equalsIgnoreCase("friendlyfire"))
                {
                    if (!var6.equalsIgnoreCase("true") && !var6.equalsIgnoreCase("false"))
                    {
                        throw new WrongUsageException("commands.scoreboard.teams.option.noValue", new Object[] {var5, joinNiceStringFromCollection(Arrays.asList(new String[]{"true", "false"}))});
                    }

                    var4.setAllowFriendlyFire(var6.equalsIgnoreCase("true"));
                }
                else if (var5.equalsIgnoreCase("seeFriendlyInvisibles"))
                {
                    if (!var6.equalsIgnoreCase("true") && !var6.equalsIgnoreCase("false"))
                    {
                        throw new WrongUsageException("commands.scoreboard.teams.option.noValue", new Object[] {var5, joinNiceStringFromCollection(Arrays.asList(new String[]{"true", "false"}))});
                    }

                    var4.setSeeFriendlyInvisiblesEnabled(var6.equalsIgnoreCase("true"));
                }
                else
                {
                    Team.EnumVisible var8;

                    if (var5.equalsIgnoreCase("nametagVisibility"))
                    {
                        var8 = Team.EnumVisible.func_178824_a(var6);

                        if (var8 == null)
                        {
                            throw new WrongUsageException("commands.scoreboard.teams.option.noValue", new Object[] {var5, joinNiceString(Team.EnumVisible.func_178825_a())});
                        }

                        var4.func_178772_a(var8);
                    }
                    else if (var5.equalsIgnoreCase("deathMessageVisibility"))
                    {
                        var8 = Team.EnumVisible.func_178824_a(var6);

                        if (var8 == null)
                        {
                            throw new WrongUsageException("commands.scoreboard.teams.option.noValue", new Object[] {var5, joinNiceString(Team.EnumVisible.func_178825_a())});
                        }

                        var4.func_178773_b(var8);
                    }
                }

                notifyOperators(p_147200_1_, this, "commands.scoreboard.teams.option.success", new Object[] {var5, var4.getRegisteredName(), var6});
            }
        }
    }

    protected void removeTeam(ICommandSender p_147194_1_, String[] p_147194_2_, int p_147194_3_) throws CommandException
    {
        Scoreboard var4 = this.getScoreboard();
        ScorePlayerTeam var5 = this.func_147183_a(p_147194_2_[p_147194_3_]);

        if (var5 != null)
        {
            var4.removeTeam(var5);
            notifyOperators(p_147194_1_, this, "commands.scoreboard.teams.remove.success", new Object[] {var5.getRegisteredName()});
        }
    }

    protected void listTeams(ICommandSender p_147186_1_, String[] p_147186_2_, int p_147186_3_) throws CommandException
    {
        Scoreboard var4 = this.getScoreboard();

        if (p_147186_2_.length > p_147186_3_)
        {
            ScorePlayerTeam var5 = this.func_147183_a(p_147186_2_[p_147186_3_]);

            if (var5 == null)
            {
                return;
            }

            Collection var6 = var5.getMembershipCollection();
            p_147186_1_.func_174794_a(CommandResultStats.Type.QUERY_RESULT, var6.size());

            if (var6.size() <= 0)
            {
                throw new CommandException("commands.scoreboard.teams.list.player.empty", new Object[] {var5.getRegisteredName()});
            }

            ChatComponentTranslation var7 = new ChatComponentTranslation("commands.scoreboard.teams.list.player.count", new Object[] {Integer.valueOf(var6.size()), var5.getRegisteredName()});
            var7.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN);
            p_147186_1_.addChatMessage(var7);
            p_147186_1_.addChatMessage(new ChatComponentText(joinNiceString(var6.toArray())));
        }
        else
        {
            Collection var9 = var4.getTeams();
            p_147186_1_.func_174794_a(CommandResultStats.Type.QUERY_RESULT, var9.size());

            if (var9.size() <= 0)
            {
                throw new CommandException("commands.scoreboard.teams.list.empty", new Object[0]);
            }

            ChatComponentTranslation var10 = new ChatComponentTranslation("commands.scoreboard.teams.list.count", new Object[] {Integer.valueOf(var9.size())});
            var10.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN);
            p_147186_1_.addChatMessage(var10);
            Iterator var11 = var9.iterator();

            while (var11.hasNext())
            {
                ScorePlayerTeam var8 = (ScorePlayerTeam)var11.next();
                p_147186_1_.addChatMessage(new ChatComponentTranslation("commands.scoreboard.teams.list.entry", new Object[] {var8.getRegisteredName(), var8.func_96669_c(), Integer.valueOf(var8.getMembershipCollection().size())}));
            }
        }
    }

    protected void joinTeam(ICommandSender p_147190_1_, String[] p_147190_2_, int p_147190_3_) throws CommandException
    {
        Scoreboard var4 = this.getScoreboard();
        String var5 = p_147190_2_[p_147190_3_++];
        HashSet var6 = Sets.newHashSet();
        HashSet var7 = Sets.newHashSet();
        String var8;

        if (p_147190_1_ instanceof EntityPlayer && p_147190_3_ == p_147190_2_.length)
        {
            var8 = getCommandSenderAsPlayer(p_147190_1_).getName();

            if (var4.func_151392_a(var8, var5))
            {
                var6.add(var8);
            }
            else
            {
                var7.add(var8);
            }
        }
        else
        {
            while (p_147190_3_ < p_147190_2_.length)
            {
                var8 = p_147190_2_[p_147190_3_++];

                if (var8.startsWith("@"))
                {
                    List var13 = func_175763_c(p_147190_1_, var8);
                    Iterator var10 = var13.iterator();

                    while (var10.hasNext())
                    {
                        Entity var11 = (Entity)var10.next();
                        String var12 = func_175758_e(p_147190_1_, var11.getUniqueID().toString());

                        if (var4.func_151392_a(var12, var5))
                        {
                            var6.add(var12);
                        }
                        else
                        {
                            var7.add(var12);
                        }
                    }
                }
                else
                {
                    String var9 = func_175758_e(p_147190_1_, var8);

                    if (var4.func_151392_a(var9, var5))
                    {
                        var6.add(var9);
                    }
                    else
                    {
                        var7.add(var9);
                    }
                }
            }
        }

        if (!var6.isEmpty())
        {
            p_147190_1_.func_174794_a(CommandResultStats.Type.AFFECTED_ENTITIES, var6.size());
            notifyOperators(p_147190_1_, this, "commands.scoreboard.teams.join.success", new Object[] {Integer.valueOf(var6.size()), var5, joinNiceString(var6.toArray(new String[0]))});
        }

        if (!var7.isEmpty())
        {
            throw new CommandException("commands.scoreboard.teams.join.failure", new Object[] {Integer.valueOf(var7.size()), var5, joinNiceString(var7.toArray(new String[0]))});
        }
    }

    protected void leaveTeam(ICommandSender p_147199_1_, String[] p_147199_2_, int p_147199_3_) throws CommandException
    {
        Scoreboard var4 = this.getScoreboard();
        HashSet var5 = Sets.newHashSet();
        HashSet var6 = Sets.newHashSet();
        String var7;

        if (p_147199_1_ instanceof EntityPlayer && p_147199_3_ == p_147199_2_.length)
        {
            var7 = getCommandSenderAsPlayer(p_147199_1_).getName();

            if (var4.removePlayerFromTeams(var7))
            {
                var5.add(var7);
            }
            else
            {
                var6.add(var7);
            }
        }
        else
        {
            while (p_147199_3_ < p_147199_2_.length)
            {
                var7 = p_147199_2_[p_147199_3_++];

                if (var7.startsWith("@"))
                {
                    List var12 = func_175763_c(p_147199_1_, var7);
                    Iterator var9 = var12.iterator();

                    while (var9.hasNext())
                    {
                        Entity var10 = (Entity)var9.next();
                        String var11 = func_175758_e(p_147199_1_, var10.getUniqueID().toString());

                        if (var4.removePlayerFromTeams(var11))
                        {
                            var5.add(var11);
                        }
                        else
                        {
                            var6.add(var11);
                        }
                    }
                }
                else
                {
                    String var8 = func_175758_e(p_147199_1_, var7);

                    if (var4.removePlayerFromTeams(var8))
                    {
                        var5.add(var8);
                    }
                    else
                    {
                        var6.add(var8);
                    }
                }
            }
        }

        if (!var5.isEmpty())
        {
            p_147199_1_.func_174794_a(CommandResultStats.Type.AFFECTED_ENTITIES, var5.size());
            notifyOperators(p_147199_1_, this, "commands.scoreboard.teams.leave.success", new Object[] {Integer.valueOf(var5.size()), joinNiceString(var5.toArray(new String[0]))});
        }

        if (!var6.isEmpty())
        {
            throw new CommandException("commands.scoreboard.teams.leave.failure", new Object[] {Integer.valueOf(var6.size()), joinNiceString(var6.toArray(new String[0]))});
        }
    }

    protected void emptyTeam(ICommandSender p_147188_1_, String[] p_147188_2_, int p_147188_3_) throws CommandException
    {
        Scoreboard var4 = this.getScoreboard();
        ScorePlayerTeam var5 = this.func_147183_a(p_147188_2_[p_147188_3_]);

        if (var5 != null)
        {
            ArrayList var6 = Lists.newArrayList(var5.getMembershipCollection());
            p_147188_1_.func_174794_a(CommandResultStats.Type.AFFECTED_ENTITIES, var6.size());

            if (var6.isEmpty())
            {
                throw new CommandException("commands.scoreboard.teams.empty.alreadyEmpty", new Object[] {var5.getRegisteredName()});
            }
            else
            {
                Iterator var7 = var6.iterator();

                while (var7.hasNext())
                {
                    String var8 = (String)var7.next();
                    var4.removePlayerFromTeam(var8, var5);
                }

                notifyOperators(p_147188_1_, this, "commands.scoreboard.teams.empty.success", new Object[] {Integer.valueOf(var6.size()), var5.getRegisteredName()});
            }
        }
    }

    protected void removeObjective(ICommandSender p_147191_1_, String p_147191_2_) throws CommandException
    {
        Scoreboard var3 = this.getScoreboard();
        ScoreObjective var4 = this.func_147189_a(p_147191_2_, false);
        var3.func_96519_k(var4);
        notifyOperators(p_147191_1_, this, "commands.scoreboard.objectives.remove.success", new Object[] {p_147191_2_});
    }

    protected void listObjectives(ICommandSender p_147196_1_) throws CommandException
    {
        Scoreboard var2 = this.getScoreboard();
        Collection var3 = var2.getScoreObjectives();

        if (var3.size() <= 0)
        {
            throw new CommandException("commands.scoreboard.objectives.list.empty", new Object[0]);
        }
        else
        {
            ChatComponentTranslation var4 = new ChatComponentTranslation("commands.scoreboard.objectives.list.count", new Object[] {Integer.valueOf(var3.size())});
            var4.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN);
            p_147196_1_.addChatMessage(var4);
            Iterator var5 = var3.iterator();

            while (var5.hasNext())
            {
                ScoreObjective var6 = (ScoreObjective)var5.next();
                p_147196_1_.addChatMessage(new ChatComponentTranslation("commands.scoreboard.objectives.list.entry", new Object[] {var6.getName(), var6.getDisplayName(), var6.getCriteria().getName()}));
            }
        }
    }

    protected void setObjectiveDisplay(ICommandSender p_147198_1_, String[] p_147198_2_, int p_147198_3_) throws CommandException
    {
        Scoreboard var4 = this.getScoreboard();
        String var5 = p_147198_2_[p_147198_3_++];
        int var6 = Scoreboard.getObjectiveDisplaySlotNumber(var5);
        ScoreObjective var7 = null;

        if (p_147198_2_.length == 4)
        {
            var7 = this.func_147189_a(p_147198_2_[p_147198_3_], false);
        }

        if (var6 < 0)
        {
            throw new CommandException("commands.scoreboard.objectives.setdisplay.invalidSlot", new Object[] {var5});
        }
        else
        {
            var4.setObjectiveInDisplaySlot(var6, var7);

            if (var7 != null)
            {
                notifyOperators(p_147198_1_, this, "commands.scoreboard.objectives.setdisplay.successSet", new Object[] {Scoreboard.getObjectiveDisplaySlot(var6), var7.getName()});
            }
            else
            {
                notifyOperators(p_147198_1_, this, "commands.scoreboard.objectives.setdisplay.successCleared", new Object[] {Scoreboard.getObjectiveDisplaySlot(var6)});
            }
        }
    }

    protected void listPlayers(ICommandSender p_147195_1_, String[] p_147195_2_, int p_147195_3_) throws CommandException
    {
        Scoreboard var4 = this.getScoreboard();

        if (p_147195_2_.length > p_147195_3_)
        {
            String var5 = func_175758_e(p_147195_1_, p_147195_2_[p_147195_3_]);
            Map var6 = var4.func_96510_d(var5);
            p_147195_1_.func_174794_a(CommandResultStats.Type.QUERY_RESULT, var6.size());

            if (var6.size() <= 0)
            {
                throw new CommandException("commands.scoreboard.players.list.player.empty", new Object[] {var5});
            }

            ChatComponentTranslation var7 = new ChatComponentTranslation("commands.scoreboard.players.list.player.count", new Object[] {Integer.valueOf(var6.size()), var5});
            var7.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN);
            p_147195_1_.addChatMessage(var7);
            Iterator var8 = var6.values().iterator();

            while (var8.hasNext())
            {
                Score var9 = (Score)var8.next();
                p_147195_1_.addChatMessage(new ChatComponentTranslation("commands.scoreboard.players.list.player.entry", new Object[] {Integer.valueOf(var9.getScorePoints()), var9.getObjective().getDisplayName(), var9.getObjective().getName()}));
            }
        }
        else
        {
            Collection var10 = var4.getObjectiveNames();
            p_147195_1_.func_174794_a(CommandResultStats.Type.QUERY_RESULT, var10.size());

            if (var10.size() <= 0)
            {
                throw new CommandException("commands.scoreboard.players.list.empty", new Object[0]);
            }

            ChatComponentTranslation var11 = new ChatComponentTranslation("commands.scoreboard.players.list.count", new Object[] {Integer.valueOf(var10.size())});
            var11.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN);
            p_147195_1_.addChatMessage(var11);
            p_147195_1_.addChatMessage(new ChatComponentText(joinNiceString(var10.toArray())));
        }
    }

    protected void setPlayer(ICommandSender p_147197_1_, String[] p_147197_2_, int p_147197_3_) throws CommandException
    {
        String var4 = p_147197_2_[p_147197_3_ - 1];
        int var5 = p_147197_3_;
        String var6 = func_175758_e(p_147197_1_, p_147197_2_[p_147197_3_++]);
        ScoreObjective var7 = this.func_147189_a(p_147197_2_[p_147197_3_++], true);
        int var8 = var4.equalsIgnoreCase("set") ? parseInt(p_147197_2_[p_147197_3_++]) : parseInt(p_147197_2_[p_147197_3_++], 0);

        if (p_147197_2_.length > p_147197_3_)
        {
            Entity var9 = func_175768_b(p_147197_1_, p_147197_2_[var5]);

            try
            {
                NBTTagCompound var10 = JsonToNBT.func_180713_a(func_180529_a(p_147197_2_, p_147197_3_));
                NBTTagCompound var11 = new NBTTagCompound();
                var9.writeToNBT(var11);

                if (!CommandTestForBlock.func_175775_a(var10, var11, true))
                {
                    throw new CommandException("commands.scoreboard.players.set.tagMismatch", new Object[] {var6});
                }
            }
            catch (NBTException var12)
            {
                throw new CommandException("commands.scoreboard.players.set.tagError", new Object[] {var12.getMessage()});
            }
        }

        Scoreboard var13 = this.getScoreboard();
        Score var14 = var13.getValueFromObjective(var6, var7);

        if (var4.equalsIgnoreCase("set"))
        {
            var14.setScorePoints(var8);
        }
        else if (var4.equalsIgnoreCase("add"))
        {
            var14.increseScore(var8);
        }
        else
        {
            var14.decreaseScore(var8);
        }

        notifyOperators(p_147197_1_, this, "commands.scoreboard.players.set.success", new Object[] {var7.getName(), var6, Integer.valueOf(var14.getScorePoints())});
    }

    protected void resetPlayers(ICommandSender p_147187_1_, String[] p_147187_2_, int p_147187_3_) throws CommandException
    {
        Scoreboard var4 = this.getScoreboard();
        String var5 = func_175758_e(p_147187_1_, p_147187_2_[p_147187_3_++]);

        if (p_147187_2_.length > p_147187_3_)
        {
            ScoreObjective var6 = this.func_147189_a(p_147187_2_[p_147187_3_++], false);
            var4.func_178822_d(var5, var6);
            notifyOperators(p_147187_1_, this, "commands.scoreboard.players.resetscore.success", new Object[] {var6.getName(), var5});
        }
        else
        {
            var4.func_178822_d(var5, (ScoreObjective)null);
            notifyOperators(p_147187_1_, this, "commands.scoreboard.players.reset.success", new Object[] {var5});
        }
    }

    protected void func_175779_n(ICommandSender p_175779_1_, String[] p_175779_2_, int p_175779_3_) throws CommandException
    {
        Scoreboard var4 = this.getScoreboard();
        String var5 = getPlayerName(p_175779_1_, p_175779_2_[p_175779_3_++]);
        ScoreObjective var6 = this.func_147189_a(p_175779_2_[p_175779_3_], false);

        if (var6.getCriteria() != IScoreObjectiveCriteria.field_178791_c)
        {
            throw new CommandException("commands.scoreboard.players.enable.noTrigger", new Object[] {var6.getName()});
        }
        else
        {
            Score var7 = var4.getValueFromObjective(var5, var6);
            var7.func_178815_a(false);
            notifyOperators(p_175779_1_, this, "commands.scoreboard.players.enable.success", new Object[] {var6.getName(), var5});
        }
    }

    protected void func_175781_o(ICommandSender p_175781_1_, String[] p_175781_2_, int p_175781_3_) throws CommandException
    {
        Scoreboard var4 = this.getScoreboard();
        String var5 = func_175758_e(p_175781_1_, p_175781_2_[p_175781_3_++]);
        ScoreObjective var6 = this.func_147189_a(p_175781_2_[p_175781_3_++], false);

        if (!var4.func_178819_b(var5, var6))
        {
            throw new CommandException("commands.scoreboard.players.test.notFound", new Object[] {var6.getName(), var5});
        }
        else
        {
            int var7 = p_175781_2_[p_175781_3_].equals("*") ? Integer.MIN_VALUE : parseInt(p_175781_2_[p_175781_3_]);
            ++p_175781_3_;
            int var8 = p_175781_3_ < p_175781_2_.length && !p_175781_2_[p_175781_3_].equals("*") ? parseInt(p_175781_2_[p_175781_3_], var7) : Integer.MAX_VALUE;
            Score var9 = var4.getValueFromObjective(var5, var6);

            if (var9.getScorePoints() >= var7 && var9.getScorePoints() <= var8)
            {
                notifyOperators(p_175781_1_, this, "commands.scoreboard.players.test.success", new Object[] {Integer.valueOf(var9.getScorePoints()), Integer.valueOf(var7), Integer.valueOf(var8)});
            }
            else
            {
                throw new CommandException("commands.scoreboard.players.test.failed", new Object[] {Integer.valueOf(var9.getScorePoints()), Integer.valueOf(var7), Integer.valueOf(var8)});
            }
        }
    }

    protected void func_175778_p(ICommandSender p_175778_1_, String[] p_175778_2_, int p_175778_3_) throws CommandException
    {
        Scoreboard var4 = this.getScoreboard();
        String var5 = func_175758_e(p_175778_1_, p_175778_2_[p_175778_3_++]);
        ScoreObjective var6 = this.func_147189_a(p_175778_2_[p_175778_3_++], true);
        String var7 = p_175778_2_[p_175778_3_++];
        String var8 = func_175758_e(p_175778_1_, p_175778_2_[p_175778_3_++]);
        ScoreObjective var9 = this.func_147189_a(p_175778_2_[p_175778_3_], false);
        Score var10 = var4.getValueFromObjective(var5, var6);

        if (!var4.func_178819_b(var8, var9))
        {
            throw new CommandException("commands.scoreboard.players.operation.notFound", new Object[] {var9.getName(), var8});
        }
        else
        {
            Score var11 = var4.getValueFromObjective(var8, var9);

            if (var7.equals("+="))
            {
                var10.setScorePoints(var10.getScorePoints() + var11.getScorePoints());
            }
            else if (var7.equals("-="))
            {
                var10.setScorePoints(var10.getScorePoints() - var11.getScorePoints());
            }
            else if (var7.equals("*="))
            {
                var10.setScorePoints(var10.getScorePoints() * var11.getScorePoints());
            }
            else if (var7.equals("/="))
            {
                if (var11.getScorePoints() != 0)
                {
                    var10.setScorePoints(var10.getScorePoints() / var11.getScorePoints());
                }
            }
            else if (var7.equals("%="))
            {
                if (var11.getScorePoints() != 0)
                {
                    var10.setScorePoints(var10.getScorePoints() % var11.getScorePoints());
                }
            }
            else if (var7.equals("="))
            {
                var10.setScorePoints(var11.getScorePoints());
            }
            else if (var7.equals("<"))
            {
                var10.setScorePoints(Math.min(var10.getScorePoints(), var11.getScorePoints()));
            }
            else if (var7.equals(">"))
            {
                var10.setScorePoints(Math.max(var10.getScorePoints(), var11.getScorePoints()));
            }
            else
            {
                if (!var7.equals("><"))
                {
                    throw new CommandException("commands.scoreboard.players.operation.invalidOperation", new Object[] {var7});
                }

                int var12 = var10.getScorePoints();
                var10.setScorePoints(var11.getScorePoints());
                var11.setScorePoints(var12);
            }

            notifyOperators(p_175778_1_, this, "commands.scoreboard.players.operation.success", new Object[0]);
        }
    }

    public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos)
    {
        if (args.length == 1)
        {
            return getListOfStringsMatchingLastWord(args, new String[] {"objectives", "players", "teams"});
        }
        else
        {
            if (args[0].equalsIgnoreCase("objectives"))
            {
                if (args.length == 2)
                {
                    return getListOfStringsMatchingLastWord(args, new String[] {"list", "add", "remove", "setdisplay"});
                }

                if (args[1].equalsIgnoreCase("add"))
                {
                    if (args.length == 4)
                    {
                        Set var4 = IScoreObjectiveCriteria.INSTANCES.keySet();
                        return func_175762_a(args, var4);
                    }
                }
                else if (args[1].equalsIgnoreCase("remove"))
                {
                    if (args.length == 3)
                    {
                        return func_175762_a(args, this.func_147184_a(false));
                    }
                }
                else if (args[1].equalsIgnoreCase("setdisplay"))
                {
                    if (args.length == 3)
                    {
                        return getListOfStringsMatchingLastWord(args, Scoreboard.func_178821_h());
                    }

                    if (args.length == 4)
                    {
                        return func_175762_a(args, this.func_147184_a(false));
                    }
                }
            }
            else if (args[0].equalsIgnoreCase("players"))
            {
                if (args.length == 2)
                {
                    return getListOfStringsMatchingLastWord(args, new String[] {"set", "add", "remove", "reset", "list", "enable", "test", "operation"});
                }

                if (!args[1].equalsIgnoreCase("set") && !args[1].equalsIgnoreCase("add") && !args[1].equalsIgnoreCase("remove") && !args[1].equalsIgnoreCase("reset"))
                {
                    if (args[1].equalsIgnoreCase("enable"))
                    {
                        if (args.length == 3)
                        {
                            return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames());
                        }

                        if (args.length == 4)
                        {
                            return func_175762_a(args, this.func_175782_e());
                        }
                    }
                    else if (!args[1].equalsIgnoreCase("list") && !args[1].equalsIgnoreCase("test"))
                    {
                        if (args[1].equalsIgnoreCase("operation"))
                        {
                            if (args.length == 3)
                            {
                                return func_175762_a(args, this.getScoreboard().getObjectiveNames());
                            }

                            if (args.length == 4)
                            {
                                return func_175762_a(args, this.func_147184_a(true));
                            }

                            if (args.length == 5)
                            {
                                return getListOfStringsMatchingLastWord(args, new String[] {"+=", "-=", "*=", "/=", "%=", "=", "<", ">", "><"});
                            }

                            if (args.length == 6)
                            {
                                return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames());
                            }

                            if (args.length == 7)
                            {
                                return func_175762_a(args, this.func_147184_a(false));
                            }
                        }
                    }
                    else
                    {
                        if (args.length == 3)
                        {
                            return func_175762_a(args, this.getScoreboard().getObjectiveNames());
                        }

                        if (args.length == 4 && args[1].equalsIgnoreCase("test"))
                        {
                            return func_175762_a(args, this.func_147184_a(false));
                        }
                    }
                }
                else
                {
                    if (args.length == 3)
                    {
                        return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames());
                    }

                    if (args.length == 4)
                    {
                        return func_175762_a(args, this.func_147184_a(true));
                    }
                }
            }
            else if (args[0].equalsIgnoreCase("teams"))
            {
                if (args.length == 2)
                {
                    return getListOfStringsMatchingLastWord(args, new String[] {"add", "remove", "join", "leave", "empty", "list", "option"});
                }

                if (args[1].equalsIgnoreCase("join"))
                {
                    if (args.length == 3)
                    {
                        return func_175762_a(args, this.getScoreboard().getTeamNames());
                    }

                    if (args.length >= 4)
                    {
                        return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames());
                    }
                }
                else
                {
                    if (args[1].equalsIgnoreCase("leave"))
                    {
                        return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames());
                    }

                    if (!args[1].equalsIgnoreCase("empty") && !args[1].equalsIgnoreCase("list") && !args[1].equalsIgnoreCase("remove"))
                    {
                        if (args[1].equalsIgnoreCase("option"))
                        {
                            if (args.length == 3)
                            {
                                return func_175762_a(args, this.getScoreboard().getTeamNames());
                            }

                            if (args.length == 4)
                            {
                                return getListOfStringsMatchingLastWord(args, new String[] {"color", "friendlyfire", "seeFriendlyInvisibles", "nametagVisibility", "deathMessageVisibility"});
                            }

                            if (args.length == 5)
                            {
                                if (args[3].equalsIgnoreCase("color"))
                                {
                                    return func_175762_a(args, EnumChatFormatting.getValidValues(true, false));
                                }

                                if (args[3].equalsIgnoreCase("nametagVisibility") || args[3].equalsIgnoreCase("deathMessageVisibility"))
                                {
                                    return getListOfStringsMatchingLastWord(args, Team.EnumVisible.func_178825_a());
                                }

                                if (args[3].equalsIgnoreCase("friendlyfire") || args[3].equalsIgnoreCase("seeFriendlyInvisibles"))
                                {
                                    return getListOfStringsMatchingLastWord(args, new String[] {"true", "false"});
                                }
                            }
                        }
                    }
                    else if (args.length == 3)
                    {
                        return func_175762_a(args, this.getScoreboard().getTeamNames());
                    }
                }
            }

            return null;
        }
    }

    protected List func_147184_a(boolean p_147184_1_)
    {
        Collection var2 = this.getScoreboard().getScoreObjectives();
        ArrayList var3 = Lists.newArrayList();
        Iterator var4 = var2.iterator();

        while (var4.hasNext())
        {
            ScoreObjective var5 = (ScoreObjective)var4.next();

            if (!p_147184_1_ || !var5.getCriteria().isReadOnly())
            {
                var3.add(var5.getName());
            }
        }

        return var3;
    }

    protected List func_175782_e()
    {
        Collection var1 = this.getScoreboard().getScoreObjectives();
        ArrayList var2 = Lists.newArrayList();
        Iterator var3 = var1.iterator();

        while (var3.hasNext())
        {
            ScoreObjective var4 = (ScoreObjective)var3.next();

            if (var4.getCriteria() == IScoreObjectiveCriteria.field_178791_c)
            {
                var2.add(var4.getName());
            }
        }

        return var2;
    }

    /**
     * Return whether the specified command parameter index is a username parameter.
     */
    public boolean isUsernameIndex(String[] args, int index)
    {
        return !args[0].equalsIgnoreCase("players") ? (args[0].equalsIgnoreCase("teams") ? index == 2 : false) : (args.length > 1 && args[1].equalsIgnoreCase("operation") ? index == 2 || index == 5 : index == 2);
    }
}


text:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="nu.postnummeruppror.insamlingsappen.AccountActivity" >

</menu>

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.github.mervyn</groupId>
    <artifactId>java-learn</artifactId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>
  <groupId>org.github.mervyn.multithreaded</groupId>
  <artifactId>java-learn-multithreaded</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>java-learn-multithreaded</name>
  <url>http://maven.apache.org</url>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
  </dependencies>
</project>


text:
package io.github.carlorodriguez.alarmon;

import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.TranslateAnimation;
import android.view.animation.Animation.AnimationListener;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.ImageView.ScaleType;

/**
 * Widget that contains a slider bar used for acknowledgments.  The user
 * must slide an arrow sufficiently far enough across the bar in order
 * to trigger the acknowledgment.
 */
public class Slider extends ViewGroup {
  public interface OnCompleteListener {
    void complete();
  }

  private static final int FADE_MILLIS = 200;
  private static final int SLIDE_MILLIS = 200;
  private static final float SLIDE_ACCEL = (float) 1.0;
  private static final double PERCENT_REQUIRED = 0.72;

  private ImageView dot;
  private TextView tray;
  private boolean tracking;
  private OnCompleteListener completeListener;

  public Slider(Context context) {
    this(context, null, 0);
  }

  public Slider(Context context, AttributeSet attrs) {
    this(context, attrs, 0);
  }

  public Slider(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    // Setup the background which 'holds' the slider.
    tray = new TextView(getContext());
    tray.setBackgroundResource(R.drawable.slider_background);
    tray.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    tray.setGravity(Gravity.CENTER);

    if (Build.VERSION.SDK_INT < 23) {
        tray.setTextAppearance(getContext(), R.style.SliderText);
    } else {
        tray.setTextAppearance(R.style.SliderText);
    }

    tray.setText(R.string.dismiss);
    addView(tray);

    // Setup the object which will be slid.
    dot = new ImageView(getContext());
    dot.setImageResource(R.drawable.ic_forward);
    dot.setBackgroundResource(R.drawable.slider_btn);
    dot.setScaleType(ScaleType.CENTER);
    dot.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    dot.setPadding(30, 10, 25, 15);
    addView(dot);

    reset();
  }

  public void setOnCompleteListener(OnCompleteListener listener) {
    completeListener = listener;
  }

  public void reset() {
    tracking = false;
    // Move the dot home and fade in.
    if (getVisibility() != View.VISIBLE) {
      dot.offsetLeftAndRight(getLeft() - dot.getLeft());
      setVisibility(View.VISIBLE);
      Animation fadeIn = new AlphaAnimation(0, 1);
      fadeIn.setDuration(FADE_MILLIS);
      startAnimation(fadeIn);
    }
  }

  @Override
  protected void onLayout(boolean changed, int l, int t, int r, int b) {
    if (!changed) {
      return;
    }
    // Start the dot left-aligned.
    dot.layout(0, 7, dot.getMeasuredWidth(), dot.getMeasuredHeight());
    // Make the tray fill the background.
    tray.layout(0, 0, getMeasuredWidth(), getMeasuredHeight());
  }

  @Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    tray.measure(widthMeasureSpec, heightMeasureSpec);
    dot.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
        heightMeasureSpec);
    setMeasuredDimension(
        Math.max(tray.getMeasuredWidth(), dot.getMeasuredWidth()),
        Math.max(tray.getMeasuredHeight(), dot.getMeasuredHeight()));
  }

  private boolean withinX(View v, float x) {
    return !(x < v.getLeft() || x > v.getRight());
  }

  private boolean withinY(View v, float y) {
    return !(y < v.getTop() || y > v.getBottom());
  }

  private void slideDotHome() {
    int distanceFromStart = dot.getLeft() - getLeft();
    dot.offsetLeftAndRight(-distanceFromStart);
    Animation slideBack = new TranslateAnimation(distanceFromStart, 0, 0, 0);
    slideBack.setDuration(SLIDE_MILLIS);
    slideBack.setInterpolator(new DecelerateInterpolator(SLIDE_ACCEL));
    dot.startAnimation(slideBack);
  }

  private boolean isComplete() {
    double dotCenterY = dot.getLeft() + dot.getMeasuredWidth()/2.0;
    float progressPercent = (float)(dotCenterY - getLeft()) / (float)(getRight() - getLeft());
    return progressPercent > PERCENT_REQUIRED;
  }

  private void finishSlider() {
    setVisibility(View.INVISIBLE);
    Animation fadeOut = new AlphaAnimation(1, 0);
    fadeOut.setDuration(FADE_MILLIS);
    fadeOut.setAnimationListener(new AnimationListener() {
      @Override
      public void onAnimationEnd(Animation animation) {
        if (completeListener != null) {
          completeListener.complete();
        }
      }
      @Override
      public void onAnimationRepeat(Animation animation) {}
      @Override
      public void onAnimationStart(Animation animation) {}
    });
    startAnimation(fadeOut);
  }

  @Override
  public boolean onTouchEvent(MotionEvent event) {
    final int action = event.getAction();
    final float x = event.getX();
    final float y = event.getY();
    switch (action) {
      case MotionEvent.ACTION_DOWN:
        // Start tracking if the down event is in the dot.
        tracking = withinX(dot, x) && withinY(dot, y);
        return tracking || super.onTouchEvent(event);

      case MotionEvent.ACTION_CANCEL:
      case MotionEvent.ACTION_UP:
        // Ignore move events which did not originate in the dot.
        if (!tracking) {
          return super.onTouchEvent(event);
        }
        // The dot has been released, check to see if we've hit the threshold,
        // otherwise, send the dot home.
        tracking = false;
        if (isComplete()) {
          finishSlider();
        } else {
          slideDotHome();
        }
        return true;

      case MotionEvent.ACTION_MOVE:
        // Ignore move events which did not originate in the dot.
        if (!tracking) {
          return super.onTouchEvent(event);
        }
        // Update the current location.
        dot.offsetLeftAndRight((int) (x - dot.getLeft() - dot.getWidth()/2.0 ));

        // See if we have reached the threshold.
        if (isComplete()) {
          tracking = false;
          finishSlider();
          return true;
        }

        // Otherwise, we have not yet hit the completion threshold. Make sure
        // the move is still within bounds of the dot and redraw.
        if (!withinY(dot, y)) {
          // Slid out of the slider, reset to the beginning.
          tracking = false;
          slideDotHome();
        } else {
          invalidate();
        }
        return true;

      default:
        return super.onTouchEvent(event);
    }
  }
}


text:
SELECT extract_vodslist();

SELECT * from e_vodslist\G


text:
import { jest } from '@jest/globals'
import render from '../lib/render.js'
import { renderOpts } from './common.js'

let mockExit

beforeAll(() => {
  jest.spyOn(console, 'error').mockImplementation(() => {})
  mockExit = jest.spyOn(process, 'exit').mockImplementation(() => {})
})
it('should render for a markdown with block', async () => {
  expect(
    await render('tests/fixtures/prose.md', {
      ...renderOpts,
      clean: true,
    })
  ).toMatchSnapshot()
})

it('should throw for rendering errors', async () => {
  await expect(() =>
    render('tests/fixtures/prose.md', {
      ...renderOpts,
      templates: ['tests/fix'],
    })
  ).rejects.toThrowError(`(unknown path)
  Error: template not found: default.njk`)
})

it('should exit on unexpected errors', async () => {
  expect(await render('tests/fixtures/pros.md', {})).toBeUndefined()
  expect(mockExit).toHaveBeenCalledWith(1)
})


text:
"""Network definitions for LeNet5."""
from typing import Sequence

from absl import logging
import chex
from enn.networks import base as networks_base
from enn.networks import ensembles
import haiku as hk
import jax

_LeNet5_CHANNELS = (6, 16, 120)

class LeNet5(hk.Module):
  """VGG Network with batchnorm and without maxpool."""

  def __init__(self,
               num_output_classes: int,
               lenet_output_channels: Sequence[int] = _LeNet5_CHANNELS,):
    super().__init__()
    logging.info('Initializing a LeNet5.')
    self._output_channels = lenet_output_channels
    num_channels = len(self._output_channels)

    self._conv_modules = [
        hk.Conv2D(  # pylint: disable=g-complex-comprehension
            output_channels=self._output_channels[i],
            kernel_shape=5,
            padding='SAME',
            name=f'conv_2d_{i}') for i in range(num_channels)
    ]
    self._mp_modules = [
        hk.MaxPool(  # pylint: disable=g-complex-comprehension
            window_shape=2, strides=2, padding='SAME',
            name=f'max_pool_{i}') for i in range(num_channels)
    ]
    self._flatten_module = hk.Flatten()
    self._linear_module = hk.Linear(84, name='linear')
    self._logits_module = hk.Linear(num_output_classes, name='logits')

  def __call__(self, inputs: chex.Array) -> chex.Array:
    net = inputs
    for conv_layer, mp_layer in zip(self._conv_modules, self._mp_modules):
      net = conv_layer(net)
      net = jax.nn.relu(net)
      net = mp_layer(net)
    net = self._flatten_module(net)
    net = self._linear_module(net)
    net = jax.nn.relu(net)
    return self._logits_module(net)

class EnsembleLeNet5ENN(networks_base.EnnArray):
  """Ensemble of LeNet5 Networks created using einsum ensemble."""

  def __init__(self,
               num_output_classes: int,
               num_ensemble: int = 1,):
    def net_fn(x: chex.Array) -> chex.Array:
      return LeNet5(num_output_classes)(x)
    transformed = hk.without_apply_rng(hk.transform_with_state(net_fn))
    enn = ensembles.EnsembleWithState(transformed, num_ensemble)
    super().__init__(enn.apply, enn.init, enn.indexer)


text:
Redux Resource complements, but does not replace, form libraries. If you're already using a form
library, we encourage you to continue using it alongside Redux Resource.

### Recommendations

The following are two popular forms libraries for Redux:

- [react-redux-form](https://github.com/davidkpiano/react-redux-form)
- [redux-form](https://github.com/erikras/redux-form)

Using component state for form data is also worth considering. However you decide to
manage your form data, it should work well alongside Redux Resource.

### Using Resource Slices

You can also store form information inside of the resource slice. A  Redux best practice is to
separate your client-side data from your server-side data, so form information should
be kept separate from the actual resource objects themselves.

Instead, you might choose to use [`meta`](../resources/meta.md) for form information, or
perhaps an additional "top-level" key within the resource slice, such as `forms`.

One thing to consider before going with this approach is whether or not your form allows a user
to modify more than one resource at a time. If it does, then you may want to consider storing
the form data outside of an individual resource slice.


text:
<!DOCTYPE frameset SYSTEM "frameset.dtd">
<frameset>
    <predicate lemma="costume">
        <note>
            Frames file for 'costume' based on sentences in financial subcorpus.
            No Verbnet entry.
        </note>

        <roleset id="costume.01" name="put into a costume" vncls="-">
            <roles>
                <role descr="costumer, wardrobe designer" n="0"/>
                <role descr="person wearing costume" n="1"/>
                <role descr="costume" n="2"/>
            </roles>

            <example name="missing designer">
                <inflection aspect="ns" form="participle" person="ns" tense="ns" voice="passive"/>
                <text>
                    *trace*-1 Inexplicably costumed *trace*-1 as a rabbinical student,
                    tottering around on lifts, [Mr. Shicoff]-1 hardly seemed the fellow
                    to catch a fancy cocotte's eye.
                </text>
                <arg f="MNR" n="M">Inexplicably</arg>
                <rel>costumed</rel>
                <arg n="1">*trace*</arg>
                <arg n="2">as a rabbinical student</arg>
            </example>

            <note>
                I wonder if this would ever occur in the active?
            </note>

        </roleset>
    </predicate>
</frameset>


text:
//
//  SUIExtensions.h
//  SPhoto
//
//  Created by SunJiangting on 12-11-22.
//
//

@interface UIView (Extension)
/**
 * Shortcut for frame.size.witdth*0.5
 */
@property (nonatomic,readonly) CGFloat inCenterX;
/**
 * Shortcut for frame.size.height*0.5
 */
@property (nonatomic,readonly) CGFloat inCenterY;

/**
 * Shortcut for CGPointMake(self.inCenterX,self.inCenterY)
 */
@property (nonatomic,readonly) CGPoint inCenter;
/**
 * Shortcut for frame.origin.x.
 *
 * Sets frame.origin.x = left
 */
@property (nonatomic) CGFloat left;

/**
 * Shortcut for frame.origin.y
 *
 * Sets frame.origin.y = top
 */
@property (nonatomic) CGFloat top;

/**
 * Shortcut for frame.origin.x + frame.size.width
 *
 * Sets frame.origin.x = right - frame.size.width
 */
@property (nonatomic) CGFloat right;

/**
 * Shortcut for frame.origin.y + frame.size.height
 *
 * Sets frame.origin.y = bottom - frame.size.height
 */
@property (nonatomic) CGFloat bottom;

/**
 * Shortcut for frame.size.width
 *
 * Sets frame.size.width = width
 */
@property (nonatomic) CGFloat width;

/**
 * Shortcut for frame.size.height
 *
 * Sets frame.size.height = height
 */
@property (nonatomic) CGFloat height;

/**
 * Shortcut for bounds.size.width
 *
 * Sets bounds.size.width = width
 */
@property (nonatomic,readonly) CGFloat b_width;

/**
 * Shortcut for bounds.size.height
 *
 * Sets bounds.size.height = height
 */
@property (nonatomic,readonly) CGFloat b_height;
/**
 * Shortcut for center.x
 *
 * Sets center.x = centerX
 */
@property (nonatomic) CGFloat centerX;

/**
 * Shortcut for center.y
 *
 * Sets center.y = centerY
 */
@property (nonatomic) CGFloat centerY;

/**
 * Return the x coordinate on the screen.
 */
@property (nonatomic, readonly) CGFloat ttScreenX;

/**
 * Return the y coordinate on the screen.
 */
@property (nonatomic, readonly) CGFloat ttScreenY;

/**
 * Return the x coordinate on the screen, taking into account scroll views.
 */
@property (nonatomic, readonly) CGFloat screenViewX;

/**
 * Return the y coordinate on the screen, taking into account scroll views.
 */
@property (nonatomic, readonly) CGFloat screenViewY;

/**
 * Return the view frame on the screen, taking into account scroll views.
 */
@property (nonatomic, readonly) CGRect screenFrame;

/**
 * Shortcut for frame.origin
 */
@property (nonatomic) CGPoint origin;

/**
 * Shortcut for frame.size
 */
@property (nonatomic) CGSize size;

/**
 * Return the width in portrait or the height in landscape.
 */
@property (nonatomic, readonly) CGFloat orientationWidth;

/**
 * Return the height in portrait or the width in landscape.
 */
@property (nonatomic, readonly) CGFloat orientationHeight;

/**
 * Removes all subviews.
 */
- (void)removeAllSubviews;
/**
 * Calculates the offset of this view from another view in screen coordinates.
 *
 * otherView should be a parent view of this view.
 */
- (CGPoint)offsetFromView:(UIView*)otherView;

/**
 * Get the UIViewController for the view.
 *
 */
- (UIViewController*)viewController;

- (void)addTargetForTouch:(id)target action:(SEL)action;

@end

//  Created by Sun Jiangting on 12-10-12.
//  Copyright (c) 2012年 Appsurdity, Inc. All rights reserved.

@interface UIScrollView (Rect)

- (CGRect) visibleRect;

@end

//  Created by Sun Jiangting on 12-10-12.
//  Copyright (c) 2012年 Appsurdity, Inc. All rights reserved.
//
#pragma mark-
#pragma mark UIButton 创建back/Done按钮

/// 圆角按钮(Navigation右上方功能按钮的宽度)
#define kRoundBtnWidth 41.0f

/**
 * NavigationBar 上的按钮类型。Back表示左尖角按钮,Round为圆角普通按钮,next未完善,为右尖角按钮
 */
typedef enum SButtonType : NSInteger {
    SButtonTypeBack    = 1,
    SButtonTypeMore    = 2,
    SButtonTypeRefresh = 3,
    SButtonTypeSetting = 4,
    SButtonTypeSearch  = 5,
    SButtonTypeDone    = 6,
    SButtonTypeCancle  = 7
} SButtonType;

@interface UIButton (RVNavButton)

/**
 * @brief 根据type和title的不同类型,创建按钮, 无文字
 *
 * @param type    需要创建的按钮类型 @see RVButtonType
 * @param target  需要响应事件的target
 * @param action  需要相应的事件
 */
+ (UIButton *) buttonWithType:(SButtonType)type target:(id)target action:(SEL)selector;

@end

//  Created by Sun Jiangting on 12-10-12.
//  Copyright (c) 2012年 Appsurdity, Inc. All rights reserved.
//
#pragma mark-
#pragma mark UIBarButtonItem 创建back/Done按钮

@interface UIBarButtonItem (RVNavBarButtonItem)

/**
 * @brief 创建Nav默认的返回按钮,文本内容为Back。
 *
 * @param target  需要响应事件的target
 * @param action  需要响应事件的方法
 */
- (UIBarButtonItem *) initWithBackTarget:(id) target action:(SEL) selector;

/**
 * @brief 根据type和title的不同类型,创建navigation上的按钮,无文字
 *
 * @param type    需要创建的按钮类型 @see RVButtonType
 * @param target  需要响应事件的target
 * @param action  需要响应事件的方法
 */
- (UIBarButtonItem *) initWithType:(SButtonType) type target:(id)target action:(SEL)selector;

@end


text:
package templates

import (
	"errors"
	"fmt"
	"io"
	"strings"
	"sync"

	log "github.com/Sirupsen/logrus"
	"github.com/megamsys/urknall"
)

const (
	LOCALHOST  = "localhost"
	PRIVATEKEY = "PrivateKey"
)

var runnables map[string]TemplateRunnable

type TemplateRunnable interface {
	Options(t *Template)
	Run(target urknall.Target, inputs map[string]string) error
}

type Template struct {
	Name     string
	Host     string
	UserName string
	Password string
	Options  map[string]string
	Maps     map[string][]string
}

func NewTemplate() *Template {
	return &Template{}
}

func (t *Template) Run(w io.Writer, inputs map[string]string) error {
	defer urknall.OpenLogger(w).Close()
	var target urknall.Target
	var err error
	var pri_key string

	if key, ok := t.Options[PRIVATEKEY]; ok {
		pri_key = key
	}

	if t.Password != "" {
		target, err = urknall.NewSshTargetWithPassword(t.UserName+"@"+t.Host, t.Password)
	} else if pri_key != "" {
		target, err = urknall.NewSshTargetWithPrivateKey(t.UserName+"@"+t.Host, []byte(pri_key))

	} else {
		if len(strings.TrimSpace(t.Host)) <= 0 || t.Host == LOCALHOST {
			target, err = urknall.NewLocalTarget()
		} else {
			target, err = urknall.NewSshTarget(t.UserName + "@" + t.Host) //this is with sshkey
		}
	}
	if err != nil {
		return err
	}
	runner, err := get(t.Name)

	if err != nil {
		log.Errorf("fatal error, couldn't locate the package %s", t.Name)
		return err
	}
	if initializeRunner, ok := runner.(TemplateRunnable); ok {
		initializeRunner.Options(t)
		return initializeRunner.Run(target, inputs)
	}

	return errors.New(fmt.Sprintf("fatal error, couldn't locate the package %q", t.Name))
}

type callbackFunc func(*Template, chan *Template) error

type rollbackFunc func(*Template)

func RunInTemplates(templates []*Template, callback callbackFunc, rollback rollbackFunc, parallel bool) error {
	if len(templates) == 0 {
		return nil
	}
	workers := 0
	if workers == 0 {
		workers = len(templates)
	}
	step := len(templates)/workers + 1
	toRollback := make(chan *Template, len(templates))
	errors := make(chan error, len(templates))
	var wg sync.WaitGroup
	runFunc := func(start, end int) error {
		defer wg.Done()
		for i := start; i < end; i++ {
			err := callback(templates[i], toRollback)
			if err != nil {
				errors <- err
				return err
			}
		}
		return nil
	}
	for i := 0; i < len(templates); i++ {
		//for i := 0; i < len(templates); i += step {
		end := i + step
		if end > len(templates) {
			end = len(templates)
		}
		wg.Add(1)
		if parallel {
			go runFunc(i, end)
		} else {
			err := runFunc(i, end)
			if err != nil {
				//break
			}
		}
	}
	wg.Wait()
	close(errors)
	close(toRollback)
	if err := <-errors; err != nil {
		if rollback != nil {
			for c := range toRollback {
				rollback(c)
			}
		}
		return err
	}
	return nil
}

// Get gets the named provisioner from the registry.
func get(name string) (TemplateRunnable, error) {
	p, ok := runnables[name]
	if !ok {
		return nil, fmt.Errorf("unknown template: %q", name)
	}
	return p, nil
}

// Register registers a new repository manager, that can be later configured
// and used.
func Register(name string, runnable TemplateRunnable) {
	if runnables == nil {
		runnables = make(map[string]TemplateRunnable)
	}
	runnables[name] = runnable
}


text:
require "app_up/hooks/loader"

module AppUp
  module Hooks
    class Runner < Struct.new(:shell, :files, :options)

      def run
        hooks = Hooks::Loader.load

        hooks.each do |hook|
          hook.run(shell, files, options)
        end

        shell.flush
      end
    end
  end
end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>org.apache.poi.ss.formula.eval (POI API Documentation)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

org.apache.poi.ss.formula.eval

Interfaces

AreaEval

NumericValueEval

RefEval

StringValueEval

ValueEval

Classes

AreaEvalBase

BlankEval

BoolEval

ConcatEval

ErrorEval

FunctionEval

IntersectionEval

MissingArgEval

NameEval

NameXEval

NumberEval

OperandResolver

PercentEval

RangeEval

RefEvalBase

RelationalOperationEval

StringEval

TwoOperandNumericOperation

UnaryMinusEval

UnaryPlusEval

Exceptions

EvaluationException

NotImplementedException


text:
GEM := $(shell which gem)
BUNDLE := $(shell which bundle)

all: clear build push

clear:
	rm -rf *.gem

init:
	$(BUNDLE) install --path=vendor/bundle

build:
	$(GEM) build easyrsa.gemspec

push: build
	$(GEM) push *.gem

test:
	$(BUNDLE) exec rake test

gem: test build push


text:
(function() {
  window.LR = window.LR || {};

  var MapSearch = window.LR.MapSearch = function(options) {
    this.$el = $(options.el);
    this.$infoEl = $(options.infoEl);
    this.$startDrawingButton = $(options.startDrawingButton);
    this.$stopDrawingButton = $(options.stopDrawingButton);
    this.$drawParagraph = $(options.drawParagraph);
    this.geoUrl = options.geoUrl;
    this.postcodeCentre = options.postcodeCentre;
    this.init();
  };
  MapSearch.prototype = {
    init: function() {
      this.vectorLayer = null;
      this.currentHighlight = null;
      this.currentTitles = null;
      this.drawInteraction = null;

      // Init buttons
      this.$startDrawingButton.click(_.bind(this.startDrawing, this));
      this.$stopDrawingButton.click(_.bind(this.stopDrawing, this));

      // Hide these until startDrawingButton is clicked
      this.$stopDrawingButton.hide();
      this.$drawParagraph.hide();

      // Init map
      var layer = new ol.layer.Tile({
        name: 'TMS',
        source: new ol.source.XYZ({
          url: 'http://atlas1.viaeuropa.uk.com/viaeuropa/lreg140411/hybrid/{z}/{x}/{y}.png'
        })
      });
      this.map = new ol.Map({
        layers: [layer],
        target: this.$el[0],
        view: new ol.View2D({
          //center: [-500000, 7300000],
          //zoom: 5
          center: [
                    this.postcodeCentre['coordinates'][0],
                    this.postcodeCentre['coordinates'][1]
          ],
          zoom: 16
        }),
        interactions: [new ol.interaction.DoubleClickZoom({delta: 0}),
                       new ol.interaction.DragPan({}),
                       new ol.interaction.MouseWheelZoom({}),
                       new ol.interaction.PinchRotate({}),
                       new ol.interaction.PinchZoom({})]
      });

      //this.map.removeControl(ol.control.Control);
      this.map.on('moveend', this.onMoveend, this);
      this.featureOverlay = new ol.FeatureOverlay({
        map: this.map,
        style: function(feature, resolution) {
          return [new ol.style.Style({
            stroke: new ol.style.Stroke({
              color: '#blue',
              width: 1
            }),
            fill: new ol.style.Fill({
              color: 'rgba(0,0,255,0.2)'
            }),
          })];
        }
      });

      // Init mouse events
      $(this.map.getViewport()).on('click', _.bind(this.onClick, this));
    },
    onClick: function(event) {
      var pixel = this.map.getEventPixel(event.originalEvent);
      var feature = this.map.forEachFeatureAtPixel(pixel, function(feature, layer) {
        return feature;
      });

      if (feature) {
        // Hack - don't do interaction when clicking on polygon
        this.map.removeInteraction(this.drawInteraction);
        setTimeout(_.bind(function() {
          this.map.addInteraction(this.drawInteraction);
        }, this), 0);

        this.$infoEl.show();

        template = _.template('
<%= address %>

<a href="/properties/<%= title_number %>">View full details');
        this.$infoEl.html(template(this.currentTitles[feature.getId()]));
      }
      else {
        this.$infoEl.text('');
        this.$infoEl.hide();
      }

      if (feature !== this.currentHighlight) {
        if (this.currentHighlight) {
          this.featureOverlay.removeFeature(this.currentHighlight);
        }
        if (feature) {
          this.featureOverlay.addFeature(feature);
        }
        this.currentHighlight = feature;
      }
    },
    onMoveend: function() {
      if (this.drawInteraction || !this.hasMapMoved()) {
        return;
      }
      this.fetchTitlesWithinViewExtent();
    },

    fetchTitlesWithinViewExtent: function() {
      this.fetchTitlesWithinPolygon(this.getViewExtentAsGeoJSON());
    },

    // Fetch the titles within a polygon and display them on the map
    fetchTitlesWithinPolygon: function(polygon) {
      console.log('Updating map', polygon);
      var url = this.geoUrl + '/titles?partially_contained_by=' + encodeURIComponent(JSON.stringify(polygon))
      $.ajax({
        url: url,
        dataType: 'jsonp',
        success: _.bind(this.onGeoSuccess, this),
      });
    },

    onGeoSuccess: function(results) {
      this.removeVectorLayer();

      var vectorLayer = new ol.layer.Vector({
        source: this.getSourceFromTitles(results['objects']),
        style: [new ol.style.Style({
          stroke: new ol.style.Stroke({
            color: 'blue',
            width: 1
          }),
          fill: new ol.style.Fill({
            color: 'rgba(0, 0, 255, 0.1)'
          })
        })],
      });

      // hash indexed by title number
      this.currentTitles = _.object(_.map(results['objects'], function(title) {
        title['address'] = title['address'].replace(',', ',
').replace('(', '
').replace(')', '')
        return [title['title_number'], title];
      }));

      this.setVectorLayer(vectorLayer);
    },

    getSourceFromTitles: function(titles) {
      var features = _.map(titles, function(title) {
        return {
          "id": title['title_number'],
          "type":"Feature",
          "geometry": title['extent']['geometry'],
        };
      });
      return new ol.source.GeoJSON({
        projection: 'EPSG:3857',
        object: {
          'type': 'FeatureCollection',
          'crs': {
            'type': 'name',
            'properties': {
              'name': 'EPSG:3857'
            }
          },
          'features': features,
        },
      });
    },
    removeVectorLayer: function() {
      if (this.vectorLayer) {
        this.map.removeLayer(this.vectorLayer);
      }
    },
    setVectorLayer: function(layer) {
      this.map.addLayer(layer);
      this.vectorLayer = layer;
    },
    getViewExtent: function() {
      return this.map.getView().calculateExtent(this.map.getSize());
    },
    getViewExtentPolygon: function() {
      e = this.getViewExtent();
      // min(x), min(y), max(x), max(y)
      return [
        [e[0], e[1]],
        [e[2], e[1]],
        [e[2], e[3]],
        [e[0], e[3]],
        [e[0], e[1]],
      ];
    },
    getViewExtentAsGeoJSON: function() {
      return {
        "type": "Polygon",
        "coordinates": [this.getViewExtentPolygon()],
        'crs': {
          'type': 'name',
          'properties': {
            'name': 'EPSG:3857'
          }
        },
      };
    },
    // Returns whether or not the map has moved since this function
    // was last called
    hasMapMoved: function() {
      var extent = this.getViewExtent();
      var result = false;
      if (!_.isEqual(extent, this._previousExtent)) {
        result = true;
      }
      this._previousExtent = this.getViewExtent()
      return result;
    },

    startDrawing: function() {
      this.removeVectorLayer();
      this.drawInteraction = new ol.interaction.Draw({
        type: 'Polygon'
      });
      this.drawInteraction.on('drawend', _.bind(this.onDrawEnd, this));
      this.map.addInteraction(this.drawInteraction);
      this.$startDrawingButton.hide();
      this.$stopDrawingButton.show();
      this.$drawParagraph.show();
    },

    onDrawEnd: function(e) {
      var geojson = new ol.format.GeoJSON().writeFeature(e.feature);
      this.fetchTitlesWithinPolygon(geojson['geometry']);
    },

    stopDrawing: function() {
      this.map.removeInteraction(this.drawInteraction);
      this.drawInteraction = null;
      this.fetchTitlesWithinViewExtent();
      this.removeVectorLayer();
      this.$startDrawingButton.show();
      this.$stopDrawingButton.hide();
      this.$drawParagraph.hide();
    }
  };
})();


text:
import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;

public class Player {

	public int playerID;
	public String playerName;
	private int location;
	private int balance;
	private HashMap<Integer, List<Integer>> properties = new HashMap<Integer, List<Integer>>();

	//constructors
	public Player() {
		//unused
	}

	public Player(int ID) {
		playerID = ID;
		playerName = "Player";
		location = 0;
		balance = 1500;
	}

	public Player(int ID, String name) {
		playerID = ID;
		playerName = name;
		location = 0;
		balance = 1500;
	}

	public void setLocation(int rollSum) {
		//Go = 0 .... Boardwalk = 39
		//Jail = 40

		location += rollSum;
		if (location >= 40) {
			location -= 40;
			//add $200 for passing GO
			System.out.println("You collected $200 for passing GO!");
			setBalance(200);
		}

	}

	public int getLocation() {
		return location;
	}

	public int getBalance() {
		return balance;
	}

	public void setBalance(int changeInBalance) {
		balance += changeInBalance;
	}

	public HashMap<Integer, List<Integer>> getProperties() {
		return properties;
	}

	public void addProperty(int newPropertyIndex) {
		List<Integer> emptyList = new ArrayList<Integer>();
		emptyList.add(0);
		emptyList.add(0);
		properties.put(newPropertyIndex, emptyList);
	}

	//TODO add intricacies of house purchases including having monopoly on spaces, 32 houses limit, etc
	//can also add setBalance in here later
	public void buyHouse(int propertyIndex) {
		List<Integer> houseList = properties.get(propertyIndex);
		int houseNum = houseList.get(0) + 1;
		houseList.set(0, houseNum);
		properties.replace(propertyIndex, houseList);
	}

	//TODO add intricacies of hotel purchases such as neededing all houses maxed
	//can also add setBalance in here later
	public void buyHotel(int propertyIndex) {
		List<Integer> hotelList = properties.get(propertyIndex);
		int houseNum = hotelList.get(1) + 1;
		hotelList.set(1, houseNum);
		properties.replace(propertyIndex, hotelList);
	}
}


text:
class AddSlugToSpreeDoctors < ActiveRecord::Migration
  def change
    add_column :spree_doctors, :slug, :string
    add_index :spree_doctors, :slug, unique: true
  end
end


text:
using System;
using System.Xml;
using System.Data;
using System.Collections;

namespace fyiReporting.Data
{
	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	public class XmlCommand : IDbCommand
	{
		XmlConnection _xc;			// connection we're running under
		string _cmd;				// command to execute
		// parsed constituents of the command
		string _Url;				// url of the xml file
		string _RowsXPath;			// XPath specifying rows selection
		ArrayList _ColumnsXPath;		// XPath for each column
		string _Type;				// type of request
		DataParameterCollection _Parameters = new DataParameterCollection();

		public XmlCommand(XmlConnection conn)
		{
			_xc = conn;
		}

		internal string Url
		{
			get
			{
				// Check to see if "Url" or "@Url" is a parameter
				IDbDataParameter dp= _Parameters["Url"] as IDbDataParameter;
				if (dp == null)
					dp= _Parameters["@Url"] as IDbDataParameter;
				// Then check to see if the Url value is a parameter?
				if (dp == null)
					dp = _Parameters[_Url] as IDbDataParameter;
				if (dp != null)
					return dp.Value != null? dp.Value.ToString(): _Url;	// don't pass null; pass existing value
				return _Url;	// the value must be a constant
			}
			set {_Url = value;}
		}

		internal string RowsXPath
		{
			get
			{
				IDbDataParameter dp= _Parameters["RowsXPath"] as IDbDataParameter;
				if (dp == null)
					dp= _Parameters["@RowsXPath"] as IDbDataParameter;
				// Then check to see if the RowsXPath value is a parameter?
				if (dp == null)
					dp = _Parameters[_RowsXPath] as IDbDataParameter;
				if (dp != null)
					return dp.Value != null? dp.Value.ToString(): _RowsXPath;	// don't pass null; pass existing value
				return _RowsXPath;	// the value must be a constant
			}
			set {_RowsXPath = value;}
		}

		internal ArrayList ColumnsXPath
		{
			get {return _ColumnsXPath;}
			set {_ColumnsXPath = value;}
		}

		internal string Type
		{
			get {return _Type;}
			set {_Type = value;}
		}

		#region IDbCommand Members

		public void Cancel()
		{
			throw new NotImplementedException("Cancel not implemented");
		}

		public void Prepare()
		{
			return;			// Prepare is a noop
		}

		public System.Data.CommandType CommandType
		{
			get
			{
				throw new NotImplementedException("CommandType not implemented");
			}
			set
			{
				throw new NotImplementedException("CommandType not implemented");
			}
		}

		public IDataReader ExecuteReader(System.Data.CommandBehavior behavior)
		{
			if (!(behavior == CommandBehavior.SingleResult ||
				  behavior == CommandBehavior.SchemaOnly))
				throw new ArgumentException("ExecuteReader supports SingleResult and SchemaOnly only.");
			return new XmlDataReader(behavior, _xc, this);
		}

		IDataReader System.Data.IDbCommand.ExecuteReader()
		{
			return ExecuteReader(System.Data.CommandBehavior.SingleResult);
		}

		public object ExecuteScalar()
		{
			throw new NotImplementedException("ExecuteScalar not implemented");
		}

		public int ExecuteNonQuery()
		{
			throw new NotImplementedException("ExecuteNonQuery not implemented");
		}

		public int CommandTimeout
		{
			get
			{
				return 0;
			}
			set
			{
				throw new NotImplementedException("CommandTimeout not implemented");
			}
		}

		public IDbDataParameter CreateParameter()
		{
			return new XmlDataParameter();
		}

		public IDbConnection Connection
		{
			get
			{
				return this._xc;
			}
			set
			{
				throw new NotImplementedException("Setting Connection not implemented");
			}
		}

		public System.Data.UpdateRowSource UpdatedRowSource
		{
			get
			{
				throw new NotImplementedException("UpdatedRowSource not implemented");
			}
			set
			{
				throw new NotImplementedException("UpdatedRowSource not implemented");
			}
		}

		public string CommandText
		{
			get
			{
				return this._cmd;
			}
			set
			{
				// Parse the command string for keyword value pairs separated by ';'
				string[] args = value.Split(';');
				string url=null;
				string[] colxpaths=null;
				string rowsxpath=null;
				string type="both";		// assume we want both attributes and elements
				foreach(string arg in args)
				{
					string[] param = arg.Trim().Split('=');
					if (param == null || param.Length != 2)
						continue;
					string key = param[0].Trim().ToLower();
					string val = param[1];
					switch (key)
					{
						case "url":
						case "file":
							url = val;
							break;
						case "rowsxpath":
							rowsxpath = val;
							break;
						case "type":
						{
							type = val.Trim().ToLower();
							if (!(type == "attributes" || type == "elements" || type == "both"))
								throw new ArgumentException(string.Format("type '{0}' is invalid.  Must be 'attributes', 'elements' or 'both'", val));
							break;
						}
						case "columnsxpath":
							// column list is separated by ','
							colxpaths = val.Trim().Split(',');
							break;
						default:
							throw new ArgumentException(string.Format("{0} is an unknown parameter key", param[0]));
					}
				}
				// User must specify both the url and the RowsXPath
				if (url == null)
					throw new ArgumentException("CommandText requires a 'Url=' parameter.");
				if (rowsxpath == null)
					throw new ArgumentException("CommandText requires a 'RowsXPath=' parameter.");
				_cmd = value;
				_Url = url;
				_Type = type;
				_RowsXPath = rowsxpath;
				if (colxpaths != null)
					_ColumnsXPath = new ArrayList(colxpaths);
			}
		}

		public IDataParameterCollection Parameters
		{
			get
			{
				return _Parameters;
			}
		}

		public IDbTransaction Transaction
		{
			get
			{
				throw new NotImplementedException("Transaction not implemented");
			}
			set
			{
				throw new NotImplementedException("Transaction not implemented");
			}
		}

		#endregion

		#region IDisposable Members

		public void Dispose()
		{
			// nothing to dispose of
		}

		#endregion
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.simpligility.android.sdk-deployer</groupId>
    <artifactId>android-extras</artifactId>
    <packaging>pom</packaging>
    <name>Android Extras</name>

    <parent>
        <groupId>com.simpligility.android.sdk-deployer</groupId>
        <artifactId>maven-android-sdk-deployer</artifactId>
        <version>2.8.0</version>
    </parent>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <phase>install</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <phase>install</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <sourcepath>${basedir}/target/generated-sources</sourcepath>
	                <sourceFileExcludes>
                            <exclude>**/R.java</exclude>
                        </sourceFileExcludes>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>initialize</phase>
                        <goals>
                            <goal>read-project-properties</goal>
                        </goals>
                        <configuration>
                            <files>
                                <file>${sdk.extras.compatibility.path}/source.properties</file>
                            </files>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>all</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <modules>
                <module>compatibility-v4</module>
                <module>compatibility-v7-gridlayout</module>
                <module>compatibility-v7-appcompat</module>
                <!--  commented out since it currently breaks on Mac OSX -->
                <!-- <module>compatibility-v7-mediarouter</module> -->
                <module>compatibility-v13</module>
                <!--  deprecated by Google, will leave in for a while in case someone wants to manually activate and use it -->
                <!-- <module>analytics-v2</module> -->
                <!--  deprecated by Google with Aug 2014, but still available for download
                might remove then, see http://googleadsdeveloper.blogspot.ca/2014/02/since-joining-google-play-services-back.html  -->
                <!--  <module>admob-ads-sdk</module> -->
                <!--  deprecated by Google, will leave in for a while in case someone wants to manually activate and use it -->
                <!-- <module>gcm</module>  -->
                <module>google-play-services</module>
                <module>play-licensing</module>
                <module>play-apk-expansion</module>
                <module>multidex</module>
            </modules>
        </profile>
    </profiles>
</project>


text:
<response>
    <uuid>123</uuid>
    <message>This job was successfully cancelled.</message>
</response>


text:
ACCEPTED

#### According to
Euro+Med Plantbase

#### Published in
null

#### Original name
Hieracium stoechadum Sudre

### Remarks
null


text:
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;

namespace Hallon
{
    public class LinkTable : IEnumerable<Link>
    {
        private readonly OrderedDictionary innerDictionary = new OrderedDictionary();

        public Link this[string key]
        {
            get => innerDictionary[key] as Link;
            set => innerDictionary[key] = value;
        }

        public Link this[int index]
            => innerDictionary[index] as Link;

        public bool ContainsKey(string key)
            => innerDictionary.Contains(key);

        public IEnumerable<string> Keys
            => innerDictionary.Keys.Cast<string>();

        public IEnumerable<Link> Values
            => innerDictionary.Keys.Cast<Link>();

        public IEnumerator<Link> GetEnumerator()
            => innerDictionary.Values.Cast<Link>().GetEnumerator();

        IEnumerator IEnumerable.GetEnumerator()
            => GetEnumerator();

        public int Count => innerDictionary.Count;

        public bool TryGet(string key, out Link link)
        {
            link = ContainsKey(key)
                ? this[key]
                : null;

            return link != null;
        }

        public void Insert(int index, string key, Link link)
            => innerDictionary.Insert(index, key, link);

        public void Insert(int index, string key, string href)
            => innerDictionary.Insert(index, key, new Link(href));

        public void Add(string key, Link link)
            => innerDictionary.Add(key, link);

        public void Add(string key, string href)
            => innerDictionary.Add(key, new Link(href));

        public void AddSelf(string href)
            => Insert(0, "self", new Link(href));

        public void Remove(string key)
            => innerDictionary.Remove(key);

        public void RemoveAt(int index)
            => innerDictionary.RemoveAt(index);

        public void Clear()
            => innerDictionary.Clear();
    }
}


text:
import Typography from "@material-ui/core/Typography";
import NavBar from "./NavBar";

export const PageLayout: React.FC<{}> = (props) => {
    return (
        <>
            <NavBar />
            <Typography variant="h5" align="center">Welcome to the Microsoft Authentication Library For React Quickstart</Typography>

            {props.children}
        </>
    );
};