All Downloads are FREE. Search and download functionalities are using the official Maven repository.

toxgene.util.cdata.xmark.Cities Maven / Gradle / Ivy

package toxgene.util.cdata.xmark;

import java.util.Random;

import toxgene.interfaces.ToXgeneCdataGenerator;

/**
 * This class implements a simple CDATA generator that produces
 * random City names drawn from the list of cities used by the XMark
 * benchmark.
 * 

* This code is provided as part of ToXgene - (c) 2001 University of Toronto * and IBM Corporation. * * @author Denilson Barbosa * @version 1.0 */ public class Cities implements ToXgeneCdataGenerator{ private static Random pick; private static String result; /** * Specifies a seed for the random generator so that repeated * executions always produce the same content, if the same seed is * provided. * * @param seed random seed to initialize the random generator */ public void setRandomSeed(int seed){ pick = new Random(seed); } /** * Generates random text whose length is determined by the parameter * length. A value of -1 determines that a string of any length can * be returned; a positive value means that a string must be * truncated if necessary. * * @param length specifies the length of the CDATA value to be returned. */ public String getCdata(int length){ result = data[pick.nextInt(len)]; //length == -1 means that the string should not be trimmed if (length == -1){ return result; } if (result.length() > length) return result.substring(0,length); else return result; } /** * These are the actual strings. We can declare this array here * explicitly because there are not too many contants. */ public final static String[] data = { "Abidjan","Abu","Acapulco","Aguascalientes","Akron","Albany", "Albuquerque","Alexandria","Allentown","Amarillo","Amsterdam", "Anchorage","Appleton","Aruba","Asheville","Athens","Atlanta", "Augusta","Austin","Baltimore","Bamako","Bangor","Barbados", "Barcelona","Basel","Baton","Beaumont","Berlin","Bermuda","Billings", "Birmingham","Boise","Bologna","Boston","Bozeman","Brasilia", "Brunswick","Brussels","Bucharest","Budapest","Buffalo","Butte", "Cairo","Calgary","Cancun","Cape","Caracas","Casper","Cedar", "Charleston","Charlotte","Charlottesville","Chattanooga","Chicago", "Chihuahua","Cincinnati","Ciudad","Cleveland","Cody","Colorado", "Columbia","Columbus","Conakry","Copenhagen","Corpus","Cozumel", "Dakar","Dallas","Dayton","Daytona","Denver","Des","Detroit","Dothan", "Dubai","Dublin","Durango","Durban","Dusseldorf","East","El","Elko", "Evansville","Fairbanks","Fayetteville","Florence","Fort","Fortaleza", "Frankfurt","Fresno","Gainesville","Geneva","George","Glasgow", "Gothenburg","Grand","Great","Green","Greensboro","Greenville", "Grenada","Guadalajara","Guangzhou","Guatemala","Guaymas","Gulfport", "Gunnison","Hamburg","Harrisburg","Hartford","Helena","Hermosillo", "Honolulu","Houston","Huntington","Huntsville","Idaho","Indianapolis", "Istanbul","Jackson","Jacksonville","Johannesburg","Kahului", "Kalamazoo","Kalispell","Kansas","Key","Kiev","Killeen","Knoxville", "La","Lafayette","Lansing","Las","Lawton","Leon","Lexington","Lima", "Lisbon","Little","Lome","London","Long","Lorient","Los","Louisville", "Lubbock","Lynchburg","Lyon","Macon","Madison","Madrid","Manchester", "Mazatlan","Melbourne","Memphis","Merida","Meridian","Mexico","Miami", "Milan","Milwaukee","Minneapolis","Missoula","Mobile","Monroe", "Monterrey","Montgomery","Montreal","Moscow","Mulhouse","Mumbai", "Munich","Myrtle","Nagoya","Nashville","Nassau","New","Newark", "Newburgh","Newcastle","Nice","Norfolk","Oakland","Oklahoma","Omaha", "Ontario","Orange","Orlando","Ouagadougou","Palm","Panama","Paris", "Pasco","Pensacola","Philadelphia","Phoenix","Pittsburgh","Pocatello", "Port","Portland","Porto","Prague","Providence","Providenciales", "Puebla","Puerto","Raleigh","Rapid","Reno","Richmond","Rio","Roanoke", "Rochester","Rome","Sacramento","Salt","Salvador","San","Santiago", "Sao","Sarasota","Savannah","Seattle","Shannon","Shreveport","South", "Spokane","St","Stockholm","Stuttgart","Sun","Syracuse","Tallahassee", "Tampa","Tapachula","Texarkana","Tokyo","Toledo","Toronto","Torreon", "Toulouse","Tri","Tucson","Tulsa","Turin","Twin","Vail","Valdosta", "Vancouver","Venice","Veracruz","Vienna","Villahermosa","Warsaw", "Washington","West","White","Wichita","Wilkes","Wilmington", "Windhoek","Worcester","Zihuatenejo","Zurich" }; public final static int len = data.length; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy