You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Robert Scholte (JIRA)" <ji...@apache.org> on 2008/04/14 22:43:04 UTC

[jira] Created: (LANG-425) Sequence(String)Utils

Sequence(String)Utils
---------------------

                 Key: LANG-425
                 URL: https://issues.apache.org/jira/browse/LANG-425
             Project: Commons Lang
          Issue Type: Wish
    Affects Versions: 2.4
            Reporter: Robert Scholte
            Priority: Trivial


Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.

Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
For example
{code}
SequenceUtils.nextInt(10)
SequenceUtils.nextString("MORE")
SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
{code}

any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-425) Sequence(String)Utils

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592571#action_12592571 ] 

Henri Yandell commented on LANG-425:
------------------------------------

So, I get the nextBoolean, but not the others :)

Presumably the sequence goes up, so that explains nextInt. I don't get the nextString methods though, what's after MORE? and what's with the two parameter version?

> Sequence(String)Utils
> ---------------------
>
>                 Key: LANG-425
>                 URL: https://issues.apache.org/jira/browse/LANG-425
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Trivial
>
> Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.
> Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-425) Sequence(String)Utils

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12727131#action_12727131 ] 

Henri Yandell commented on LANG-425:
------------------------------------

Coming back to this....

I don't think nextInt has much value (x++) or nextBoolean (!bool). Which matches the focus above on StringSequence.

It's a bit of a mix between the text.translate package and the CharSetUtils class in some ways. 

Some hypothetical ways to implement a hex number counter:

UnicodeSequence.between(0x30, 0x39).andBetween(0x41, 0x46)

or:

CharSequence.iterator("0-9A-F")

> Sequence(String)Utils
> ---------------------
>
>                 Key: LANG-425
>                 URL: https://issues.apache.org/jira/browse/LANG-425
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Trivial
>
> Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.
> Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-425) Sequence(String)Utils

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12767713#action_12767713 ] 

Henri Yandell commented on LANG-425:
------------------------------------

I'm not seeing too much on where this ticket is going. Given that we're on JDK 1.5 - do we know what we want to code?

> Sequence(String)Utils
> ---------------------
>
>                 Key: LANG-425
>                 URL: https://issues.apache.org/jira/browse/LANG-425
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Trivial
>             Fix For: 3.0
>
>
> Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.
> Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (LANG-425) Sequence(String)Utils

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell updated LANG-425:
-------------------------------

    Fix Version/s: 3.0

> Sequence(String)Utils
> ---------------------
>
>                 Key: LANG-425
>                 URL: https://issues.apache.org/jira/browse/LANG-425
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Trivial
>             Fix For: 3.0
>
>
> Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.
> Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-425) Sequence(String)Utils

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12727943#action_12727943 ] 

Henri Yandell commented on LANG-425:
------------------------------------

Agreed on the dodginess of the CharSequence name. Builder strategy is because Java lacks pairs :)

UnicodeSequence.iterator( {0x30, 0x39}, {0x41, 0x46} ) feels painful.

> Sequence(String)Utils
> ---------------------
>
>                 Key: LANG-425
>                 URL: https://issues.apache.org/jira/browse/LANG-425
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Trivial
>             Fix For: 3.0
>
>
> Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.
> Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-425) Sequence(String)Utils

Posted by "Robert Scholte (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605676#action_12605676 ] 

Robert Scholte commented on LANG-425:
-------------------------------------

Both generics and autoboxing are features of java5, while commons-lang must be able to compile with java 1.3. But with LangTwo this will become possible. 
Of course it's possible to create the classes with these ideas in mind. So I guess for commons-lang no generic interface yet.

And considering the hasNext()-issue: even that is possible. For instance: when using Integer.MAX_VALUE together with the IntegerSequence the method wil return false. 

> Sequence(String)Utils
> ---------------------
>
>                 Key: LANG-425
>                 URL: https://issues.apache.org/jira/browse/LANG-425
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Trivial
>
> Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.
> Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-425) Sequence(String)Utils

Posted by "James Carman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605622#action_12605622 ] 

James Carman commented on LANG-425:
-----------------------------------

Perhaps we come up with a generified interface?  Something like:

{code}
public interface Sequence<T>
{
  public T nextValue();
}
{code}

This just sounds a lot like Iterator<T>, though except the idea of hasNext() might not be applicable here.  To adapt a Sequence to the Iterator interface we could do:

{code}
public class SequenceIterator<T> implements Iterator<T>
{
  private final Sequence<T> sequence;

  public T next()
  {
    return sequence.nextValue();
  }

  public boolean hasNext()
  {
    return true;
  }
}
{code}

Thus, if code needs a sequence of Integers (or ints with autoboxing), they would declare their API with Sequence<Integer>.  If they need a sequence of strings, they would do Sequence<String>.

> Sequence(String)Utils
> ---------------------
>
>                 Key: LANG-425
>                 URL: https://issues.apache.org/jira/browse/LANG-425
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Trivial
>
> Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.
> Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-425) Sequence(String)Utils

Posted by "James Carman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605683#action_12605683 ] 

James Carman commented on LANG-425:
-----------------------------------

I thought we just voted to make commons lang JDK5-dependent (for 3.x releases)?

> Sequence(String)Utils
> ---------------------
>
>                 Key: LANG-425
>                 URL: https://issues.apache.org/jira/browse/LANG-425
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Trivial
>
> Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.
> Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (LANG-425) Sequence(String)Utils

Posted by "Robert Scholte (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Scholte closed LANG-425.
-------------------------------

    Resolution: Won't Fix

Ok, I'll close it myself.

With java5 this has become less interesting, maybe even useless. There are two reasons:
- autoboxing (although I don't know if I really like this feature)
- the atomic toolkit ( http://www.j2ee.me/j2se/1.5.0/docs/api/java/util/concurrent/atomic/package-summary.html )



> Sequence(String)Utils
> ---------------------
>
>                 Key: LANG-425
>                 URL: https://issues.apache.org/jira/browse/LANG-425
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Trivial
>             Fix For: 3.0
>
>
> Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.
> Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-425) Sequence(String)Utils

Posted by "Robert Scholte (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12727231#action_12727231 ] 

Robert Scholte commented on LANG-425:
-------------------------------------

After rereading all comments I see I made a terrible mistake. Some of the methods were based on primitives. For them it's absolutely useless to have these methods, but for their Object equivalent it is (or was pre java5).

The suggested hexImpl was just an example, you could also think of a sequence of strings without fowels. 

CharSequence is a bit misleading, because there's also a java.lang.CharSequence which has another goal.
The UnicodeSequence look a bit odd to me: why a builderstrategy here? 




> Sequence(String)Utils
> ---------------------
>
>                 Key: LANG-425
>                 URL: https://issues.apache.org/jira/browse/LANG-425
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Trivial
>             Fix For: 3.0
>
>
> Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.
> Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (LANG-425) Sequence(String)Utils

Posted by "Robert Scholte (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592572#action_12592572 ] 

rfscholte-getthere edited comment on LANG-425 at 4/27/08 10:56 AM:
---------------------------------------------------------------

Oops, my mistake. Some expected results would have been right.

NextInt(10)  is actually 11 (a simple ++ would do the trick already), but what about the object-version. So nextInteger(new Integer(10)) would result in new Integer(11);
Now the strings:
MORE + 1 = MORF; MORF+1 = MORG .... MORZ+1= MOSA .... MOZZ+1 = MPAA; .... ZZZZ+1= ? (maybe outOfBounds)
with a second argument you could define the chars to use and it's order.
so: C0DE (C-zero-DE) > C0DF > C0E0 > C0E1 and so on
Maybe an optional step (like for-loops) could be interesting
for Floats and Doubles it's more tricky. These types will always require a step.

      was (Author: rfscholte-getthere):
    Oops, my mistake. Some expected results would have been right.

NextInt(10)  is actually 11 (a simple ++ would do the trick already), but what about the object-version. So nextInteger(new Integer(10)) would result in new Integer(11);
Now the strings:
MORE + 1 = MORF; MORF+1 = MORG .... MORZ+1= MOSA .... MOZZ+1 = MPAA; .... ZZZZ+1= ? (maybe outOfBounds)
with a second argument you could define the chars to use and it's order.
so: C0DE (C-zero-DE) > C0DF > C0E0 > C0D1 and so on
Maybe an optional step (like for-loops) could be interesting
for Floats and Doubles it's more tricky. These types will always require a step.
  
> Sequence(String)Utils
> ---------------------
>
>                 Key: LANG-425
>                 URL: https://issues.apache.org/jira/browse/LANG-425
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Trivial
>
> Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.
> Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-425) Sequence(String)Utils

Posted by "Robert Scholte (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605614#action_12605614 ] 

Robert Scholte commented on LANG-425:
-------------------------------------

I'm still wondering if there's enough interest.

The suggestion of James is a good start.
Maybe the following constructorswould be nice to include:
{code:title=StringSequence.java}
 /** starting with first char of alpabet */
 public StringSequence(String alphabet);

 /** starting with 'offset' using chars in alpabet */
 public StringSequence(String alphabet, String offset);
 
 /** starting with first char of charRange */
 public StringSequence(CharRange charRange)

 /** starting with 'offset' using chars in charRange */
 public StringSequence(CharRange charRange, String offset)

 /** starting with first char of charSet */
 public StringSequence(CharSet charSet)

 /** starting with 'offset' using chars in charSet */
 public StringSequence(CharSet charSet, String offset)
{code}

{code:title=IntegerSequence.java}
public IntegerSequence(Integer offset)
public IntegerSequence(Integer offset, int step)
{code}

{code:title=LongSequence.java}
public LongSequence(Long offset)
public LongSequence(Long offset, long step)
{code}

Every class would have a next() or nextValue(), maybe even previous or previousValue()

> Sequence(String)Utils
> ---------------------
>
>                 Key: LANG-425
>                 URL: https://issues.apache.org/jira/browse/LANG-425
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Trivial
>
> Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.
> Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-425) Sequence(String)Utils

Posted by "Robert Scholte (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592666#action_12592666 ] 

Robert Scholte commented on LANG-425:
-------------------------------------

That was my first idea too, but after having some thoughts I don't think this would be the right way, or at least not the only one.

The code you suggest is covered by [commons-id|http://commons.apache.org/sandbox/id/] (a sandbox and 1.0-snapshot project)
What they do is:
{code}  IdentifierGeneratorFactory factory = IdentifierGeneratorFactory.newInstance();
StringIdentifierGenerator generator = factory.alphanumericGenerator();
String id = generator.nextStringIdentifier();
{code}

But for commons-lang this approach might be a bit overdone. 
Maybe both ways must be supported: a memento (statefull)-version and a utils (stateless)-version.

If you want to loop, use the first option. If you just want the next, use the second.
For a simple String+1 you shouldn't need to create an object by constructor and call it's nextString()

> Sequence(String)Utils
> ---------------------
>
>                 Key: LANG-425
>                 URL: https://issues.apache.org/jira/browse/LANG-425
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Trivial
>
> Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.
> Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-425) Sequence(String)Utils

Posted by "James Carman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592589#action_12592589 ] 

James Carman commented on LANG-425:
-----------------------------------

I like the idea of the nextString(), but it would also be useful to provide the "alphabet" to be used.  It would be better as a StringSequence class, though.

{code:title=StringSequence.java}
public class StringSequence
{
  public StringSequence(String alphabet, String start);
  public String nextString();
}
{code}

> Sequence(String)Utils
> ---------------------
>
>                 Key: LANG-425
>                 URL: https://issues.apache.org/jira/browse/LANG-425
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Trivial
>
> Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.
> Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-425) Sequence(String)Utils

Posted by "Robert Scholte (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645993#action_12645993 ] 

Robert Scholte commented on LANG-425:
-------------------------------------

If the next release is jdk5-dependent, it's actually useless to make a version for Numbers, I guess. But for Strings it's still interesting, so maybe it's an option to reuse some code of the sandboxproject commons-id, but without the IdentifierGeneratorFactory, just to keep it simple?

> Sequence(String)Utils
> ---------------------
>
>                 Key: LANG-425
>                 URL: https://issues.apache.org/jira/browse/LANG-425
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Trivial
>
> Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.
> Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-425) Sequence(String)Utils

Posted by "Robert Scholte (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592572#action_12592572 ] 

Robert Scholte commented on LANG-425:
-------------------------------------

Oops, my mistake. Some expected results would have been right.

NextInt(10)  is actually 11 (a simple ++ would do the trick already), but what about the object-version. So nextInteger(new Integer(10)) would result in new Integer(11);
Now the strings:
MORE + 1 = MORF; MORF+1 = MORG .... MORZ+1= MOSA .... MOZZ+1 = MPAA; .... ZZZZ+1= ? (maybe outOfBounds)
with a second argument you could define the chars to use and it's order.
so: C0DE (C-zero-DE) > C0DF > C0E0 > C0D1 and so on
Maybe an optional step (like for-loops) could be interesting
for Floats and Doubles it's more tricky. These types will always require a step.

> Sequence(String)Utils
> ---------------------
>
>                 Key: LANG-425
>                 URL: https://issues.apache.org/jira/browse/LANG-425
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Trivial
>
> Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.
> Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-425) Sequence(String)Utils

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645261#action_12645261 ] 

Henri Yandell commented on LANG-425:
------------------------------------

Yep.

> Sequence(String)Utils
> ---------------------
>
>                 Key: LANG-425
>                 URL: https://issues.apache.org/jira/browse/LANG-425
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Trivial
>
> Don't you think it's kind of strange to have RandomUtils and RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part of commons lang.
> Most classes of within this package are stateless/static, or they have a state within a method (such as StrBuilder). SequenceUtils can only be static, if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.