01 /**
02 *
03 * All content copyright (c) 2003-2008 Terracotta, Inc.,
04 * except as may otherwise be noted in a separate copyright notice.
05 * All rights reserved.
06 *
07 */
08 package demo.chatter;
09
10 import java.util.Random;
11
12 /**
13 * Description of the Class
14 *
15 *@author Terracotta, Inc.
16 */
17 public class User {
18 private final String name;
19 private final String nodeId;
20
21 private static final Random random = new Random();
22
23 private static final String[] FIRST_NAMES = {"Miles", "Ella", "Nina",
24 "Duke", "Charlie", "Billie", "Louis", "Fats", "Thelonious", "Dizzy"};
25
26 private static final String[] LAST_NAMES = {"Davis", "Fitzgerald",
27 "Simone", "Ellington", "Parker", "Holiday", "Armstrong", "Waller",
28 "Monk", "Gillespie"};
29
30 public User(String nodeId) {
31 this.name = generateChatname();
32 this.nodeId = nodeId;
33 }
34
35 public String getName() {
36 return name;
37 }
38
39 public String getNodeId() {
40 return nodeId;
41 }
42
43 public String toString() {
44 return name + ", " + nodeId;
45 }
46
47 private static String generateChatname() {
48 return FIRST_NAMES[random.nextInt(FIRST_NAMES.length)]
49 + LAST_NAMES[random.nextInt(LAST_NAMES.length)];
50 }
51
52 }
|