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

toxgene.util.cdata.xmark.Countries 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 Country names according to the coutries 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 Countries 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={ "United States","Afghanistan","Albania","Algeria","American Samoa", "Andorra","Angola","Anguilla","Antarctica","Antigua","Argentina", "Armenia","Aruba","Australia","Austria","Azerbaijan","Bahamas", "Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize", "Benin","Bermuda","Bhutan","Bolivia","Botswana","Brazil", "British Indian Ocean Territory","British Virgin Islands", "Brunei Darussalam","Bulgaria","Burkina Faso","Burundi", "Cacos Islands","Cambodia","Cameroon","Canada","Cape Verde", "Cayman Islands","Central African Republic","Chad","Chile","China", "Christmas Island","Colombia","Comoros","Congo","Cook Islands", "Costa Rica","Croatia","Cuba","Cyprus","Czech Republic","Denmark", "Djibouti","Dominica","Dominican Republic","East Timor","Ecuador", "Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia", "Ethiopia","Falkland Islands","Faroe Islands","Fiji","Finland", "France","French Guiana","French Polynesia", "French Southern Territory","Futuna Islands","Gabon","Gambia", "Georgia","Germany","Ghana","Gibraltar","Greece","Greenland", "Grenada","Guadeloupe","Guam","Guatemala","Guinea","Guyana","Haiti", "Heard and Mcdonald Island","Honduras","Hong Kong","Hungary", "Iceland","India","Indonesia","Iran","Iraq","Ireland","Israel", "Italy","Ivory Coast","Jamaica","Japan","Jordan","Kazakhstan","Kenya", "Kiribati","Korea, Democratic People's Rep","Korea, Republic Of", "Kuwait","Kyrgyzstan","Lao People's Democratic Republ","Latvia", "Lebanon","Lesotho","Liberia","Libyan Arab Jamahiriya","Lithuania", "Luxembourg","Macau","Macedonia","Madagascar","Malawi","Malaysia", "Maldives","Mali","Malta","Marshall Islands","Martinique", "Mauritania","Mauritius","Mayotte","Mexico","Micronesia", "Moldova, Republic Of","Monaco","Mongolia","Montserrat","Morocco", "Mozambique","Myanmar","Namibia","Nauru","Nepal","Netherlands", "Netherlands Antilles","New Caledonia","New Zealand","Nicaragua", "Niger","Nigeria","Niue","Norfolk Island","Northern Mariana Islands", "Norway","Oman","Pakistan","Palau","Panama","Papua New Guinea", "Paraguay","Peru","Philippines","Poland","Portugal","Puerto Rico", "Qatar","Reunion","Romania","Russian Federation","Rwanda", "Saint Kitts","Samoa","San Marino","Sao Tome","Saudi Arabia", "Senegal","Seychelles","Sierra Leone","Singapore","Slovakia", "Slovenia","Solomon Islands","Somalia","South Africa","South Georgia", "Spain","Sri Lanka","St. Helena","St. Lucia","St. Pierre", "St. Vincent and Grenadines","Sudan","Suriname", "Svalbard and Jan Mayen Island","Swaziland","Sweden","Switzerland", "Syrian Arab Republic","Taiwan","Tajikistan","Tanzania","Thailand", "Togo","Tokelau","Tonga","Trinidad","Tunisia","Turkey","Turkmenistan", "Turks Islands","Tuvalu","Uganda","Ukraine","United Arab Emirates", "United Kingdom","Uruguay","Us Minor Islands","Us Virgin Islands", "Uzbekistan","Vanuatu","Vatican City State","Venezuela","Viet Nam", "Western Sahara","Yemen","Zaire","Zambia","Zimbabwe" }; public final static int len = data.length; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy