[ 
https://issues.apache.org/jira/browse/LANG-774?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13157355#comment-13157355
 ] 

Sebb edited comment on LANG-774 at 11/26/11 1:02 AM:
-----------------------------------------------------

The patch contains a spurious (and incorrect) change to Validate.java, but that 
can be ignored.

Otherwise generally looks OK, though it might be better to use a positive check 
for isStarted.
i.e instead of

bq. return this.runningState != STATE_UNSTARTED && this.runningState != 
STATE_STOPPED;

one could use

bq. return this.runningState == STATE_RUNNING || this.runningState == 
STATE_SUSPENDED;

It occurs to me that the code would be easier to read if the states were 
expressed as enums (the code predates them).

In which case, the enum itself could have methods for reporting whether it was 
started/stopped/etc.
                
      was (Author: [email protected]):
    The patch contains a spurious (and incorrect) change to Validate.java, but 
that can be ignored.

Otherwise generally looks OK, though it might be better to use a positive check 
for isStarted.
i.e instead of

bq. return this.runningState != STATE_UNSTARTED && this.runningState != 
STATE_STOPPED;

one could use

return this.runningState == STATE_RUNNING || this.runningState == 
STATE_SUSPENDED;

It occurs to me that the code would be easier to read if the states were 
expressed as enums (the code predates them).

In which case, the enum itself could have methods for reporting whether it was 
started/stopped/etc.
                  
> Add isStarted isStopped and isSuspended to StopWatch
> ----------------------------------------------------
>
>                 Key: LANG-774
>                 URL: https://issues.apache.org/jira/browse/LANG-774
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.time.*
>    Affects Versions: 3.1
>            Reporter: Michael Akerman
>            Priority: Minor
>              Labels: features
>             Fix For: 3.2
>
>         Attachments: LANG774.diff
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> It would be nice to have:
>    isStarted
>    isStopped
>    isSuspended
> On StopWatch

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to