public class RandomCitySet
extends java.lang.Object
Copyright (C) 2015 JIOWA Business Solutions GmbH, Bettinastr. 30 , D-60325 Frankfurt am Main, Germany
Homepage: www.jiowa.de
All rights reserved.
Download: www.jiowa.de/download.html
License: www.jiowa.de/license.html
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
CITIES |
protected java.util.ArrayList<City> |
list |
protected java.util.Random |
random |
protected java.lang.String |
STATE |
Constructor and Description |
---|
RandomCitySet(java.lang.String countryCode,
java.lang.String textWithoutComments)
Creates a
City set per country code. |
Modifier and Type | Method and Description |
---|---|
void |
add(City city)
Adds a
City to the list of cities. |
void |
add(java.lang.String countryCode,
java.lang.String textWithoutComments)
Adds cities per country.
|
protected com.jiowa.util.tuple.Tuple<java.lang.String,java.lang.Integer> |
extractCities(java.lang.StringBuffer buf,
int pos)
Extracts the cities from the buffer according to the text markers.
|
protected java.util.Collection<java.lang.String> |
extractCityList(java.lang.String oneCityPerLine)
Extracts the list of unique cities in the list of cities.
|
protected com.jiowa.util.tuple.Tuple<java.lang.String,java.lang.Integer> |
extractState(java.lang.StringBuffer buf,
int pos)
Returns state name and next buffer position in a
StringBuffer starting from
text position. |
City |
getRandom()
Returns a random (international)
City . |
protected final java.lang.String STATE
protected final java.lang.String CITIES
protected java.util.Random random
protected java.util.ArrayList<City> list
public RandomCitySet(java.lang.String countryCode, java.lang.String textWithoutComments)
City
set per country code.countryCode
- the country codetextWithoutComments
- text which contains the list of citiespublic City getRandom()
public void add(java.lang.String countryCode, java.lang.String textWithoutComments)
countryCode
- country codetextWithoutComments
- text which contains the city namespublic void add(City city)
city
- the cityprotected com.jiowa.util.tuple.Tuple<java.lang.String,java.lang.Integer> extractState(java.lang.StringBuffer buf, int pos)
StringBuffer
starting from
text position.buf
- string bufferpos
- text positionTuple
of state name and next text positionprotected com.jiowa.util.tuple.Tuple<java.lang.String,java.lang.Integer> extractCities(java.lang.StringBuffer buf, int pos)
buf
- pos
- protected java.util.Collection<java.lang.String> extractCityList(java.lang.String oneCityPerLine)
oneCityPerLine
-