You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by rn...@apache.org on 2015/08/25 16:21:45 UTC
[11/11] bigtop git commit: BIGTOP-1984. Extract samplers library from
BigPetStore data generator
BIGTOP-1984. Extract samplers library from BigPetStore data generator
Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/15af83eb
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/15af83eb
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/15af83eb
Branch: refs/heads/master
Commit: 15af83ebdf9f3e039b15daa0352e802165c55bb4
Parents: 3bbbb55
Author: RJ Nowling <rn...@gmail.com>
Authored: Tue Aug 25 09:21:19 2015 -0500
Committer: RJ Nowling <rn...@gmail.com>
Committed: Tue Aug 25 09:21:19 2015 -0500
----------------------------------------------------------------------
.../bigpetstore-data-generator/build.gradle | 5 +-
.../bigpetstore/datagenerator/Constants.java | 99 ------
.../datagenerator/CustomerGenerator.java | 41 ---
.../bigpetstore/datagenerator/DataLoader.java | 57 ----
.../datagenerator/ProductGenerator.java | 50 ---
.../datagenerator/PurchasingModelGenerator.java | 40 ---
.../datagenerator/StoreGenerator.java | 38 ---
.../datagenerator/TransactionGenerator.java | 43 ---
.../bigpetstore/datagenerator/cli/Driver.java | 315 -------------------
.../datagenerator/cli/Simulation.java | 188 -----------
.../datagenerator/datamodels/Customer.java | 59 ----
.../datagenerator/datamodels/PetSpecies.java | 22 --
.../datagenerator/datamodels/Product.java | 96 ------
.../datagenerator/datamodels/Store.java | 51 ---
.../datagenerator/datamodels/Transaction.java | 68 ----
.../datamodels/inputs/InputData.java | 45 ---
.../datagenerator/datamodels/inputs/Names.java | 46 ---
.../datamodels/inputs/ProductCategory.java | 108 -------
.../datamodels/inputs/ZipcodeRecord.java | 90 ------
.../datagenerator/datareaders/NameReader.java | 62 ----
.../datareaders/ZipcodeReader.java | 193 ------------
.../datagenerator/framework/SeedFactory.java | 38 ---
.../framework/markovmodels/MarkovModel.java | 50 ---
.../markovmodels/MarkovModelBuilder.java | 53 ----
.../framework/markovmodels/MarkovProcess.java | 68 ----
.../ConditionalProbabilityDensityFunction.java | 21 --
.../framework/pdfs/ExponentialPDF.java | 31 --
.../framework/pdfs/GaussianPDF.java | 37 ---
.../datagenerator/framework/pdfs/JointPDF.java | 49 ---
.../framework/pdfs/MultinomialPDF.java | 57 ----
.../pdfs/ProbabilityDensityFunction.java | 21 --
.../framework/pdfs/UniformPDF.java | 36 ---
.../BoundedMultiModalGaussianSampler.java | 61 ----
.../framework/samplers/ConditionalSampler.java | 21 --
.../samplers/DoubleSequenceSampler.java | 70 -----
.../framework/samplers/ExponentialSampler.java | 37 ---
.../framework/samplers/GaussianSampler.java | 39 ---
.../framework/samplers/MonteCarloSampler.java | 55 ----
.../samplers/RouletteWheelSampler.java | 111 -------
.../framework/samplers/Sampler.java | 21 --
.../framework/samplers/SequenceSampler.java | 70 -----
.../samplers/StatefulMonteCarloSampler.java | 60 ----
.../framework/samplers/UniformIntSampler.java | 43 ---
.../framework/samplers/UniformSampler.java | 46 ---
.../wfs/ConditionalWeightFunction.java | 21 --
.../framework/wfs/WeightFunction.java | 21 --
.../customer/CustomerLocationPDF.java | 69 ----
.../generators/customer/CustomerSampler.java | 56 ----
.../customer/CustomerSamplerBuilder.java | 80 -----
.../generators/customer/CustomerStorePDF.java | 41 ---
.../products/ProductBuilderIterator.java | 80 -----
.../products/ProductCategoryBuilder.java | 195 ------------
.../generators/products/ProductFieldValue.java | 45 ---
.../products/ProductFilterIterator.java | 72 -----
.../generators/products/ProductIterator.java | 78 -----
.../products/cartesian/CartesianProduct.java | 24 --
.../cartesian/CartesianProductBase.java | 56 ----
.../cartesian/CartesianProductField.java | 79 -----
.../collections/MediumProductCollection.java | 275 ----------------
.../collections/SmallProductCollection.java | 162 ----------
.../products/rules/AlwaysTrueRule.java | 29 --
.../generators/products/rules/AndRule.java | 50 ---
.../products/rules/FieldPredicate.java | 48 ---
.../generators/products/rules/NotRule.java | 36 ---
.../generators/products/rules/OrRule.java | 43 ---
.../generators/products/rules/Rule.java | 23 --
.../MarkovModelProductCategorySampler.java | 119 -------
.../purchase/MarkovPurchasingModel.java | 65 ----
.../purchase/MarkovPurchasingModelSampler.java | 47 ---
.../purchase/MultinomialPurchasingModel.java | 67 ----
.../MultinomialPurchasingModelSampler.java | 143 ---------
.../generators/purchase/PurchasingModel.java | 31 --
.../purchase/PurchasingModelSamplerBuilder.java | 108 -------
.../purchase/PurchasingProcesses.java | 39 ---
.../store/StoreLocationIncomePDF.java | 65 ----
.../store/StoreLocationPopulationPDF.java | 43 ---
.../generators/store/StoreSampler.java | 45 ---
.../generators/store/StoreSamplerBuilder.java | 57 ----
.../transaction/CategoryWeightFunction.java | 39 ---
.../transaction/CustomerInventory.java | 65 ----
.../transaction/CustomerInventoryBuilder.java | 69 ----
.../CustomerTransactionParameters.java | 73 -----
.../CustomerTransactionParametersBuilder.java | 58 ----
.../CustomerTransactionParametersSampler.java | 61 ----
...omerTransactionParametersSamplerBuilder.java | 55 ----
.../transaction/ProductCategoryInventory.java | 58 ----
.../ProductCategoryUsageSimulator.java | 72 -----
.../ProductCategoryUsageTrajectory.java | 74 -----
.../ProposedPurchaseTimeSampler.java | 49 ---
.../TransactionPurchasesHiddenMarkovModel.java | 108 -------
.../TransactionPurchasesSamplerBuilder.java | 70 -----
.../transaction/TransactionSampler.java | 56 ----
.../transaction/TransactionSamplerBuilder.java | 95 ------
.../transaction/TransactionTimePDF.java | 31 --
.../TransactionTimeSamplerBuilder.java | 56 ----
.../datagenerators/bigpetstore/Constants.java | 99 ++++++
.../bigpetstore/CustomerGenerator.java | 41 +++
.../datagenerators/bigpetstore/DataLoader.java | 57 ++++
.../bigpetstore/ProductGenerator.java | 50 +++
.../bigpetstore/PurchasingModelGenerator.java | 40 +++
.../bigpetstore/StoreGenerator.java | 38 +++
.../bigpetstore/TransactionGenerator.java | 43 +++
.../datagenerators/bigpetstore/cli/Driver.java | 315 +++++++++++++++++++
.../bigpetstore/cli/Simulation.java | 188 +++++++++++
.../bigpetstore/datamodels/Customer.java | 59 ++++
.../bigpetstore/datamodels/PetSpecies.java | 22 ++
.../bigpetstore/datamodels/Product.java | 96 ++++++
.../bigpetstore/datamodels/Store.java | 51 +++
.../bigpetstore/datamodels/Transaction.java | 68 ++++
.../datamodels/inputs/InputData.java | 45 +++
.../bigpetstore/datamodels/inputs/Names.java | 46 +++
.../datamodels/inputs/ProductCategory.java | 108 +++++++
.../datamodels/inputs/ZipcodeRecord.java | 90 ++++++
.../bigpetstore/datareaders/NameReader.java | 62 ++++
.../bigpetstore/datareaders/ZipcodeReader.java | 193 ++++++++++++
.../customer/CustomerLocationPDF.java | 69 ++++
.../generators/customer/CustomerSampler.java | 56 ++++
.../customer/CustomerSamplerBuilder.java | 80 +++++
.../generators/customer/CustomerStorePDF.java | 41 +++
.../products/ProductBuilderIterator.java | 80 +++++
.../products/ProductCategoryBuilder.java | 195 ++++++++++++
.../generators/products/ProductFieldValue.java | 45 +++
.../products/ProductFilterIterator.java | 72 +++++
.../generators/products/ProductIterator.java | 78 +++++
.../products/cartesian/CartesianProduct.java | 24 ++
.../cartesian/CartesianProductBase.java | 56 ++++
.../cartesian/CartesianProductField.java | 79 +++++
.../collections/MediumProductCollection.java | 275 ++++++++++++++++
.../collections/SmallProductCollection.java | 162 ++++++++++
.../products/rules/AlwaysTrueRule.java | 29 ++
.../generators/products/rules/AndRule.java | 50 +++
.../products/rules/FieldPredicate.java | 48 +++
.../generators/products/rules/NotRule.java | 36 +++
.../generators/products/rules/OrRule.java | 43 +++
.../generators/products/rules/Rule.java | 23 ++
.../MarkovModelProductCategorySampler.java | 119 +++++++
.../purchase/MarkovPurchasingModel.java | 65 ++++
.../purchase/MarkovPurchasingModelSampler.java | 47 +++
.../purchase/MultinomialPurchasingModel.java | 67 ++++
.../MultinomialPurchasingModelSampler.java | 143 +++++++++
.../generators/purchase/PurchasingModel.java | 31 ++
.../purchase/PurchasingModelSamplerBuilder.java | 108 +++++++
.../purchase/PurchasingProcesses.java | 39 +++
.../store/StoreLocationIncomePDF.java | 65 ++++
.../store/StoreLocationPopulationPDF.java | 43 +++
.../generators/store/StoreSampler.java | 45 +++
.../generators/store/StoreSamplerBuilder.java | 57 ++++
.../transaction/CategoryWeightFunction.java | 39 +++
.../transaction/CustomerInventory.java | 65 ++++
.../transaction/CustomerInventoryBuilder.java | 67 ++++
.../CustomerTransactionParameters.java | 73 +++++
.../CustomerTransactionParametersBuilder.java | 58 ++++
.../CustomerTransactionParametersSampler.java | 61 ++++
...omerTransactionParametersSamplerBuilder.java | 55 ++++
.../transaction/ProductCategoryInventory.java | 58 ++++
.../ProductCategoryUsageSimulator.java | 72 +++++
.../ProductCategoryUsageTrajectory.java | 74 +++++
.../ProposedPurchaseTimeSampler.java | 49 +++
.../TransactionPurchasesHiddenMarkovModel.java | 108 +++++++
.../TransactionPurchasesSamplerBuilder.java | 70 +++++
.../transaction/TransactionSampler.java | 56 ++++
.../transaction/TransactionSamplerBuilder.java | 95 ++++++
.../transaction/TransactionTimePDF.java | 31 ++
.../TransactionTimeSamplerBuilder.java | 56 ++++
.../datagenerator/datamodels/TestProduct.java | 77 -----
.../markovmodels/TestMarkovModelBuilder.java | 76 -----
.../markovmodels/TestMarkovProcess.java | 53 ----
.../framework/pdfs/TestMultinomialPDF.java | 41 ---
.../TestBoundedMultiModalGaussianSampler.java | 48 ---
.../samplers/TestExponentialSampler.java | 41 ---
.../framework/samplers/TestGaussianSampler.java | 43 ---
.../samplers/TestRouletteWheelSampler.java | 71 -----
.../framework/samplers/TestSequenceSampler.java | 38 ---
.../samplers/TestUniformIntSampler.java | 60 ----
.../customer/TestCustomerLocationPDF.java | 57 ----
.../customer/TestCustomerSampler.java | 106 -------
.../customer/TestCustomerSamplerBuilder.java | 76 -----
.../cartesian/TestCartesianProductBase.java | 56 ----
.../cartesian/TestCartesianProductField.java | 72 -----
.../products/rules/TestAlwaysTrueRule.java | 30 --
.../generators/products/rules/TestAndRule.java | 51 ---
.../products/rules/TestFieldPredicate.java | 42 ---
.../generators/products/rules/TestNotRule.java | 36 ---
.../generators/products/rules/TestOrRule.java | 51 ---
.../TestProductCategoryMarkovModelSampler.java | 108 -------
.../purchase/TestPurchasingModelSampler.java | 100 ------
.../TestPurchasingModelSamplerBuilder.java | 100 ------
.../purchase/TestPurchasingProcesses.java | 70 -----
.../store/TestStoreLocationIncomePDF.java | 48 ---
.../store/TestStoreLocationPopulationPDF.java | 48 ---
.../generators/store/TestStoreSampler.java | 58 ----
.../store/TestStoreSamplerBuilder.java | 58 ----
.../transaction/TestCustomerInventory.java | 94 ------
.../TestCustomerInventoryBuilder.java | 91 ------
.../TestCustomerTransactionParameters.java | 69 ----
...estCustomerTransactionParametersBuilder.java | 48 ---
...estCustomerTransactionParametersSampler.java | 47 ---
...omerTransactionParametersSamplerBuilder.java | 47 ---
.../TestProductCategoryInventory.java | 75 -----
.../TestProductCategoryUsageSimulator.java | 51 ---
.../TestProductCategoryUsageTrajectory.java | 69 ----
...stTransactionPurchasesHiddenMarkovModel.java | 205 ------------
.../transaction/TestTransactionTimePDF.java | 35 ---
.../bigpetstore/datamodels/TestProduct.java | 77 +++++
.../customer/TestCustomerLocationPDF.java | 58 ++++
.../customer/TestCustomerSampler.java | 108 +++++++
.../customer/TestCustomerSamplerBuilder.java | 77 +++++
.../cartesian/TestCartesianProductBase.java | 57 ++++
.../cartesian/TestCartesianProductField.java | 74 +++++
.../products/rules/TestAlwaysTrueRule.java | 32 ++
.../generators/products/rules/TestAndRule.java | 55 ++++
.../products/rules/TestFieldPredicate.java | 44 +++
.../generators/products/rules/TestNotRule.java | 39 +++
.../generators/products/rules/TestOrRule.java | 55 ++++
.../TestProductCategoryMarkovModelSampler.java | 108 +++++++
.../purchase/TestPurchasingModelSampler.java | 100 ++++++
.../TestPurchasingModelSamplerBuilder.java | 100 ++++++
.../purchase/TestPurchasingProcesses.java | 70 +++++
.../store/TestStoreLocationIncomePDF.java | 49 +++
.../store/TestStoreLocationPopulationPDF.java | 49 +++
.../generators/store/TestStoreSampler.java | 59 ++++
.../store/TestStoreSamplerBuilder.java | 59 ++++
.../transaction/TestCustomerInventory.java | 94 ++++++
.../TestCustomerInventoryBuilder.java | 91 ++++++
.../TestCustomerTransactionParameters.java | 69 ++++
...estCustomerTransactionParametersBuilder.java | 48 +++
...estCustomerTransactionParametersSampler.java | 47 +++
...omerTransactionParametersSamplerBuilder.java | 47 +++
.../TestProductCategoryInventory.java | 75 +++++
.../TestProductCategoryUsageSimulator.java | 53 ++++
.../TestProductCategoryUsageTrajectory.java | 70 +++++
...stTransactionPurchasesHiddenMarkovModel.java | 205 ++++++++++++
.../transaction/TestTransactionTimePDF.java | 35 +++
.../bigtop-samplers/README.md | 49 +++
.../bigtop-samplers/build.gradle | 64 ++++
.../bigtop-samplers/settings.gradle | 16 +
.../datagenerators/samplers/SeedFactory.java | 38 +++
.../samplers/markovmodels/MarkovModel.java | 50 +++
.../markovmodels/MarkovModelBuilder.java | 53 ++++
.../samplers/markovmodels/MarkovProcess.java | 68 ++++
.../ConditionalProbabilityDensityFunction.java | 21 ++
.../samplers/pdfs/ExponentialPDF.java | 31 ++
.../samplers/pdfs/GaussianPDF.java | 37 +++
.../datagenerators/samplers/pdfs/JointPDF.java | 49 +++
.../samplers/pdfs/MultinomialPDF.java | 57 ++++
.../pdfs/ProbabilityDensityFunction.java | 21 ++
.../samplers/pdfs/UniformPDF.java | 36 +++
.../BoundedMultiModalGaussianSampler.java | 61 ++++
.../samplers/samplers/ConditionalSampler.java | 21 ++
.../samplers/DoubleSequenceSampler.java | 70 +++++
.../samplers/samplers/ExponentialSampler.java | 37 +++
.../samplers/samplers/GaussianSampler.java | 39 +++
.../samplers/samplers/MonteCarloSampler.java | 55 ++++
.../samplers/samplers/RouletteWheelSampler.java | 111 +++++++
.../samplers/samplers/Sampler.java | 21 ++
.../samplers/samplers/SequenceSampler.java | 70 +++++
.../samplers/StatefulMonteCarloSampler.java | 60 ++++
.../samplers/samplers/UniformIntSampler.java | 43 +++
.../samplers/samplers/UniformSampler.java | 46 +++
.../samplers/wfs/ConditionalWeightFunction.java | 21 ++
.../samplers/wfs/WeightFunction.java | 21 ++
.../markovmodels/TestMarkovModelBuilder.java | 76 +++++
.../markovmodels/TestMarkovProcess.java | 53 ++++
.../samplers/pdfs/TestMultinomialPDF.java | 42 +++
.../TestBoundedMultiModalGaussianSampler.java | 50 +++
.../samplers/TestExponentialSampler.java | 41 +++
.../samplers/samplers/TestGaussianSampler.java | 43 +++
.../samplers/TestRouletteWheelSampler.java | 71 +++++
.../samplers/samplers/TestSequenceSampler.java | 38 +++
.../samplers/TestUniformIntSampler.java | 60 ++++
270 files changed, 9015 insertions(+), 8855 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/build.gradle
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/build.gradle b/bigtop-data-generators/bigpetstore-data-generator/build.gradle
index 8c2ea57..d18cac5 100644
--- a/bigtop-data-generators/bigpetstore-data-generator/build.gradle
+++ b/bigtop-data-generators/bigpetstore-data-generator/build.gradle
@@ -18,7 +18,7 @@ apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'maven'
group = 'org.apache.bigtop'
-version = '0.9.0-SNAPSHOT'
+version = '1.1.0-SNAPSHOT'
jar {
@@ -30,7 +30,7 @@ jar {
manifest {
attributes 'Title': 'BigPetStore Data Generator', 'Version': version
- attributes 'Main-Class': 'org.apache.bigtop.bigpetstore.datagenerator.cli.Driver'
+ attributes 'Main-Class': 'org.apache.bigtop.datagenerators.bigpetstore.cli.Driver'
}
}
@@ -59,6 +59,7 @@ dependencies {
compile 'com.google.guava:guava:18.0'
compile 'com.google.code.gson:gson:2.3'
compile 'org.apache.commons:commons-lang3:3.4'
+ compile 'org.apache.bigtop:bigtop-samplers:1.1.0-SNAPSHOT'
testCompile 'junit:junit:4.+'
}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/Constants.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/Constants.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/Constants.java
deleted file mode 100644
index ff87c2e..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/Constants.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator;
-
-import java.io.File;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.lang3.tuple.Pair;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-
-public class Constants
-{
- public static enum PurchasingModelType
- {
- MULTINOMIAL,
- MARKOV;
- }
-
- public static enum ProductsCollectionSize
- {
- SMALL,
- MEDIUM;
- }
-
- public static final File COORDINATES_FILE = new File("zips.csv");
- public static final File INCOMES_FILE = new File("ACS_12_5YR_S1903/ACS_12_5YR_S1903_with_ann.csv");
- public static final File POPULATION_FILE = new File("population_data.csv");
-
- public static final File NAMEDB_FILE = new File("namedb/data/data.dat");
-
- public static final ProductsCollectionSize PRODUCTS_COLLECTION = ProductsCollectionSize.MEDIUM;
-
- public static final double INCOME_SCALING_FACTOR = 100.0;
-
- public static final int MIN_PETS = 1;
- public static final int MAX_PETS = 10;
-
- public static final List<Pair<Double, Double>> TRANSACTION_TRIGGER_TIME_GAUSSIANS = ImmutableList.of(Pair.of(5.0, 2.0));
- public static final List<Pair<Double, Double>> PURCHASE_TRIGGER_TIME_GAUSSIANS = ImmutableList.of(Pair.of(10.0, 4.0));
-
- public static final double TRANSACTION_TRIGGER_TIME_MAX = 10.0;
- public static final double TRANSACTION_TRIGGER_TIME_MIN = 1.0;
-
- public static final double PURCHASE_TRIGGER_TIME_MAX = 20.0;
- public static final double PURCHASE_TRIGGER_TIME_MIN = 1.0;
-
- public static final double AVERAGE_CUSTOMER_STORE_DISTANCE = 5.0; // miles
-
- public static final PurchasingModelType PURCHASING_MODEL_TYPE = PurchasingModelType.MULTINOMIAL;
-
- public static final List<Pair<Double, Double>> PRODUCT_MSM_FIELD_WEIGHT_GAUSSIANS = ImmutableList.of(Pair.of(0.15, 0.1), Pair.of(0.85, 0.1));
- public static final double PRODUCT_MSM_FIELD_WEIGHT_LOWERBOUND = 0.05;
- public static final double PRODUCT_MSM_FIELD_WEIGHT_UPPERBOUND = 0.95;
-
- public static final List<Pair<Double, Double>> PRODUCT_MSM_FIELD_SIMILARITY_WEIGHT_GAUSSIANS = ImmutableList.of(Pair.of(0.15, 0.1), Pair.of(0.85, 0.1));
- public static final double PRODUCT_MSM_FIELD_SIMILARITY_WEIGHT_LOWERBOUND = 0.05;
- public static final double PRODUCT_MSM_FIELD_SIMILARITY_WEIGHT_UPPERBOUND = 0.95;
-
- public static final List<Pair<Double, Double>> PRODUCT_MSM_LOOPBACK_WEIGHT_GAUSSIANS = ImmutableList.of(Pair.of(0.25, 0.1), Pair.of(0.75, 0.1));
- public static final double PRODUCT_MSM_LOOPBACK_WEIGHT_LOWERBOUND = 0.05;
- public static final double PRODUCT_MSM_LOOPBACK_WEIGHT_UPPERBOUND = 0.95;
-
- public static final double PRODUCT_MULTINOMIAL_POSITIVE_WEIGHT = 10.0;
- public static final double PRODUCT_MULTINOMIAL_NEUTRAL_WEIGHT = 1.0;
- public static final double PRODUCT_MULTINOMIAL_NEGATIVE_WEIGHT = 0.1;
- public static final int PRODUCT_MULTINOMIAL_POSITIVE_COUNT_MIN = 1;
- public static final double PRODUCT_MULTINOMIAL_POSITIVE_FREQUENCY = 0.1; // 10%
-
- public static final String PRODUCT_QUANTITY = "quantity";
- public static final String PRODUCT_CATEGORY = "category";
- public static final String PRODUCT_UNIT_PRICE = "unitPrice";
- public static final String PRODUCT_PRICE = "price";
-
- /*
- * Until we have a more intelligent way (e.g., based on range) of dealing with prices,
- * let's exclude them.
- */
- public static final Set<String> PRODUCT_MODEL_EXCLUDED_FIELDS = ImmutableSet.of(PRODUCT_CATEGORY,
- PRODUCT_UNIT_PRICE,
- PRODUCT_PRICE);
-
- public static final double STOP_CATEGORY_WEIGHT = 0.01;
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/CustomerGenerator.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/CustomerGenerator.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/CustomerGenerator.java
deleted file mode 100644
index 799b2e3..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/CustomerGenerator.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator;
-
-import java.util.List;
-
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Customer;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Store;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.InputData;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
-import org.apache.bigtop.bigpetstore.datagenerator.generators.customer.CustomerSamplerBuilder;
-
-public class CustomerGenerator
-{
- final Sampler<Customer> sampler;
-
- public CustomerGenerator(InputData inputData, List<Store> stores, SeedFactory seedFactory)
- {
- CustomerSamplerBuilder builder = new CustomerSamplerBuilder(stores, inputData, seedFactory);
- sampler = builder.build();
- }
-
- public Customer generate() throws Exception
- {
- return sampler.sample();
- }
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/DataLoader.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/DataLoader.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/DataLoader.java
deleted file mode 100644
index a67acd7..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/DataLoader.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.InputStream;
-import java.util.List;
-
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.InputData;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.Names;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ZipcodeRecord;
-import org.apache.bigtop.bigpetstore.datagenerator.datareaders.NameReader;
-import org.apache.bigtop.bigpetstore.datagenerator.datareaders.ZipcodeReader;
-
-public class DataLoader
-{
- private InputStream getResource(File filename) throws Exception
- {
- InputStream stream = getClass().getResourceAsStream("/input_data/" + filename);
- return new BufferedInputStream(stream);
- }
-
- public InputData loadData() throws Exception
- {
-
- System.out.println("Reading zipcode data");
- ZipcodeReader zipcodeReader = new ZipcodeReader();
- zipcodeReader.setCoordinatesFile(getResource(Constants.COORDINATES_FILE));
- zipcodeReader.setIncomesFile(getResource(Constants.INCOMES_FILE));
- zipcodeReader.setPopulationFile(getResource(Constants.POPULATION_FILE));
- List<ZipcodeRecord> zipcodeTable = zipcodeReader.readData();
- System.out.println("Read " + zipcodeTable.size() + " zipcode entries");
-
- System.out.println("Reading name data");
- NameReader nameReader = new NameReader(getResource(Constants.NAMEDB_FILE));
- Names names = nameReader.readData();
- System.out.println("Read " + names.getFirstNames().size() + " first names and " + names.getLastNames().size() + " last names");
-
- InputData inputData = new InputData(zipcodeTable, names);
-
- return inputData;
- }
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/ProductGenerator.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/ProductGenerator.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/ProductGenerator.java
deleted file mode 100644
index cd008ac..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/ProductGenerator.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator;
-
-import java.util.List;
-
-import org.apache.bigtop.bigpetstore.datagenerator.Constants.ProductsCollectionSize;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ProductCategory;
-import org.apache.bigtop.bigpetstore.datagenerator.generators.products.collections.MediumProductCollection;
-import org.apache.bigtop.bigpetstore.datagenerator.generators.products.collections.SmallProductCollection;
-
-public class ProductGenerator
-{
- ProductsCollectionSize collection;
-
- public ProductGenerator(ProductsCollectionSize collection)
- {
- this.collection = collection;
- }
-
- public List<ProductCategory> generate()
- {
- List<ProductCategory> categories;
-
- if(collection.equals(ProductsCollectionSize.SMALL))
- {
- SmallProductCollection collection = new SmallProductCollection();
- categories = collection.generateProductCategory();
- } else
- {
- MediumProductCollection collection = new MediumProductCollection();
- categories = collection.generateProductCategory();
- }
-
- return categories;
- }
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/PurchasingModelGenerator.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/PurchasingModelGenerator.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/PurchasingModelGenerator.java
deleted file mode 100644
index 6994d9e..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/PurchasingModelGenerator.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator;
-
-import java.util.Collection;
-
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ProductCategory;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
-import org.apache.bigtop.bigpetstore.datagenerator.generators.purchase.PurchasingModel;
-import org.apache.bigtop.bigpetstore.datagenerator.generators.purchase.PurchasingModelSamplerBuilder;
-
-public class PurchasingModelGenerator
-{
- final Sampler<? extends PurchasingModel> sampler;
-
- public PurchasingModelGenerator(Collection<ProductCategory> productCategories, SeedFactory seedFactory) throws Exception
- {
- PurchasingModelSamplerBuilder builder = new PurchasingModelSamplerBuilder(productCategories, seedFactory);
- sampler = builder.build();
- }
-
- public PurchasingModel generate() throws Exception
- {
- return sampler.sample();
- }
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/StoreGenerator.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/StoreGenerator.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/StoreGenerator.java
deleted file mode 100644
index df6d759..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/StoreGenerator.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator;
-
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Store;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.InputData;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
-import org.apache.bigtop.bigpetstore.datagenerator.generators.store.StoreSamplerBuilder;
-
-public class StoreGenerator
-{
- final Sampler<Store> sampler;
-
- public StoreGenerator(InputData inputData, SeedFactory seedFactory)
- {
- StoreSamplerBuilder builder = new StoreSamplerBuilder(inputData.getZipcodeTable(), seedFactory);
- sampler = builder.build();
- }
-
- public Store generate() throws Exception
- {
- return sampler.sample();
- }
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/TransactionGenerator.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/TransactionGenerator.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/TransactionGenerator.java
deleted file mode 100644
index 8f78bb7..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/TransactionGenerator.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator;
-
-import java.util.Collection;
-
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Customer;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Transaction;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ProductCategory;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
-import org.apache.bigtop.bigpetstore.datagenerator.generators.purchase.PurchasingModel;
-import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.TransactionSamplerBuilder;
-
-public class TransactionGenerator
-{
- Sampler<Transaction> sampler;
-
- public TransactionGenerator(Customer customer, PurchasingModel profile,
- Collection<ProductCategory> productCategories, SeedFactory seedFactory) throws Exception
- {
- sampler = new TransactionSamplerBuilder(productCategories,
- customer, profile, seedFactory).build();
- }
-
- public Transaction generate() throws Exception
- {
- return sampler.sample();
- }
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/cli/Driver.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/cli/Driver.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/cli/Driver.java
deleted file mode 100644
index 3fdef68..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/cli/Driver.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.cli;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.bigtop.bigpetstore.datagenerator.DataLoader;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Customer;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Product;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Store;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Transaction;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.InputData;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ProductCategory;
-import org.apache.bigtop.bigpetstore.datagenerator.generators.purchase.PurchasingModel;
-import org.apache.commons.lang3.tuple.Pair;
-
-
-public class Driver
-{
- int nStores;
- int nCustomers;
- int nPurchasingModels;
- double simulationTime;
- long seed;
- File outputDir;
-
- static final int NPARAMS = 6;
-
- private void printUsage()
- {
- String usage = "BigPetStore Data Generator\n" +
- "\n" +
- "Usage: java -jar bps-data-generator-v0.2.java outputDir nStores nCustomers nPurchasingModels simulationLength seed\n" +
- "\n" +
- "outputDir - (string) directory to write files\n" +
- "nStores - (int) number of stores to generate\n" +
- "nCustomers - (int) number of customers to generate\n" +
- "nPurchasingModels - (int) number of purchasing models to generate\n" +
- "simulationLength - (float) number of days to simulate\n" +
- "seed - (long) seed for RNG. If not given, one is reandomly generated.\n";
-
- System.out.println(usage);
- }
-
- public void parseArgs(String[] args)
- {
- if(args.length != NPARAMS && args.length != (NPARAMS - 1))
- {
- printUsage();
- System.exit(1);
- }
-
- int i = -1;
-
- outputDir = new File(args[++i]);
- if(! outputDir.exists())
- {
- System.err.println("Given path (" + args[i] + ") does not exist.\n");
- printUsage();
- System.exit(1);
- }
-
- if(! outputDir.isDirectory())
- {
- System.err.println("Given path (" + args[i] + ") is not a directory.\n");
- printUsage();
- System.exit(1);
- }
-
- try
- {
- nStores = Integer.parseInt(args[++i]);
- }
- catch(Exception e)
- {
- System.err.println("Unable to parse '" + args[i] + "' as an integer for nStores.\n");
- printUsage();
- System.exit(1);
- }
-
- try
- {
- nCustomers = Integer.parseInt(args[++i]);
- }
- catch(Exception e)
- {
- System.err.println("Unable to parse '" + args[i] + "' as an integer for nCustomers.\n");
- printUsage();
- System.exit(1);
- }
-
- try
- {
- nPurchasingModels = Integer.parseInt(args[++i]);
- }
- catch(Exception e)
- {
- System.err.println("Unable to parse '" + args[i] + "' as an integer for nPurchasingModels.\n");
- printUsage();
- System.exit(1);
- }
-
- try
- {
- simulationTime = Double.parseDouble(args[++i]);
- }
- catch(Exception e)
- {
- System.err.println("Unable to parse '" + args[i] + "' as a float for simulationLength.\n");
- printUsage();
- System.exit(1);
- }
-
- try
- {
- seed = Long.parseLong(args[++i]);
- }
- catch(Exception e)
- {
- System.err.println("Unable to parse '" + args[i] + "' as a long for the seed.\n");
- printUsage();
- System.exit(1);
- }
- }
-
- private void writeTransactions(Collection<Transaction> transactions) throws Exception
- {
- File outputFile = new File(outputDir.toString() + File.separator + "transactions.txt");
- System.out.println(outputFile.toString());
- OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(outputFile));
-
- for(Transaction transaction : transactions)
- {
- for(Product product : transaction.getProducts())
- {
- String record = transaction.getId() + ",";
- record += transaction.getDateTime() + ",";
- record += transaction.getStore().getId() + ",";
- record += transaction.getStore().getLocation().getZipcode() + ",";
- record += transaction.getStore().getLocation().getCity() + ",";
- record += transaction.getStore().getLocation().getState() + ",";
- record += transaction.getCustomer().getId() + ",";
- Pair<String, String> name = transaction.getCustomer().getName();
- record += name.getLeft() + " " + name.getRight() + ",";
- record += transaction.getCustomer().getLocation().getZipcode() + ",";
- record += transaction.getCustomer().getLocation().getCity() + ",";
- record += transaction.getCustomer().getLocation().getState() + ",";
- record += product.toString() + "\n";
-
- outputStream.write(record.getBytes());
- }
- }
-
- outputStream.close();
- }
-
- private void writeCustomers(Collection<Customer> customers) throws Exception
- {
- File outputFile = new File(outputDir.toString() + File.separator + "customers.txt");
- System.out.println(outputFile.toString());
- OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(outputFile));
-
- for(Customer customer : customers)
- {
- String record = customer.getId() + ",";
- Pair<String, String> name = customer.getName();
- record += name.getLeft() + "," + name.getRight() + ",";
- record += customer.getLocation().getZipcode() + ",";
- record += customer.getLocation().getCity() + ",";
- record += customer.getLocation().getState() + "\n";
-
- outputStream.write(record.getBytes());
- }
-
- outputStream.close();
- }
-
- private void writeStores(Collection<Store> stores) throws Exception
- {
- File outputFile = new File(outputDir.toString() + File.separator + "stores.txt");
- System.out.println(outputFile.toString());
- OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(outputFile));
-
- for(Store store : stores)
- {
- String record = store.getId() + ",";
- record += store.getLocation().getZipcode() + ",";
- record += store.getLocation().getCity() + ",";
- record += store.getLocation().getState() + "\n";
-
- outputStream.write(record.getBytes());
- }
-
- outputStream.close();
- }
-
- private void writeProducts(Collection<ProductCategory> productCategories) throws Exception
- {
- File outputFile = new File(outputDir.toString() + File.separator + "products.txt");
- System.out.println(outputFile.toString());
- OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(outputFile));
-
- for(ProductCategory category : productCategories)
- {
-
- for(Product product : category.getProducts())
- {
- String record = category.getCategoryLabel() + ",";
- record += product.toString() + "\n";
-
- outputStream.write(record.getBytes());
- }
- }
-
- outputStream.close();
- }
-
- private void writePurchasingProfiles(List<ProductCategory> productCategories, List<PurchasingModel> profiles) throws Exception
- {
- File outputFile = new File(outputDir.toString() + File.separator + "purchasing_profiles.txt");
- System.out.println(outputFile.toString());
- OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(outputFile));
-
- for(ProductCategory category : productCategories)
- {
- int i = 0;
- for(PurchasingModel model : profiles)
- {
- Object productModel = model.getProfile(category.getCategoryLabel());
- String record = productModel.toString();
-
- outputStream.write(record.getBytes());
-
- i += 1;
- }
- }
-
- outputStream.close();
- }
-
- public Simulation buildSimulation(InputData inputData)
- {
- return new Simulation(inputData, nStores, nCustomers, nPurchasingModels, simulationTime, seed);
- }
-
- private void run(InputData inputData) throws Exception
- {
- Simulation simulation = buildSimulation(inputData);
-
- simulation.simulate();
-
- writeStores(simulation.getStores());
- writeCustomers(simulation.getCustomers());
- writeProducts(simulation.getProductCategories());
- writePurchasingProfiles(simulation.getProductCategories(), simulation.getPurchasingProfiles());
- writeTransactions(simulation.getTransactions());
- }
- public void run(String[] args) throws Exception
- {
- parseArgs(args);
-
- InputData inputData = (new DataLoader()).loadData();
-
- run(inputData);
- }
-
- public static void main(String[] args) throws Exception
- {
- Driver driver = new Driver();
- driver.run(args);
- }
-
- public Double getSimulationLength()
- {
- return simulationTime;
- }
-
- public int getNCustomers()
- {
- return nCustomers;
- }
-
- public long getSeed()
- {
- return seed;
- }
-
- public int getNStores()
- {
- return nStores;
- }
-
- public File getOutputDir()
- {
- return outputDir;
- }
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/cli/Simulation.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/cli/Simulation.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/cli/Simulation.java
deleted file mode 100644
index 4b9b500..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/cli/Simulation.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.cli;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Vector;
-
-import org.apache.bigtop.bigpetstore.datagenerator.Constants;
-import org.apache.bigtop.bigpetstore.datagenerator.CustomerGenerator;
-import org.apache.bigtop.bigpetstore.datagenerator.ProductGenerator;
-import org.apache.bigtop.bigpetstore.datagenerator.PurchasingModelGenerator;
-import org.apache.bigtop.bigpetstore.datagenerator.StoreGenerator;
-import org.apache.bigtop.bigpetstore.datagenerator.TransactionGenerator;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Customer;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Store;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Transaction;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.InputData;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ProductCategory;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.RouletteWheelSampler;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
-import org.apache.bigtop.bigpetstore.datagenerator.generators.purchase.PurchasingModel;
-
-import com.google.common.collect.Lists;
-
-public class Simulation
-{
- InputData inputData;
- SeedFactory seedFactory;
- int nStores;
- int nCustomers;
- int nPurchasingModels;
- double simulationTime;
-
- List<Store> stores;
- List<Customer> customers;
- Sampler<PurchasingModel> purchasingModelSampler;
- List<PurchasingModel> purchasingProfiles;
- List<Transaction> transactions;
- List<ProductCategory> productCategories;
-
- public Simulation(InputData inputData, int nStores, int nCustomers, int nPurchasingModels, double simulationTime, long seed)
- {
- this.inputData = inputData;
- this.nStores = nStores;
- this.nCustomers = nCustomers;
- this.nPurchasingModels = nPurchasingModels;
- this.simulationTime = simulationTime;
- seedFactory = new SeedFactory(seed);
- }
-
- public void generateStores() throws Exception
- {
- System.out.println("Generating stores");
- StoreGenerator storeGenerator = new StoreGenerator(inputData, seedFactory);
-
- stores = new Vector<Store>();
- for(int i = 0; i < nStores; i++)
- {
- Store store = storeGenerator.generate();
- stores.add(store);
- }
-
- stores = Collections.unmodifiableList(stores);
-
- System.out.println("Generated " + stores.size() + " stores");
- }
-
- public void generateCustomers() throws Exception
- {
- System.out.println("Generating customers");
- CustomerGenerator generator = new CustomerGenerator(inputData, stores, seedFactory);
-
- customers = new Vector<Customer>();
- for(int i = 0; i < nCustomers; i++)
- {
- Customer customer = generator.generate();
- customers.add(customer);
- }
-
- customers = Collections.unmodifiableList(customers);
-
- System.out.println("Generated " + customers.size() + " customers");
- }
-
- public void generateProducts()
- {
- System.out.println("Generating products");
- ProductGenerator generator = new ProductGenerator(Constants.PRODUCTS_COLLECTION);
- productCategories = generator.generate();
- }
-
- public void generatePurchasingProfiles() throws Exception
- {
- System.out.println("Generating purchasing profiles");
- PurchasingModelGenerator generator = new PurchasingModelGenerator(productCategories, seedFactory);
-
- purchasingProfiles = new Vector<PurchasingModel>();
- for(int i = 0; i < nPurchasingModels; i++)
- {
- PurchasingModel profile = generator.generate();
- purchasingProfiles.add(profile);
- }
-
- System.out.println("Generated " + purchasingProfiles.size() + " purchasing profiles");
-
- purchasingModelSampler = RouletteWheelSampler.createUniform(purchasingProfiles, seedFactory);
- }
-
- public void generateTransactions() throws Exception
- {
- System.out.println("Generating transactions");
- transactions = Lists.newArrayList();
-
- for(int i = 0; i < nCustomers; i++)
- {
- Customer customer = customers.get(i);
- PurchasingModel profile = purchasingModelSampler.sample();
-
- TransactionGenerator generator = new TransactionGenerator(customer,
- profile, productCategories, seedFactory);
-
- while(true)
- {
- Transaction transaction = generator.generate();
-
- if(transaction.getDateTime() > simulationTime)
- break;
- transactions.add(transaction);
- }
- }
-
- System.out.println("Generated " + transactions.size() + " transactions");
- }
-
- public void simulate() throws Exception
- {
- generateStores();
- generateCustomers();
- generateProducts();
- generatePurchasingProfiles();
- generateTransactions();
- }
-
- public List<Store> getStores()
- {
- return stores;
- }
-
- public List<Customer> getCustomers()
- {
- return customers;
- }
-
- public List<Transaction> getTransactions()
- {
- return transactions;
- }
-
- public InputData getInputData()
- {
- return inputData;
- }
-
- public List<ProductCategory> getProductCategories()
- {
- return this.productCategories;
- }
-
- public List<PurchasingModel> getPurchasingProfiles()
- {
- return this.purchasingProfiles;
- }
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/Customer.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/Customer.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/Customer.java
deleted file mode 100644
index 704c965..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/Customer.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.datamodels;
-
-import java.io.Serializable;
-
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ZipcodeRecord;
-import org.apache.commons.lang3.tuple.Pair;
-
-public class Customer implements Serializable
-{
- private static final long serialVersionUID = 5739806281335931258L;
-
- int id;
- Pair<String, String> name;
- ZipcodeRecord location;
- Store store;
-
- public Customer(int id, Pair<String, String> name, Store store, ZipcodeRecord location)
- {
- this.id = id;
- this.name = name;
- this.location = location;
- this.store = store;
- }
-
- public int getId()
- {
- return id;
- }
-
- public Pair<String, String> getName()
- {
- return name;
- }
-
- public ZipcodeRecord getLocation()
- {
- return location;
- }
-
- public Store getStore()
- {
- return store;
- }
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/PetSpecies.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/PetSpecies.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/PetSpecies.java
deleted file mode 100644
index d4bab79..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/PetSpecies.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.datamodels;
-
-public enum PetSpecies
-{
- DOG,
- CAT;
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/Product.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/Product.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/Product.java
deleted file mode 100644
index 1d4e074..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/Product.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.datamodels;
-
-import java.io.Serializable;
-import java.util.Map;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-public class Product implements Serializable
-{
- private static final long serialVersionUID = 4519472063058037956L;
-
- ImmutableMap<String, Object> fields;
-
- public Product(Map<String, Object> fields)
- {
- this.fields = ImmutableMap.copyOf(fields);
- }
-
- public ImmutableSet<String> getFieldNames()
- {
- return fields.keySet();
- }
-
- public Object getFieldValue(String fieldName)
- {
- return fields.get(fieldName);
- }
-
- public String getFieldValueAsString(String fieldName)
- {
- return fields.get(fieldName).toString();
- }
-
- public Double getFieldValueAsDouble(String fieldName)
- {
- Object value = getFieldValue(fieldName);
- try
- {
- Double doubleValue = (Double) value;
- return doubleValue;
- }
- catch(ClassCastException e)
- {
- return null;
- }
- }
-
- public Long getFieldValueAsLong(String fieldName)
- {
- Object value = getFieldValue(fieldName);
- try
- {
- Long longValue = (Long) value;
- return longValue;
- }
- catch(ClassCastException e)
- {
- try
- {
- Integer intValue = (Integer) value;
- return new Long(intValue);
- }
- catch(ClassCastException f)
- {
- return null;
- }
- }
- }
-
- public String toString()
- {
- String str = "";
- for(Map.Entry<String, Object> entry : fields.entrySet())
- {
- str += entry.getKey() + "=" + entry.getValue() + ";";
- }
-
- return str;
- }
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/Store.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/Store.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/Store.java
deleted file mode 100644
index 50e333a..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/Store.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.datamodels;
-
-import java.io.Serializable;
-
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ZipcodeRecord;
-
-public class Store implements Serializable
-{
- private static final long serialVersionUID = 2347066623022747969L;
-
- int id;
- String name;
- ZipcodeRecord location;
-
- public Store(int id, String name, ZipcodeRecord location)
- {
- this.id = id;
- this.name = name;
- this.location = location;
- }
-
- public int getId()
- {
- return id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public ZipcodeRecord getLocation()
- {
- return location;
- }
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/Transaction.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/Transaction.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/Transaction.java
deleted file mode 100644
index 6a78e44..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/Transaction.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.datamodels;
-
-import java.io.Serializable;
-import java.util.List;
-
-import com.google.common.collect.ImmutableList;
-
-public class Transaction implements Serializable
-{
- private static final long serialVersionUID = 103133601154354349L;
-
- final int id;
- final Customer customer;
- final Store store;
- final Double dateTime;
- final ImmutableList<Product> products;
-
- public Transaction(int id, Customer customer, Store store, Double dateTime, List<Product> products)
- {
- this.id = id;
- this.customer = customer;
- this.store = store;
- this.dateTime = dateTime;
- this.products = ImmutableList.copyOf(products);
- }
-
- public int getId()
- {
- return id;
- }
-
- public Customer getCustomer()
- {
- return customer;
- }
-
- public Store getStore()
- {
- return store;
- }
-
- public Double getDateTime()
- {
- return dateTime;
- }
-
- public ImmutableList<Product> getProducts()
- {
- return products;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/InputData.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/InputData.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/InputData.java
deleted file mode 100644
index 4fad219..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/InputData.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.List;
-
-public class InputData implements Serializable
-{
- private static final long serialVersionUID = 9078989799806707788L;
-
- List<ZipcodeRecord> zipcodeTable;
- Names names;
-
- public InputData(List<ZipcodeRecord> zipcodeTable,
- Names names)
- {
- this.zipcodeTable = Collections.unmodifiableList(zipcodeTable);
- this.names = names;
- }
-
- public List<ZipcodeRecord> getZipcodeTable()
- {
- return zipcodeTable;
- }
-
- public Names getNames()
- {
- return names;
- }
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/Names.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/Names.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/Names.java
deleted file mode 100644
index 9402e02..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/Names.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs;
-
-import java.io.Serializable;
-import java.util.Map;
-
-import com.google.common.collect.ImmutableMap;
-
-public class Names implements Serializable
-{
- private static final long serialVersionUID = 2731634747628534453L;
-
- final ImmutableMap<String, Double> firstNames;
- final ImmutableMap<String, Double> lastNames;
-
- public Names(Map<String, Double> firstNames,
- Map<String, Double> lastNames)
- {
- this.firstNames = ImmutableMap.copyOf(firstNames);
- this.lastNames = ImmutableMap.copyOf(lastNames);
- }
-
- public ImmutableMap<String, Double> getFirstNames()
- {
- return firstNames;
- }
-
- public ImmutableMap<String, Double> getLastNames()
- {
- return lastNames;
- }
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/ProductCategory.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/ProductCategory.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/ProductCategory.java
deleted file mode 100644
index 6fb0572..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/ProductCategory.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.PetSpecies;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Product;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-
-public class ProductCategory implements Serializable
-{
- private static final long serialVersionUID = -7638076590334497836L;
-
- String categoryLabel;
- ImmutableSet<PetSpecies> applicableSpecies;
- ImmutableSet<String> fieldNames;
- boolean triggerTransaction;
- double dailyUsageRate;
- double amountUsedPerPetAverage;
- double amountUsedPerPetVariance;
- double triggerTransactionRate;
- double triggerPurchaseRate;
- ImmutableList<Product> products;
-
- public ProductCategory(String categoryLabel, Set<PetSpecies> species, Set<String> fieldNames,
- boolean triggerTransaction, double dailyUsageRate, double amountUsedPerPetAverage,
- double amountUsedPerPetVariance, double triggerTransactionRate,
- double triggerPurchaseRate, List<Product> products)
- {
- this.categoryLabel = categoryLabel;
- this.applicableSpecies = ImmutableSet.copyOf(species);
- this.fieldNames = ImmutableSet.copyOf(fieldNames);
- this.triggerTransaction = triggerTransaction;
- this.dailyUsageRate = dailyUsageRate;
- this.amountUsedPerPetAverage = amountUsedPerPetAverage;
- this.amountUsedPerPetVariance = amountUsedPerPetVariance;
- this.triggerTransactionRate = triggerTransactionRate;
- this.triggerPurchaseRate = triggerPurchaseRate;
- this.products = ImmutableList.copyOf(products);
- }
-
- public String getCategoryLabel()
- {
- return categoryLabel;
- }
-
- public ImmutableSet<PetSpecies> getApplicableSpecies()
- {
- return applicableSpecies;
- }
-
- public ImmutableSet<String> getFieldNames()
- {
- return fieldNames;
- }
- public Boolean getTriggerTransaction()
- {
- return triggerTransaction;
- }
-
- public Double getDailyUsageRate()
- {
- return dailyUsageRate;
- }
-
- public Double getBaseAmountUsedAverage()
- {
- return amountUsedPerPetAverage;
- }
-
- public Double getBaseAmountUsedVariance()
- {
- return amountUsedPerPetVariance;
- }
-
- public Double getTransactionTriggerRate()
- {
- return triggerTransactionRate;
- }
-
- public Double getPurchaseTriggerRate()
- {
- return triggerPurchaseRate;
- }
-
- public ImmutableList<Product> getProducts()
- {
- return products;
- }
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/ZipcodeRecord.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/ZipcodeRecord.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/ZipcodeRecord.java
deleted file mode 100644
index ef54712..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/ZipcodeRecord.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs;
-
-import java.io.Serializable;
-
-import org.apache.commons.lang3.tuple.Pair;
-
-public class ZipcodeRecord implements Serializable
-{
- private static final long serialVersionUID = 1769986686070108470L;
-
- final String zipcode;
- final Pair<Double, Double> coordinates;
- final String city;
- final String state;
- final double medianHouseholdIncome;
- final long population;
-
- public ZipcodeRecord(String zipcode, Pair<Double, Double> coordinates,
- String city, String state, double medianHouseholdIncome, long population)
- {
- this.city = city;
- this.state = state;
- this.zipcode = zipcode;
- this.coordinates = coordinates;
- this.medianHouseholdIncome = medianHouseholdIncome;
- this.population = population;
- }
-
- public String getZipcode()
- {
- return zipcode;
- }
-
- public Pair<Double, Double> getCoordinates()
- {
- return coordinates;
- }
-
- public double getMedianHouseholdIncome()
- {
- return medianHouseholdIncome;
- }
-
- public long getPopulation()
- {
- return population;
- }
-
- public double distance(ZipcodeRecord other)
- {
- if(other.getZipcode().equals(zipcode))
- return 0.0;
-
- Pair<Double, Double> otherCoords = other.getCoordinates();
-
- double dist = Math.sin(Math.toRadians(coordinates.getLeft())) *
- Math.sin(Math.toRadians(otherCoords.getLeft())) +
- Math.cos(Math.toRadians(coordinates.getLeft())) *
- Math.cos(Math.toRadians(otherCoords.getLeft())) *
- Math.cos(Math.toRadians(coordinates.getRight() - otherCoords.getRight()));
- dist = Math.toDegrees(Math.acos(dist)) * 69.09;
-
- return dist;
- }
-
- public String getCity()
- {
- return city;
- }
-
- public String getState()
- {
- return state;
- }
-}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datareaders/NameReader.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datareaders/NameReader.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datareaders/NameReader.java
deleted file mode 100644
index 5a847ea..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datareaders/NameReader.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.datareaders;
-
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.util.Map;
-import java.util.Scanner;
-
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.Names;
-
-import com.google.common.collect.Maps;
-
-public class NameReader
-{
- InputStream path;
-
- public NameReader(InputStream path)
- {
- this.path = path;
- }
-
- public Names readData() throws FileNotFoundException
- {
- Scanner scanner = new Scanner(path);
-
- Map<String, Double> firstNames = Maps.newHashMap();
- Map<String, Double> lastNames = Maps.newHashMap();
-
- while(scanner.hasNextLine())
- {
- String line = scanner.nextLine();
- String[] cols = line.trim().split(",");
-
- String name = cols[0];
- double weight = Double.parseDouble(cols[5]);
-
- if(cols[4].equals("1"))
- firstNames.put(name, weight);
- if(cols[3].equals("1"))
- lastNames.put(name, weight);
- }
-
- scanner.close();
-
- return new Names(firstNames, lastNames);
-
- }
-}