public class CompanyNameGenerator
extends java.lang.Object
To use, create an instance of CompanyNameGenerator and call nextName() one or more times.
Example:
CompanyNameGenerator gen = new CompanyNameGenerator (); for (int i = 0; i < count; i++) { System.out.println (gen.nextName ()); }
Sample output from the above code:
GARDEN MATERIALS HI-TECH CONNECTION FOCUS GROUP EAGLE EYE HAIR DESIGN BENEFICIAL HAIR DESIGN AFFORDABLE COMMUNICATIONS ISAACS SYSTEMS MILLENIUM PEST CONTROL ALLIED SERVICES CARPET SERVICES
The names are built from two lists, one of nouns and one of suffixes. The lists are loaded as resources using getClass().getResourceAsStream. The file names are bname-noun.txt and bname-suffix.txt, and should be in the same package as this class.
At present the company names are sample from the phone book from A to M.
You can also supply your own custom list by using the constructor that takes two Lists as arguments.
Modifier and Type | Class and Description |
---|---|
static class |
CompanyNameGenerator.Test
Inner class for testing.
|
Constructor and Description |
---|
CompanyNameGenerator()
Create a new company name generator using the included name list files.
|
CompanyNameGenerator(java.util.List nouns,
java.util.List suffixes)
Create a new company name generator using the provided lists.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
makeURL(java.lang.String name)
Convert the given (fake) company name into a fake WWW domain name by
removing any non-characters and adding on "www." and ".com".
|
java.lang.String |
nextName()
Generate and return the next randomly synthesized Company name.
|
public CompanyNameGenerator(java.util.List nouns, java.util.List suffixes)
nouns
- A List of String nouns.suffixes
- a List of String suffixes.CompanyNameGenerator()
public CompanyNameGenerator()
If you don't like the names it generates you can modify the resource files or use the constructor that takes the two lists as arguments.
CompanyNameGenerator(List,List)
public java.lang.String nextName()
public static java.lang.String makeURL(java.lang.String name)
name
- The company name.Copyright ? 2002 Clarity Systems Group, LLC. All Rights Reserved.