class I18nRules extends TimedDelegate {

    @Override
    protected Set<Violation> doMeasuredAnalysis() throws JDOMException {
        final Set<Violation> violations = new HashSet<Violation>();
        final Map<String, Element> i18nKeys = new HashMap<String, Element>();
        final List<Element> uarGetMessages = selectNodesByName("CALL.", "[NAME[1]/@text = 'UAR_I18NGETMESSAGE']");

        for (final Element uarGetMessage : uarGetMessages) {
            String i18nKey = uarGetMessage.getChildren().get(2).getAttributeValue("text");
            String i18nText = uarGetMessage.getChildren().get(3).getAttributeValue("text");

            if (i18nKey != null && i18nText != null) {
                // The i18n key has not been added to the collection yet, so there is no violation to add.
                // Add the element to the map and finish.
                if (i18nKeys.get(i18nKey) == null) {
                    i18nKeys.put(i18nKey, uarGetMessage.getChildren().get(3));
                    continue;
                }

                // The i18n key has already been added, so check to see if the i18n Text Value matches
                // If not, then the script author has violated uniqueness of the i18n keys
                String existingI18nText = i18nKeys.get(i18nKey).getAttributeValue("text");
                if (!existingI18nText.equalsIgnoreCase(i18nText)) {
                    violations.add(new DuplicateI18nKeyViolation(getLineNumber(uarGetMessage), i18nKey));
                }
            }
        }

        return violations;
    }

    public  I18nRules(final Document document);

}