From f3727f362b03871ff93f67803ca32936a6579c07 Mon Sep 17 00:00:00 2001 From: ayman abdelghany Date: Sat, 13 Feb 2016 06:03:58 +0200 Subject: [PATCH] Adding private constructor to util classes (containing static methods only) --- .../dataalgorithms/bonus/anagram/spark/SparkAnagram.java | 5 ++++- .../bonus/cartesian/spark/TestCartesian.java | 5 ++++- .../bonus/charcount/spark/basic/CharCount.java | 5 ++++- .../spark/inmapper/CharCountInMapperCombiner.java | 3 +++ .../localaggregation/CharCountLocalAggregation.java | 3 +++ .../spark/SparkFriendRecommendation.java | 5 ++++- .../spark/SubmitSparkJobToYARNFromJavaCode.java | 3 +++ .../bonus/logquery/spark/SparkLogQuery.java | 5 ++++- .../bonus/outlierdetection/spark/OutlierDetection.java | 7 +++++-- .../bonus/perkeyaverage/spark/PerKeyAverage.java | 5 ++++- .../spark/SparkRankProductUsingCombineByKey.java | 3 +++ .../spark/SparkRankProductUsingGroupByKey.java | 5 ++++- .../org/dataalgorithms/bonus/rankproduct/spark/Util.java | 5 ++++- .../sortedwordcount/spark/SparkSortedWordCount.java | 3 +++ .../bonus/wordcount/spark/SparkWordCount.java | 5 ++++- .../dataalgorithms/chap01/spark/SparkSecondarySort.java | 5 ++++- .../chap02/mapreduce/SecondarySortDriver.java | 3 +++ .../chap03/mapreduce/SequenceFileWriterForTopN.java | 3 +++ src/main/java/org/dataalgorithms/chap03/spark/Top10.java | 5 ++++- .../org/dataalgorithms/chap03/spark/Top10NonUnique.java | 5 ++++- .../dataalgorithms/chap04/mapreduce/LeftJoinDriver.java | 7 +++++-- .../chap04/mapreduce/LocationCountDriver.java | 5 ++++- .../dataalgorithms/chap04/spark/SparkLeftOuterJoin.java | 5 ++++- .../memorysort/SortInMemory_MovingAverageDriver.java | 7 +++++-- .../chap06/pojo/TestSimpleMovingAverage.java | 3 +++ .../secondarysort/SortByMRF_MovingAverageDriver.java | 7 +++++-- .../chap07/spark/FindAssociationRules.java | 7 +++++-- .../dataalgorithms/chap08/spark/FindCommonFriends.java | 5 ++++- .../chap09/spark/SparkFriendRecommendation.java | 5 ++++- .../chap10/spark/MovieRecommendations.java | 5 ++++- .../chap10/spark/MovieRecommendationsWithJoin.java | 5 ++++- .../memorysort/SortInMemoryProjectionDriver.java | 9 ++++++--- .../secondarysort/SecondarySortProjectionDriver.java | 7 +++++-- src/main/java/org/dataalgorithms/chap13/spark/kNN.java | 7 +++++-- .../org/dataalgorithms/chap16/spark/CountTriangles.java | 5 ++++- .../org/dataalgorithms/chap17/mapreduce/KmerUtil.java | 5 ++++- src/main/java/org/dataalgorithms/chap17/spark/Kmer.java | 7 +++++-- .../java/org/dataalgorithms/chap22/spark/SparkTtest.java | 3 +++ .../java/org/dataalgorithms/chap23/spark/Pearson.java | 5 ++++- .../org/dataalgorithms/chap23/spark/TestPearson.java | 7 +++++-- .../org/dataalgorithms/chap23/spark/TestSpearman.java | 5 ++++- .../chap24/spark/SparkDNABaseCountFASTA.java | 5 ++++- .../chap24/spark/SparkDNABaseCountFASTQ.java | 5 ++++- .../chap26/spark/SparkGeneAggregationByAverage.java | 7 +++++-- .../org/dataalgorithms/chap28/mapreduce/MeanDriver.java | 7 +++++-- .../dataalgorithms/chap28/spark/SparkMeanMonodized.java | 5 ++++- .../SmallFilesConsolidator.java | 3 +++ .../client/SubmitSparkJobToClusterFromJavaCode.java | 3 +++ .../client/SubmitSparkJobToYARNFromJavaCode.java | 5 ++++- 49 files changed, 198 insertions(+), 51 deletions(-) diff --git a/src/main/java/org/dataalgorithms/bonus/anagram/spark/SparkAnagram.java b/src/main/java/org/dataalgorithms/bonus/anagram/spark/SparkAnagram.java index 0b5034a4..81dbcc92 100755 --- a/src/main/java/org/dataalgorithms/bonus/anagram/spark/SparkAnagram.java +++ b/src/main/java/org/dataalgorithms/bonus/anagram/spark/SparkAnagram.java @@ -22,7 +22,10 @@ */ public class SparkAnagram { - public static void main(String[] args) throws Exception { + private SparkAnagram() { + } + + public static void main(String[] args) throws Exception { // STEP-1: handle input parameters if (args.length != 3) { diff --git a/src/main/java/org/dataalgorithms/bonus/cartesian/spark/TestCartesian.java b/src/main/java/org/dataalgorithms/bonus/cartesian/spark/TestCartesian.java index a94300c4..19d8a586 100644 --- a/src/main/java/org/dataalgorithms/bonus/cartesian/spark/TestCartesian.java +++ b/src/main/java/org/dataalgorithms/bonus/cartesian/spark/TestCartesian.java @@ -15,7 +15,10 @@ */ public class TestCartesian { - static JavaSparkContext createJavaSparkContext() throws Exception { + private TestCartesian() { + } + + static JavaSparkContext createJavaSparkContext() throws Exception { SparkConf conf = new SparkConf(); conf.set("spark.serializer", "org.apache.spark.serializer.KryoSerializer"); //JavaSparkContext ctx = new JavaSparkContext("yarn-cluster", "mytestprogram", conf); // yarn-specific diff --git a/src/main/java/org/dataalgorithms/bonus/charcount/spark/basic/CharCount.java b/src/main/java/org/dataalgorithms/bonus/charcount/spark/basic/CharCount.java index 06129f0a..689907c0 100644 --- a/src/main/java/org/dataalgorithms/bonus/charcount/spark/basic/CharCount.java +++ b/src/main/java/org/dataalgorithms/bonus/charcount/spark/basic/CharCount.java @@ -20,7 +20,10 @@ * */ public class CharCount { - + + private CharCount() { + } + static void printArguments(String[] args) { if ((args == null) || (args.length == 0)) { System.out.println("no arguments passed..."); diff --git a/src/main/java/org/dataalgorithms/bonus/charcount/spark/inmapper/CharCountInMapperCombiner.java b/src/main/java/org/dataalgorithms/bonus/charcount/spark/inmapper/CharCountInMapperCombiner.java index bc1e7b10..41ecbe00 100644 --- a/src/main/java/org/dataalgorithms/bonus/charcount/spark/inmapper/CharCountInMapperCombiner.java +++ b/src/main/java/org/dataalgorithms/bonus/charcount/spark/inmapper/CharCountInMapperCombiner.java @@ -21,6 +21,9 @@ */ public class CharCountInMapperCombiner { + private CharCountInMapperCombiner() { + } + public static void main(String[] args) throws Exception { if (args.length != 2) { System.err.println("Usage: SparkCharCount "); diff --git a/src/main/java/org/dataalgorithms/bonus/charcount/spark/localaggregation/CharCountLocalAggregation.java b/src/main/java/org/dataalgorithms/bonus/charcount/spark/localaggregation/CharCountLocalAggregation.java index 75f7b7d2..b28c3ace 100644 --- a/src/main/java/org/dataalgorithms/bonus/charcount/spark/localaggregation/CharCountLocalAggregation.java +++ b/src/main/java/org/dataalgorithms/bonus/charcount/spark/localaggregation/CharCountLocalAggregation.java @@ -23,6 +23,9 @@ */ public class CharCountLocalAggregation { + private CharCountLocalAggregation() { + } + public static void main(String[] args) throws Exception { if (args.length != 2) { System.err.println("Usage: SparkCharCount "); diff --git a/src/main/java/org/dataalgorithms/bonus/friendrecommendation/spark/SparkFriendRecommendation.java b/src/main/java/org/dataalgorithms/bonus/friendrecommendation/spark/SparkFriendRecommendation.java index a4003235..559f1ef0 100644 --- a/src/main/java/org/dataalgorithms/bonus/friendrecommendation/spark/SparkFriendRecommendation.java +++ b/src/main/java/org/dataalgorithms/bonus/friendrecommendation/spark/SparkFriendRecommendation.java @@ -36,7 +36,10 @@ */ public class SparkFriendRecommendation { - /** + private SparkFriendRecommendation() { + } + + /** * Build a pair of Longs(x,y) where x <= y */ private static Tuple2 buildSortedPairOfLongs(long a, long b) { diff --git a/src/main/java/org/dataalgorithms/bonus/friendrecommendation/spark/SubmitSparkJobToYARNFromJavaCode.java b/src/main/java/org/dataalgorithms/bonus/friendrecommendation/spark/SubmitSparkJobToYARNFromJavaCode.java index 9bb05dd7..816ee2a7 100644 --- a/src/main/java/org/dataalgorithms/bonus/friendrecommendation/spark/SubmitSparkJobToYARNFromJavaCode.java +++ b/src/main/java/org/dataalgorithms/bonus/friendrecommendation/spark/SubmitSparkJobToYARNFromJavaCode.java @@ -12,6 +12,9 @@ */ public class SubmitSparkJobToYARNFromJavaCode { + private SubmitSparkJobToYARNFromJavaCode() { + } + public static void main(String[] arguments) throws Exception { // prepare arguments to be passed to diff --git a/src/main/java/org/dataalgorithms/bonus/logquery/spark/SparkLogQuery.java b/src/main/java/org/dataalgorithms/bonus/logquery/spark/SparkLogQuery.java index d165cf25..4699f7fc 100644 --- a/src/main/java/org/dataalgorithms/bonus/logquery/spark/SparkLogQuery.java +++ b/src/main/java/org/dataalgorithms/bonus/logquery/spark/SparkLogQuery.java @@ -36,7 +36,10 @@ public class SparkLogQuery { "10.20.30.42,u400,700,query2" ); - // tokens = [] + private SparkLogQuery() { + } + + // tokens = [] public static Tuple3 createKey(String[] tokens) { String userID = tokens[1]; if (userID.equals("-")) { diff --git a/src/main/java/org/dataalgorithms/bonus/outlierdetection/spark/OutlierDetection.java b/src/main/java/org/dataalgorithms/bonus/outlierdetection/spark/OutlierDetection.java index f502ae79..e99a69f0 100644 --- a/src/main/java/org/dataalgorithms/bonus/outlierdetection/spark/OutlierDetection.java +++ b/src/main/java/org/dataalgorithms/bonus/outlierdetection/spark/OutlierDetection.java @@ -46,8 +46,11 @@ public class OutlierDetection { private static final Logger THE_LOGGER = Logger.getLogger(OutlierDetection.class); - - + + private OutlierDetection() { + } + + static class TupleComparatorAscending implements Comparator>, Serializable { final static TupleComparatorAscending INSTANCE = new TupleComparatorAscending(); diff --git a/src/main/java/org/dataalgorithms/bonus/perkeyaverage/spark/PerKeyAverage.java b/src/main/java/org/dataalgorithms/bonus/perkeyaverage/spark/PerKeyAverage.java index 6cae00e5..83f7db90 100644 --- a/src/main/java/org/dataalgorithms/bonus/perkeyaverage/spark/PerKeyAverage.java +++ b/src/main/java/org/dataalgorithms/bonus/perkeyaverage/spark/PerKeyAverage.java @@ -21,7 +21,10 @@ */ public final class PerKeyAverage { - + + private PerKeyAverage() { + } + static final List> getSampleInput() { List> input = new ArrayList>(); // key: "zebra" diff --git a/src/main/java/org/dataalgorithms/bonus/rankproduct/spark/SparkRankProductUsingCombineByKey.java b/src/main/java/org/dataalgorithms/bonus/rankproduct/spark/SparkRankProductUsingCombineByKey.java index 417402d8..5f4e9ab3 100644 --- a/src/main/java/org/dataalgorithms/bonus/rankproduct/spark/SparkRankProductUsingCombineByKey.java +++ b/src/main/java/org/dataalgorithms/bonus/rankproduct/spark/SparkRankProductUsingCombineByKey.java @@ -38,6 +38,9 @@ public class SparkRankProductUsingCombineByKey { private static final Logger THE_LOGGER = Logger.getLogger(SparkRankProductUsingCombineByKey.class); + private SparkRankProductUsingCombineByKey() { + } + /** * AverageCount is used by combineByKey() to hold * the total values and their count. diff --git a/src/main/java/org/dataalgorithms/bonus/rankproduct/spark/SparkRankProductUsingGroupByKey.java b/src/main/java/org/dataalgorithms/bonus/rankproduct/spark/SparkRankProductUsingGroupByKey.java index 16f7f5fa..8993725a 100644 --- a/src/main/java/org/dataalgorithms/bonus/rankproduct/spark/SparkRankProductUsingGroupByKey.java +++ b/src/main/java/org/dataalgorithms/bonus/rankproduct/spark/SparkRankProductUsingGroupByKey.java @@ -33,7 +33,10 @@ public class SparkRankProductUsingGroupByKey { private static final Logger THE_LOGGER = Logger.getLogger(SparkRankProductUsingGroupByKey.class); - + + private SparkRankProductUsingGroupByKey() { + } + static void debug(String[] args) { for (int i=0; i < args.length; i++){ THE_LOGGER.info("***debug*** args["+i+"]="+args[i]); diff --git a/src/main/java/org/dataalgorithms/bonus/rankproduct/spark/Util.java b/src/main/java/org/dataalgorithms/bonus/rankproduct/spark/Util.java index 688ab7db..6f9164a6 100644 --- a/src/main/java/org/dataalgorithms/bonus/rankproduct/spark/Util.java +++ b/src/main/java/org/dataalgorithms/bonus/rankproduct/spark/Util.java @@ -14,7 +14,10 @@ public class Util { private static final Logger THE_LOGGER = Logger.getLogger(Util.class); - + + private Util() { + } + static JavaSparkContext createJavaSparkContext(boolean useYARN) { JavaSparkContext context; if (useYARN) { diff --git a/src/main/java/org/dataalgorithms/bonus/sortedwordcount/spark/SparkSortedWordCount.java b/src/main/java/org/dataalgorithms/bonus/sortedwordcount/spark/SparkSortedWordCount.java index ef5eb716..6b2a3f6b 100644 --- a/src/main/java/org/dataalgorithms/bonus/sortedwordcount/spark/SparkSortedWordCount.java +++ b/src/main/java/org/dataalgorithms/bonus/sortedwordcount/spark/SparkSortedWordCount.java @@ -24,6 +24,9 @@ */ public class SparkSortedWordCount { + private SparkSortedWordCount() { + } + public static void main(String[] args) throws Exception { if (args.length != 4) { System.err.println("Usage: SparkSortedWordCount "); diff --git a/src/main/java/org/dataalgorithms/bonus/wordcount/spark/SparkWordCount.java b/src/main/java/org/dataalgorithms/bonus/wordcount/spark/SparkWordCount.java index 44ef1d54..6319716e 100644 --- a/src/main/java/org/dataalgorithms/bonus/wordcount/spark/SparkWordCount.java +++ b/src/main/java/org/dataalgorithms/bonus/wordcount/spark/SparkWordCount.java @@ -22,7 +22,10 @@ */ public class SparkWordCount { - public static void main(String[] args) throws Exception { + private SparkWordCount() { + } + + public static void main(String[] args) throws Exception { if (args.length != 3) { System.err.println("Usage: SparkWordCount "); System.exit(1); diff --git a/src/main/java/org/dataalgorithms/chap01/spark/SparkSecondarySort.java b/src/main/java/org/dataalgorithms/chap01/spark/SparkSecondarySort.java index 8ee8769d..a430cf7a 100755 --- a/src/main/java/org/dataalgorithms/chap01/spark/SparkSecondarySort.java +++ b/src/main/java/org/dataalgorithms/chap01/spark/SparkSecondarySort.java @@ -50,7 +50,10 @@ * */ public class SparkSecondarySort { - public static void main(String[] args) throws Exception { + private SparkSecondarySort() { + } + + public static void main(String[] args) throws Exception { // STEP-1: read input parameters and validate them if (args.length < 1) { diff --git a/src/main/java/org/dataalgorithms/chap02/mapreduce/SecondarySortDriver.java b/src/main/java/org/dataalgorithms/chap02/mapreduce/SecondarySortDriver.java index 437a2b79..01746055 100755 --- a/src/main/java/org/dataalgorithms/chap02/mapreduce/SecondarySortDriver.java +++ b/src/main/java/org/dataalgorithms/chap02/mapreduce/SecondarySortDriver.java @@ -20,6 +20,9 @@ */ public class SecondarySortDriver { + private SecondarySortDriver() { + } + public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); diff --git a/src/main/java/org/dataalgorithms/chap03/mapreduce/SequenceFileWriterForTopN.java b/src/main/java/org/dataalgorithms/chap03/mapreduce/SequenceFileWriterForTopN.java index c7b3fc0a..96f179a2 100644 --- a/src/main/java/org/dataalgorithms/chap03/mapreduce/SequenceFileWriterForTopN.java +++ b/src/main/java/org/dataalgorithms/chap03/mapreduce/SequenceFileWriterForTopN.java @@ -22,6 +22,9 @@ */ public class SequenceFileWriterForTopN { + private SequenceFileWriterForTopN() { + } + public static void main(String[] args) throws IOException { if (args.length != 2) { throw new IOException("usage: java org.dataalgorithms.chap03.mapreduce.SequenceFileWriterForTopN "); diff --git a/src/main/java/org/dataalgorithms/chap03/spark/Top10.java b/src/main/java/org/dataalgorithms/chap03/spark/Top10.java index fa0b45ed..780f66bd 100755 --- a/src/main/java/org/dataalgorithms/chap03/spark/Top10.java +++ b/src/main/java/org/dataalgorithms/chap03/spark/Top10.java @@ -46,7 +46,10 @@ */ public class Top10 { - public static void main(String[] args) throws Exception { + private Top10() { + } + + public static void main(String[] args) throws Exception { // STEP-1: handle input parameters if (args.length < 1) { diff --git a/src/main/java/org/dataalgorithms/chap03/spark/Top10NonUnique.java b/src/main/java/org/dataalgorithms/chap03/spark/Top10NonUnique.java index 813778d7..afd012c9 100755 --- a/src/main/java/org/dataalgorithms/chap03/spark/Top10NonUnique.java +++ b/src/main/java/org/dataalgorithms/chap03/spark/Top10NonUnique.java @@ -52,7 +52,10 @@ */ public class Top10NonUnique { - public static void main(String[] args) throws Exception { + private Top10NonUnique() { + } + + public static void main(String[] args) throws Exception { // STEP-1: handle input parameters if (args.length < 2) { System.err.println("Usage: Top10 "); diff --git a/src/main/java/org/dataalgorithms/chap04/mapreduce/LeftJoinDriver.java b/src/main/java/org/dataalgorithms/chap04/mapreduce/LeftJoinDriver.java index 82e5e66c..2df52c7b 100755 --- a/src/main/java/org/dataalgorithms/chap04/mapreduce/LeftJoinDriver.java +++ b/src/main/java/org/dataalgorithms/chap04/mapreduce/LeftJoinDriver.java @@ -22,8 +22,11 @@ * */ public class LeftJoinDriver { - - public static void main( String[] args ) throws Exception { + + private LeftJoinDriver() { + } + + public static void main(String[] args ) throws Exception { Path transactions = new Path(args[0]); // input Path users = new Path(args[1]); // input Path output = new Path(args[2]); // output diff --git a/src/main/java/org/dataalgorithms/chap04/mapreduce/LocationCountDriver.java b/src/main/java/org/dataalgorithms/chap04/mapreduce/LocationCountDriver.java index 7f42c436..ae18c721 100755 --- a/src/main/java/org/dataalgorithms/chap04/mapreduce/LocationCountDriver.java +++ b/src/main/java/org/dataalgorithms/chap04/mapreduce/LocationCountDriver.java @@ -21,7 +21,10 @@ */ public class LocationCountDriver { - public static void main( String[] args ) throws Exception { + private LocationCountDriver() { + } + + public static void main(String[] args ) throws Exception { Path input = new Path(args[0]); Path output = new Path(args[1]); Configuration conf = new Configuration(); diff --git a/src/main/java/org/dataalgorithms/chap04/spark/SparkLeftOuterJoin.java b/src/main/java/org/dataalgorithms/chap04/spark/SparkLeftOuterJoin.java index acb9b165..7d61b776 100755 --- a/src/main/java/org/dataalgorithms/chap04/spark/SparkLeftOuterJoin.java +++ b/src/main/java/org/dataalgorithms/chap04/spark/SparkLeftOuterJoin.java @@ -32,7 +32,10 @@ */ public class SparkLeftOuterJoin { - public static void main(String[] args) throws Exception { + private SparkLeftOuterJoin() { + } + + public static void main(String[] args) throws Exception { if (args.length < 2) { System.err.println("Usage: SparkLeftOuterJoin "); System.exit(1); diff --git a/src/main/java/org/dataalgorithms/chap06/memorysort/SortInMemory_MovingAverageDriver.java b/src/main/java/org/dataalgorithms/chap06/memorysort/SortInMemory_MovingAverageDriver.java index 21cb3ced..a5e8b3e5 100755 --- a/src/main/java/org/dataalgorithms/chap06/memorysort/SortInMemory_MovingAverageDriver.java +++ b/src/main/java/org/dataalgorithms/chap06/memorysort/SortInMemory_MovingAverageDriver.java @@ -22,8 +22,11 @@ * */ public class SortInMemory_MovingAverageDriver { - - public static void main(String[] args) throws Exception { + + private SortInMemory_MovingAverageDriver() { + } + + public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs(); if (otherArgs.length != 3) { diff --git a/src/main/java/org/dataalgorithms/chap06/pojo/TestSimpleMovingAverage.java b/src/main/java/org/dataalgorithms/chap06/pojo/TestSimpleMovingAverage.java index f3bf1518..160eee18 100644 --- a/src/main/java/org/dataalgorithms/chap06/pojo/TestSimpleMovingAverage.java +++ b/src/main/java/org/dataalgorithms/chap06/pojo/TestSimpleMovingAverage.java @@ -13,6 +13,9 @@ public class TestSimpleMovingAverage { private static final Logger THE_LOGGER = Logger.getLogger(TestSimpleMovingAverage.class); + private TestSimpleMovingAverage() { + } + public static void main(String[] args) { // The invocation of the BasicConfigurator.configure method // creates a rather simple log4j setup. This method is hardwired diff --git a/src/main/java/org/dataalgorithms/chap06/secondarysort/SortByMRF_MovingAverageDriver.java b/src/main/java/org/dataalgorithms/chap06/secondarysort/SortByMRF_MovingAverageDriver.java index c7b53db1..1608049c 100755 --- a/src/main/java/org/dataalgorithms/chap06/secondarysort/SortByMRF_MovingAverageDriver.java +++ b/src/main/java/org/dataalgorithms/chap06/secondarysort/SortByMRF_MovingAverageDriver.java @@ -23,8 +23,11 @@ * */ public class SortByMRF_MovingAverageDriver { - - public static void main(String[] args) throws Exception { + + private SortByMRF_MovingAverageDriver() { + } + + public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); JobConf jobconf = new JobConf(conf, SortByMRF_MovingAverageDriver.class); jobconf.setJobName("SortByMRF_MovingAverageDriver"); diff --git a/src/main/java/org/dataalgorithms/chap07/spark/FindAssociationRules.java b/src/main/java/org/dataalgorithms/chap07/spark/FindAssociationRules.java index eaec04c9..d539766b 100755 --- a/src/main/java/org/dataalgorithms/chap07/spark/FindAssociationRules.java +++ b/src/main/java/org/dataalgorithms/chap07/spark/FindAssociationRules.java @@ -24,8 +24,11 @@ * */ public class FindAssociationRules { - - static List toList(String transaction) { + + private FindAssociationRules() { + } + + static List toList(String transaction) { String[] items = transaction.trim().split(","); List list = new ArrayList(); for (String item : items) { diff --git a/src/main/java/org/dataalgorithms/chap08/spark/FindCommonFriends.java b/src/main/java/org/dataalgorithms/chap08/spark/FindCommonFriends.java index 51921235..9f5d8ced 100755 --- a/src/main/java/org/dataalgorithms/chap08/spark/FindCommonFriends.java +++ b/src/main/java/org/dataalgorithms/chap08/spark/FindCommonFriends.java @@ -28,7 +28,10 @@ */ public class FindCommonFriends { - public static void main(String[] args) throws Exception { + private FindCommonFriends() { + } + + public static void main(String[] args) throws Exception { if (args.length < 1) { // Spark master URL: diff --git a/src/main/java/org/dataalgorithms/chap09/spark/SparkFriendRecommendation.java b/src/main/java/org/dataalgorithms/chap09/spark/SparkFriendRecommendation.java index beb67bd1..6da679ff 100755 --- a/src/main/java/org/dataalgorithms/chap09/spark/SparkFriendRecommendation.java +++ b/src/main/java/org/dataalgorithms/chap09/spark/SparkFriendRecommendation.java @@ -27,7 +27,10 @@ */ public class SparkFriendRecommendation { - public static void main(String[] args) throws Exception { + private SparkFriendRecommendation() { + } + + public static void main(String[] args) throws Exception { if (args.length < 1) { System.err.println("Usage: SparkFriendRecommendation "); System.exit(1); diff --git a/src/main/java/org/dataalgorithms/chap10/spark/MovieRecommendations.java b/src/main/java/org/dataalgorithms/chap10/spark/MovieRecommendations.java index 79175da4..684503b8 100755 --- a/src/main/java/org/dataalgorithms/chap10/spark/MovieRecommendations.java +++ b/src/main/java/org/dataalgorithms/chap10/spark/MovieRecommendations.java @@ -31,7 +31,10 @@ * */ public class MovieRecommendations { - public static void main(String[] args) throws Exception { + private MovieRecommendations() { + } + + public static void main(String[] args) throws Exception { //STEP-1: handle input parameters if (args.length < 1) { diff --git a/src/main/java/org/dataalgorithms/chap10/spark/MovieRecommendationsWithJoin.java b/src/main/java/org/dataalgorithms/chap10/spark/MovieRecommendationsWithJoin.java index 25d09e4e..6c22b266 100755 --- a/src/main/java/org/dataalgorithms/chap10/spark/MovieRecommendationsWithJoin.java +++ b/src/main/java/org/dataalgorithms/chap10/spark/MovieRecommendationsWithJoin.java @@ -31,7 +31,10 @@ * */ public class MovieRecommendationsWithJoin { - public static void main(String[] args) throws Exception { + private MovieRecommendationsWithJoin() { + } + + public static void main(String[] args) throws Exception { //STEP-1: handle input parameters if (args.length < 1) { diff --git a/src/main/java/org/dataalgorithms/chap11/projection/memorysort/SortInMemoryProjectionDriver.java b/src/main/java/org/dataalgorithms/chap11/projection/memorysort/SortInMemoryProjectionDriver.java index 5ff8a476..beb74c5c 100755 --- a/src/main/java/org/dataalgorithms/chap11/projection/memorysort/SortInMemoryProjectionDriver.java +++ b/src/main/java/org/dataalgorithms/chap11/projection/memorysort/SortInMemoryProjectionDriver.java @@ -25,9 +25,12 @@ */ public class SortInMemoryProjectionDriver { private static final Logger theLogger = - Logger.getLogger(SortInMemoryProjectionDriver.class); - - public static void main(String[] args) throws Exception { + Logger.getLogger(SortInMemoryProjectionDriver.class); + + private SortInMemoryProjectionDriver() { + } + + public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); Configuration conf = new Configuration(); diff --git a/src/main/java/org/dataalgorithms/chap11/projection/secondarysort/SecondarySortProjectionDriver.java b/src/main/java/org/dataalgorithms/chap11/projection/secondarysort/SecondarySortProjectionDriver.java index fbae1b62..a17bcbbd 100755 --- a/src/main/java/org/dataalgorithms/chap11/projection/secondarysort/SecondarySortProjectionDriver.java +++ b/src/main/java/org/dataalgorithms/chap11/projection/secondarysort/SecondarySortProjectionDriver.java @@ -27,8 +27,11 @@ public class SecondarySortProjectionDriver { private static final Logger theLogger = - Logger.getLogger(SecondarySortProjectionDriver.class); - + Logger.getLogger(SecondarySortProjectionDriver.class); + + private SecondarySortProjectionDriver() { + } + public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); Configuration conf = new Configuration(); diff --git a/src/main/java/org/dataalgorithms/chap13/spark/kNN.java b/src/main/java/org/dataalgorithms/chap13/spark/kNN.java index 5b5ab49d..327635aa 100755 --- a/src/main/java/org/dataalgorithms/chap13/spark/kNN.java +++ b/src/main/java/org/dataalgorithms/chap13/spark/kNN.java @@ -26,8 +26,11 @@ * */ public class kNN { - - /** + + private kNN() { + } + + /** * @param str a comma (or semicolon) separated list of double values * str is like "1.1,2.2,3.3" or "1.1;2.2;3.3" * diff --git a/src/main/java/org/dataalgorithms/chap16/spark/CountTriangles.java b/src/main/java/org/dataalgorithms/chap16/spark/CountTriangles.java index aadbef54..7f988f43 100755 --- a/src/main/java/org/dataalgorithms/chap16/spark/CountTriangles.java +++ b/src/main/java/org/dataalgorithms/chap16/spark/CountTriangles.java @@ -22,7 +22,10 @@ * */ public class CountTriangles { - public static void main(String[] args) throws Exception { + private CountTriangles() { + } + + public static void main(String[] args) throws Exception { if (args.length < 1) { System.err.println("Usage: CountTriangles "); System.exit(1); diff --git a/src/main/java/org/dataalgorithms/chap17/mapreduce/KmerUtil.java b/src/main/java/org/dataalgorithms/chap17/mapreduce/KmerUtil.java index 30c8778a..b0e05570 100644 --- a/src/main/java/org/dataalgorithms/chap17/mapreduce/KmerUtil.java +++ b/src/main/java/org/dataalgorithms/chap17/mapreduce/KmerUtil.java @@ -7,7 +7,10 @@ * */ public class KmerUtil { - + + private KmerUtil() { + } + public static String getKmer(String str, int start, int k) { if (start+k > str.length()) { return null; diff --git a/src/main/java/org/dataalgorithms/chap17/spark/Kmer.java b/src/main/java/org/dataalgorithms/chap17/spark/Kmer.java index 0f814859..8c4a8cfa 100755 --- a/src/main/java/org/dataalgorithms/chap17/spark/Kmer.java +++ b/src/main/java/org/dataalgorithms/chap17/spark/Kmer.java @@ -27,8 +27,11 @@ * */ public class Kmer { - - public static void main(String[] args) throws Exception { + + private Kmer() { + } + + public static void main(String[] args) throws Exception { // STEP-1: handle input parameters if (args.length < 3) { System.err.println("Usage: Kmer "); diff --git a/src/main/java/org/dataalgorithms/chap22/spark/SparkTtest.java b/src/main/java/org/dataalgorithms/chap22/spark/SparkTtest.java index 37f259c7..2eb4e4b5 100755 --- a/src/main/java/org/dataalgorithms/chap22/spark/SparkTtest.java +++ b/src/main/java/org/dataalgorithms/chap22/spark/SparkTtest.java @@ -30,6 +30,9 @@ */ public class SparkTtest { + private SparkTtest() { + } + static Map createTimeTable(String filename) throws Exception { Map map = new HashMap(); BufferedReader in = null; diff --git a/src/main/java/org/dataalgorithms/chap23/spark/Pearson.java b/src/main/java/org/dataalgorithms/chap23/spark/Pearson.java index aa678735..ac74ab65 100644 --- a/src/main/java/org/dataalgorithms/chap23/spark/Pearson.java +++ b/src/main/java/org/dataalgorithms/chap23/spark/Pearson.java @@ -16,7 +16,10 @@ public class Pearson { final static PearsonsCorrelation PC = new PearsonsCorrelation(); - + + private Pearson() { + } + public static double getCorrelation(List X, List Y) { double[] xArray = toDoubleArray(X); double[] yArray = toDoubleArray(Y); diff --git a/src/main/java/org/dataalgorithms/chap23/spark/TestPearson.java b/src/main/java/org/dataalgorithms/chap23/spark/TestPearson.java index 030566e3..900e092f 100644 --- a/src/main/java/org/dataalgorithms/chap23/spark/TestPearson.java +++ b/src/main/java/org/dataalgorithms/chap23/spark/TestPearson.java @@ -12,8 +12,11 @@ * */ public class TestPearson { - - public static void main(String[] args) { + + private TestPearson() { + } + + public static void main(String[] args) { test0(args); test1(args); test2(args); diff --git a/src/main/java/org/dataalgorithms/chap23/spark/TestSpearman.java b/src/main/java/org/dataalgorithms/chap23/spark/TestSpearman.java index c012af47..1792d8c5 100644 --- a/src/main/java/org/dataalgorithms/chap23/spark/TestSpearman.java +++ b/src/main/java/org/dataalgorithms/chap23/spark/TestSpearman.java @@ -10,7 +10,10 @@ * */ public class TestSpearman { - + + private TestSpearman() { + } + public static void main(String[] args) { test0(args); test1(args); diff --git a/src/main/java/org/dataalgorithms/chap24/spark/SparkDNABaseCountFASTA.java b/src/main/java/org/dataalgorithms/chap24/spark/SparkDNABaseCountFASTA.java index 9602cd88..9c282343 100644 --- a/src/main/java/org/dataalgorithms/chap24/spark/SparkDNABaseCountFASTA.java +++ b/src/main/java/org/dataalgorithms/chap24/spark/SparkDNABaseCountFASTA.java @@ -22,7 +22,10 @@ */ public class SparkDNABaseCountFASTA { - public static void main(String[] args) throws Exception { + private SparkDNABaseCountFASTA() { + } + + public static void main(String[] args) throws Exception { // STEP-1: handle input parameters if (args.length != 1) { System.err.println("Usage: SparkDNABaseCountFASTA "); diff --git a/src/main/java/org/dataalgorithms/chap24/spark/SparkDNABaseCountFASTQ.java b/src/main/java/org/dataalgorithms/chap24/spark/SparkDNABaseCountFASTQ.java index b270304b..a95e12e3 100644 --- a/src/main/java/org/dataalgorithms/chap24/spark/SparkDNABaseCountFASTQ.java +++ b/src/main/java/org/dataalgorithms/chap24/spark/SparkDNABaseCountFASTQ.java @@ -32,7 +32,10 @@ */ public class SparkDNABaseCountFASTQ { - public static void main(String[] args) throws Exception { + private SparkDNABaseCountFASTQ() { + } + + public static void main(String[] args) throws Exception { // STEP-1: handle input parameters if (args.length != 1) { System.err.println("Usage: SparkDNABaseCountFASTQ "); diff --git a/src/main/java/org/dataalgorithms/chap26/spark/SparkGeneAggregationByAverage.java b/src/main/java/org/dataalgorithms/chap26/spark/SparkGeneAggregationByAverage.java index 72542fd8..586c580f 100755 --- a/src/main/java/org/dataalgorithms/chap26/spark/SparkGeneAggregationByAverage.java +++ b/src/main/java/org/dataalgorithms/chap26/spark/SparkGeneAggregationByAverage.java @@ -28,8 +28,11 @@ public class SparkGeneAggregationByAverage { static final Tuple2 Tuple2Null = new Tuple2("n", "n"); - - /** + + private SparkGeneAggregationByAverage() { + } + + /** * Convert all bioset files into a List * * @param biosets is a filename, which holds all bioset files as HDFS entries diff --git a/src/main/java/org/dataalgorithms/chap28/mapreduce/MeanDriver.java b/src/main/java/org/dataalgorithms/chap28/mapreduce/MeanDriver.java index 15b267fa..a36a7207 100644 --- a/src/main/java/org/dataalgorithms/chap28/mapreduce/MeanDriver.java +++ b/src/main/java/org/dataalgorithms/chap28/mapreduce/MeanDriver.java @@ -28,8 +28,11 @@ * */ public class MeanDriver { - - public static void main(String[] args) throws Exception { + + private MeanDriver() { + } + + public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs(); if (otherArgs.length != 2) { diff --git a/src/main/java/org/dataalgorithms/chap28/spark/SparkMeanMonodized.java b/src/main/java/org/dataalgorithms/chap28/spark/SparkMeanMonodized.java index 1733c37b..fb041134 100644 --- a/src/main/java/org/dataalgorithms/chap28/spark/SparkMeanMonodized.java +++ b/src/main/java/org/dataalgorithms/chap28/spark/SparkMeanMonodized.java @@ -38,7 +38,10 @@ */ public class SparkMeanMonodized { - public static void main(String[] args) throws Exception { + private SparkMeanMonodized() { + } + + public static void main(String[] args) throws Exception { // STEP-1: handle input parameters if (args.length != 1) { System.err.println("Usage: SparkMeanMonodized "); diff --git a/src/main/java/org/dataalgorithms/chap29/combinesmallfilesbybuckets/SmallFilesConsolidator.java b/src/main/java/org/dataalgorithms/chap29/combinesmallfilesbybuckets/SmallFilesConsolidator.java index d76db48c..af9ae544 100755 --- a/src/main/java/org/dataalgorithms/chap29/combinesmallfilesbybuckets/SmallFilesConsolidator.java +++ b/src/main/java/org/dataalgorithms/chap29/combinesmallfilesbybuckets/SmallFilesConsolidator.java @@ -25,6 +25,9 @@ public class SmallFilesConsolidator { // this directory is configurable private static String MERGED_HDFS_ROOT_DIR = "/tmp/"; + private SmallFilesConsolidator() { + } + public static int getNumberOfBuckets(int totalFiles, int numberOfMapSlotsAvailable, int maxFilesPerBucket) { diff --git a/src/main/java/org/dataalgorithms/client/SubmitSparkJobToClusterFromJavaCode.java b/src/main/java/org/dataalgorithms/client/SubmitSparkJobToClusterFromJavaCode.java index ace4d068..31b6a572 100644 --- a/src/main/java/org/dataalgorithms/client/SubmitSparkJobToClusterFromJavaCode.java +++ b/src/main/java/org/dataalgorithms/client/SubmitSparkJobToClusterFromJavaCode.java @@ -20,6 +20,9 @@ public class SubmitSparkJobToClusterFromJavaCode { static final Logger THE_LOGGER = Logger.getLogger(SubmitSparkJobToClusterFromJavaCode.class); + private SubmitSparkJobToClusterFromJavaCode() { + } + public static void main(String[] arguments) throws Exception { long startTime = System.currentTimeMillis(); test(arguments); // ... the code being measured ... diff --git a/src/main/java/org/dataalgorithms/client/SubmitSparkJobToYARNFromJavaCode.java b/src/main/java/org/dataalgorithms/client/SubmitSparkJobToYARNFromJavaCode.java index 7faaefb9..28794f38 100644 --- a/src/main/java/org/dataalgorithms/client/SubmitSparkJobToYARNFromJavaCode.java +++ b/src/main/java/org/dataalgorithms/client/SubmitSparkJobToYARNFromJavaCode.java @@ -66,7 +66,10 @@ public class SubmitSparkJobToYARNFromJavaCode { "log4j-1.2.17.jar", "spring-context-3.0.7.RELEASE.jar" ); - + + private SubmitSparkJobToYARNFromJavaCode() { + } + private static String buildJars(String prefixJarDir) { StringBuilder builder = new StringBuilder(); int counter = 0;