/*
 * Datastruture for a b3 level
 */
import java.util.Comparator;
import java.util.logging.Level;
import java.util.logging.Logger;

public class B3Level implements Comparator<B3Level>
{

    private String groupbits, name, keyword, level;
    private Logger logger = Logger.getLogger(B3Level.class.getName());

    /**
     *
     * @param groupbits string representation of the int id from the `groups`
     * table
     * @param name name of the group. ex Guest, Admin, SuperAdmin, etc
     * @param keyword keyword for the group name
     * @param level string representation of the int level
     */
    public B3Level(String groupbits, String name, String keyword, String level)
    {
        this.groupbits = groupbits;
        this.name = name;
        this.keyword = keyword;
        this.level = level;

        logger.log(Level.FINER, "B3Level created: {0}", showFields());
    }

    /**
     *
     * @param input one line string in the format:
     * groupbits::name::keyword::level
     */
    public B3Level(String input)
    {
        logger.log(Level.FINEST, "Creating B3Level with string: {0}", input);
        String fields[] = input.trim().split("::");

        groupbits = fields[0];
        name = fields[1];
        keyword = fields[2];
        level = fields[3];

        logger.log(Level.FINER, "B3Level created: {0}", showFields());
    }

    public String getGroupbits()
    {
        return groupbits;
    }

    public int getbits()
    {
        int bits;

        try
        {
            bits = Integer.parseInt(groupbits);
        }
        catch (NumberFormatException e)
        {
            bits = 0;
        }

        return bits;
    }

    public String getName()
    {
        return name;
    }

    public String getKeyword()
    {
        return keyword;
    }

    public String getLevel()
    {
        return level;
    }

    @Override
    public String toString()
    {
        return name;
    }

    @Override
    public int compare(B3Level l1, B3Level l2)
    {
        return l1.getbits() - l2.getbits();
    }

    public String showFields()
    {
        return groupbits + "::" + name + "::" + keyword + "::" + level;
    }
}

@@ -150,39 +150,8 @@
 evel
- implements Comparator%3CB3Level%3E
 %0A%7B%0A%0A
@@ -1921,229 +1921,289 @@
     
-@Override%0A    public int compare(B3Level l1, B3Level l2)%0A    %7B%0A        return l1.getbits() - l2.getbits();%0A    %7D%0A%0A    public String showFields()%0A    %7B%0A        return groupbits + %22::%22 + name + %22::%22 + keyword + %22::%22 + level
+public String showFields()%0A    %7B%0A        return groupbits + %22::%22 + name + %22::%22 + keyword + %22::%22 + level;%0A    %7D%0A%7D%0A%0Aclass B3LevelComparator implements Comparator%3CB3Level%3E%0A%7B%0A%0A    @Override%0A    public int compare(B3Level l1, B3Level l2)%0A    %7B%0A        return l1.getbits() - l2.getbits()
 ;%0A  

implement comparator in separate service class