View Javadoc

1   /*$Id: RandomNameGen.java,v 1.2 2005/04/25 12:13:54 clq2 Exp $
2    * Created on 11-Apr-2005
3    *
4    * Copyright (C) AstroGrid. All rights reserved.
5    *
6    * This software is published under the terms of the AstroGrid 
7    * Software License version 1.2, a copy of which has been included 
8    * with this distribution in the LICENSE.txt file.  
9    *
10  **/
11  package org.astrogrid.jes.impl.workflow;
12  
13  import org.astrogrid.common.namegen.NameGen;
14  
15  import java.util.Random;
16  
17  /*** NameGen implementation that preserves old behaviour - random numbers and system time.
18   * @author Noel Winstanley nw@jb.man.ac.uk 11-Apr-2005
19   *
20   */
21  public class RandomNameGen implements NameGen {
22  
23      /*** Construct a new RandomNameGen
24       * 
25       */
26      public RandomNameGen() {
27          super();
28      }
29      private static Random rand = new Random();
30  
31      /***
32       * @see org.astrogrid.jes.impl.workflow.NameGen#next()
33       */
34      public String next() {
35          StringBuffer result = new StringBuffer();
36           result.append( System.currentTimeMillis()) 
37          .append( ':' )
38          .append(Math.abs( rand.nextInt()));
39           return result.toString();
40      }
41  
42  }
43  
44  
45  /* 
46  $Log: RandomNameGen.java,v $
47  Revision 1.2  2005/04/25 12:13:54  clq2
48  jes-nww-776-again
49  
50  Revision 1.1.2.1  2005/04/11 13:55:57  nw
51  started using common-namegen
52   
53  */