1
2
3
4
5
6
7
8
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
47
48
49
50
51
52
53