com.claritysys.data
Class CompanyNameGenerator

java.lang.Object
  extended by com.claritysys.data.CompanyNameGenerator

public class CompanyNameGenerator
extends java.lang.Object

Class to generate random company names.

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.

Version:
$Revision: 2348 $

Nested Class Summary
static class CompanyNameGenerator.Test
          Inner class for testing.
 
Constructor Summary
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.
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompanyNameGenerator

public CompanyNameGenerator(java.util.List nouns,
                            java.util.List suffixes)
Create a new company name generator using the provided lists.

Parameters:
nouns - A List of String nouns.
suffixes - a List of String suffixes.
See Also:
CompanyNameGenerator()

CompanyNameGenerator

public CompanyNameGenerator()
Create a new company name generator using the included name list files.

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.

See Also:
CompanyNameGenerator(List,List)
Method Detail

nextName

public java.lang.String nextName()
Generate and return the next randomly synthesized Company name.

Returns:
the next random company name.

makeURL

public 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".

Parameters:
name - The company name.
Returns:
The company's web URL.


Copyright ? 2002 Clarity Systems Group, LLC. All Rights Reserved.