class IdentifierSequences {


    private final Map<String,Integer> idCounts;




    public IdentifierSequences() {
        super();
        this.idCounts = new HashMap<String,Integer>(1,1.0f);
    }




    /**
     * <p>
     *   Returns a new index (ID count) for a specific
     *   value of the {@code id} attribute, and increments
     *   the count.
     * </p>
     *
     * @param id the ID for which the count will be computed
     * @return the new count, ready to be used
     */
    public Integer getAndIncrementIDSeq(final String id) {
        Validate.notNull(id, "ID cannot be null");
        Integer count = this.idCounts.get(id);
        if (count == null) {
            count = Integer.valueOf(1);
        }
        this.idCounts.put(id, Integer.valueOf(count.intValue() + 1));
        return count;
    }


    /**
     * <p>
     *   Returns the index (ID count) for a specific
     *   value of the {@code id} attribute without incrementing
     *   the count.
     * </p>
     *
     * @param id the ID for which the count will be retrieved
     * @return the current count
     */
    public Integer getNextIDSeq(final String id) {
        Validate.notNull(id, "ID cannot be null");
        Integer count = this.idCounts.get(id);
        if (count == null) {
            count = Integer.valueOf(1);
        }
        return count;
    }


    /**
     * <p>
     *   Returns the last index (ID count) returned for a specific
     *   value of the {@code id} attribute (without incrementing
     *   the count).
     * </p>
     *
     * @param id the ID for which the last count will be retrieved
     * @return the count
     */
    public Integer getPreviousIDSeq(final String id) {<FILL_FUNCTION_BODY>}


}

        Validate.notNull(id, "ID cannot be null");
        final Integer count = this.idCounts.get(id);
        if (count == null) {
            throw new TemplateProcessingException(
                    "Cannot obtain previous ID count for ID \"" + id + "\"");
        }
        return Integer.valueOf(count.intValue() - 1);
    
<no_super_class>