public class SyntheticDataGenerator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
colGeom |
private static java.lang.String |
colID |
private static java.lang.String[] |
colKeep |
private static java.lang.String |
colLat |
private static java.lang.String |
colLon |
private static java.lang.String |
colName |
private static java.lang.String |
colTranslit |
private static org.apache.commons.csv.CSVFormat |
csvFormat |
private static java.lang.String[] |
csvHeader |
private static char |
DELIMITER |
private static double |
dx |
private static double |
dy |
private static java.lang.String |
encoding |
(package private) static Assistant |
myAssistant |
private static java.lang.String |
part |
private static char |
QUOTE |
private static int |
srid |
Constructor and Description |
---|
SyntheticDataGenerator() |
Modifier and Type | Method and Description |
---|---|
private static java.util.Iterator<org.apache.commons.csv.CSVRecord> |
collectData(java.lang.String filePath)
Loads the CSV file from the configuration path and returns an iterable feature collection.
|
static java.lang.String[] |
CSV2Array(org.apache.commons.csv.CSVRecord rec)
Convert a CSV record as array for manipulating its constituent values.
|
static void |
main(java.lang.String[] args) |
static void |
modifyCSVFile(java.lang.String inFile,
java.lang.String outFile)
Creates a synthetic dataset from an input CSV file containing spatial entities and their thematic attributes.
|
static int |
pickRandomInt(java.lang.Integer[] objects)
Pick a random value from an array of integers.
|
private static int |
pickRandomPos(int min,
int max)
Pick a random position within a range [min..max]
|
static void |
print(org.apache.commons.csv.CSVPrinter printer,
java.lang.String[] s)
Print array of values as a record to output CSV file.
|
private static boolean |
tossCoin()
Flip a coin and determine a boolean value.
|
private static char DELIMITER
private static char QUOTE
private static int srid
private static java.lang.String colID
private static java.lang.String colGeom
private static java.lang.String colLon
private static java.lang.String colLat
private static java.lang.String colName
private static java.lang.String colTranslit
private static java.lang.String[] colKeep
private static java.lang.String encoding
private static java.lang.String[] csvHeader
private static org.apache.commons.csv.CSVFormat csvFormat
private static double dx
private static double dy
private static java.lang.String part
static Assistant myAssistant
private static java.util.Iterator<org.apache.commons.csv.CSVRecord> collectData(java.lang.String filePath)
filePath
- The path to the CSV file containing data features.private static int pickRandomPos(int min, int max)
min
- The lower bound of the range.max
- The upper bound of the range.public static int pickRandomInt(java.lang.Integer[] objects)
objects
- An array of integer values.private static boolean tossCoin()
public static void modifyCSVFile(java.lang.String inFile, java.lang.String outFile) throws java.lang.Exception
inFile
- The input CSV file with the spatial entities.outFile
- The output CSV file with the spatial entities having their attributes (spatial and thematic) modified in a random fashion.java.lang.Exception
public static java.lang.String[] CSV2Array(org.apache.commons.csv.CSVRecord rec)
rec
- A CSV record with attribute valuespublic static void print(org.apache.commons.csv.CSVPrinter printer, java.lang.String[] s) throws java.lang.Exception
printer
- The CSV printer to be used for issuing results to the output file.s
- An array of attribute values to write as a new record in the file.java.lang.Exception
public static void main(java.lang.String[] args)