[ http://issues.apache.org/jira/browse/SANDBOX-146?page=all ]
Henri Yandell updated SANDBOX-146: ---------------------------------- Component: Id > [id] New string identifier generators, PrefixedNumericGenerator &c. > ------------------------------------------------------------------- > > Key: SANDBOX-146 > URL: http://issues.apache.org/jira/browse/SANDBOX-146 > Project: Commons Sandbox > Type: Improvement > Components: Id > Environment: Operating System: other > Platform: Other > Reporter: Michael Heuer > Priority: Minor > Attachments: src.tar.gz > > In order to generate identifiers for an instance of the Ensembl database [1], > I needed a generator for > identifiers of the style ENSG000001, ENSG000002, ENST000001, ENST000002, > ENSP000001, and so on. > Attached is a class PrefixedLeftPaddedNumericGenerator (sorry about the long > class name) that solves > this use case and also PrefixedNumericGenerator and > PrefixedAlphanumericGenerator for > completeness' sake. > new PrefixedLeftPaddedNumericGenerator("foo", true, 5); returns > foo01 > foo02 > foo03 > foo04 > foo05 > foo06 > foo07 > foo08 > foo09 > foo10 > foo11 > new PrefixedNumericGenerator("foo", true, 0L) returns > foo1 > foo2 > foo3 > foo4 > foo5 > foo6 > foo7 > foo8 > foo9 > foo10 > foo11 > new PrefixedAlphanumericGenerator("foo", true, 5); returns > foo01 > foo02 > foo03 > foo04 > foo05 > foo06 > foo07 > foo08 > foo09 > foo0a > foo0b > [1] > > http://www.ensembl.org -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]