class CommentDetector implements LineDetector<Character> {

    @Override
    public ValuesWithConfidence<Character> detect(LineSampler sampler)
    {
        ValueWithConfidence<Character> result = new ValueWithConfidence<>();

        TCharIntHashMap firstChars = new TCharIntHashMap();
        for (String line : sampler.getBeginningSampleLines())
        {
            if (!line.isEmpty())
            {
                char firstChar = line.charAt(0);
                if (isComment(firstChar))
                {
                    if (!firstChars.containsKey(firstChar))
                    {
                        firstChars.put(firstChar, 0);
                    }

                    firstChars.put(firstChar, firstChars.get(firstChar) + 1);
                }
            }
        }

        for (char ch : firstChars.keys())
        {
            float confidence = getConfidenceMultiplier(ch);
            float firstCharLinePercentage = (sampler.getBeginningSampleLines().size() - firstChars.get(ch))
                    / (float)sampler.getBeginningSampleLines().size();

            if (confidence > result.getConfidence() && firstCharLinePercentage > ourCommentThreshold)
            {
                result.setValue(Character.valueOf(ch));
                result.setConfidence(confidence);
            }
        }

        return new ValuesWithConfidence<Character>(result);
    }

    public  CommentDetector();
    public  CommentDetector(Character delimiter, Character quoteChar);

}