You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by ra...@apache.org on 2015/09/29 17:59:50 UTC

incubator-apex-malhar git commit: - MLHR-1862 Delete commented out code and clean up warnings

Repository: incubator-apex-malhar
Updated Branches:
  refs/heads/devel-3 f9c7992e4 -> 9f1a1bb9d


 - MLHR-1862 Delete commented out code and clean up warnings


Project: http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/commit/9f1a1bb9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/tree/9f1a1bb9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/diff/9f1a1bb9

Branch: refs/heads/devel-3
Commit: 9f1a1bb9d32784e7d9db827fce8d9ed17ce19457
Parents: f9c7992
Author: Timothy Farkas <ti...@datatorrent.com>
Authored: Mon Sep 28 16:44:17 2015 -0700
Committer: Timothy Farkas <ti...@datatorrent.com>
Committed: Mon Sep 28 18:28:50 2015 -0700

----------------------------------------------------------------------
 .../demos/machinedata/DimensionGenerator.java   |  30 +----
 .../demos/machinedata/InputReceiver.java        | 128 +++++++++----------
 .../demos/machinedata/data/MachineKey.java      |  44 +++----
 .../operator/CalculatorOperator.java            |  18 ++-
 .../operator/MachineInfoAveragingOperator.java  |  13 +-
 ...chineInfoAveragingPrerequisitesOperator.java |   5 +-
 .../operator/MachineInfoAveragingUnifier.java   |   6 +-
 .../demos/machinedata/util/Combinatorics.java   |   8 +-
 8 files changed, 114 insertions(+), 138 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/9f1a1bb9/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/DimensionGenerator.java
----------------------------------------------------------------------
diff --git a/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/DimensionGenerator.java b/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/DimensionGenerator.java
index 03a72c0..027b8bdb 100644
--- a/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/DimensionGenerator.java
+++ b/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/DimensionGenerator.java
@@ -37,13 +37,10 @@ import org.slf4j.LoggerFactory;
 @SuppressWarnings("unused")
 public class DimensionGenerator extends BaseOperator
 {
-  private static final Logger logger = LoggerFactory.getLogger(DimensionGenerator.class);
-
-  public transient DefaultOutputPort<MachineInfo> outputInline = new DefaultOutputPort<MachineInfo>();
-  public transient DefaultOutputPort<MachineInfo> output = new DefaultOutputPort<MachineInfo>();
-  private static final Random randomGen = new Random();
+  public transient DefaultOutputPort<MachineInfo> outputInline = new DefaultOutputPort<>();
+  public transient DefaultOutputPort<MachineInfo> output = new DefaultOutputPort<>();
   private int threshold=90;
-  
+
   public final transient DefaultInputPort<MachineInfo> inputPort = new DefaultInputPort<MachineInfo>() {
 
     @Override
@@ -59,7 +56,7 @@ public class DimensionGenerator extends BaseOperator
   {
     super.setup(context);
   }
-  
+
   /**
    * This returns the threshold value set
    * @return
@@ -80,47 +77,34 @@ public class DimensionGenerator extends BaseOperator
 
   /**
    * This function takes in the tuple from upstream operator and generates tuples with different dimension combinations
-   * 
+   *
    * @param tuple
    */
   private void emitDimensions(MachineInfo tuple)
   {
-    Calendar calendar = Calendar.getInstance();
     MachineKey tupleKey = tuple.getMachineKey();
-    int random = 0; // this is added to make the data more random for different dimension combinations
 
     for (int i = 0; i < 64; i++) {
-      MachineKey machineKey = new MachineKey(tupleKey.getTimeKey(),tupleKey.getDay());    
+      MachineKey machineKey = new MachineKey(tupleKey.getTimeKey(),tupleKey.getDay());
       if ((i & 1) != 0) {
         machineKey.setCustomer(tupleKey.getCustomer());
-        //random += machineKey.getCustomer();
       }
       if ((i & 2) != 0) {
         machineKey.setProduct(tupleKey.getProduct());
-        //random += machineKey.getProduct();
       }
       if ((i & 4) != 0) {
         machineKey.setOs(tupleKey.getOs());
-        //random += machineKey.getOs();
       }
       if ((i & 8) != 0) {
         machineKey.setDeviceId(tupleKey.getDeviceId());
-        //random += machineKey.getDeviceId();
       }
       if ((i & 16) != 0) {
         machineKey.setSoftware1(tupleKey.getSoftware1());
-        //random += machineKey.getSoftware1();
       }
       if ((i & 32) != 0) {
         machineKey.setSoftware2(tupleKey.getSoftware2());
-        //random += machineKey.getSoftware2();
       }
-      /*
-      if (random > 0) {
-        randomGen.setSeed(System.currentTimeMillis());
-        random = randomGen.nextInt(random);
-      }
-      */
+
       int cpu = tuple.getCpu();
       int ram = tuple.getRam();
       int hdd = tuple.getHdd();

http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/9f1a1bb9/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/InputReceiver.java
----------------------------------------------------------------------
diff --git a/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/InputReceiver.java b/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/InputReceiver.java
index 083032f..7b033ec 100644
--- a/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/InputReceiver.java
+++ b/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/InputReceiver.java
@@ -41,7 +41,7 @@ public class InputReceiver extends BaseOperator implements InputOperator
 {
   private static final Logger logger = LoggerFactory.getLogger(InputReceiver.class);
 
-  public transient DefaultOutputPort<MachineInfo> outputInline = new DefaultOutputPort<MachineInfo>();
+  public transient DefaultOutputPort<MachineInfo> outputInline = new DefaultOutputPort<>();
   private final Random randomGen = new Random();
 
   private int customerMin = 1;
@@ -60,31 +60,27 @@ public class InputReceiver extends BaseOperator implements InputOperator
   private int deviceIdMin = 1;
   private int deviceIdMax = 50;
 
-  // private int tupleBlastSize = 50;
   private int tupleBlastSize = 1001;
-  private int operatorId;
-  private long windowId = 1;
-  private static DateFormat minuteDateFormat = new SimpleDateFormat("HHmm");
-  private static DateFormat dayDateFormat = new SimpleDateFormat("d");
+
+  private static final DateFormat minuteDateFormat = new SimpleDateFormat("HHmm");
+  private static final DateFormat dayDateFormat = new SimpleDateFormat("d");
 
   static {
     TimeZone tz = TimeZone.getTimeZone("GMT");
     minuteDateFormat.setTimeZone(tz);
     dayDateFormat.setTimeZone(tz);
-  
+
   }
   @Override
   public void setup(Context.OperatorContext context)
   {
     super.setup(context);
-    operatorId = context.getId();
   }
 
   @Override
   public void beginWindow(long windowId)
   {
     super.beginWindow(windowId);
-    this.windowId = windowId;
   }
 
   @Override
@@ -224,7 +220,7 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method returns the minimum value for customer
-   * 
+   *
    * @return
    */
   public int getCustomerMin()
@@ -234,9 +230,8 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method is used to set the minimum value for customer
-   * 
-   * @param customerMin
-   *          the minimum customer value
+   *
+   * @param customerMin the minimum customer value
    */
   public void setCustomerMin(int customerMin)
   {
@@ -245,7 +240,7 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method returns the max value for customer
-   * 
+   *
    * @return
    */
   public int getCustomerMax()
@@ -255,9 +250,8 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method is used to set the max value for customer
-   * 
-   * @param customerMax
-   *          the max customer value
+   *
+   * @param customerMax the max customer value
    */
   public void setCustomerMax(int customerMax)
   {
@@ -266,7 +260,7 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method returns the minimum value for product
-   * 
+   *
    * @return
    */
   public int getProductMin()
@@ -276,9 +270,8 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method is used to set the minimum value for product
-   * 
-   * @param productMin
-   *          the minimum product value
+   *
+   * @param productMin the minimum product value
    */
   public void setProductMin(int productMin)
   {
@@ -287,7 +280,7 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method returns the max value for product
-   * 
+   *
    * @return
    */
   public int getProductMax()
@@ -297,9 +290,8 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method is used to set the max value for product
-   * 
-   * @param productMax
-   *          the max product value
+   *
+   * @param productMax the max product value
    */
   public void setProductMax(int productMax)
   {
@@ -308,7 +300,7 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method returns the minimum value for OS
-   * 
+   *
    * @return
    */
   public int getOsMin()
@@ -318,9 +310,8 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method is used to set the minimum value for OS
-   * 
-   * @param osMin
-   *          the min OS value
+   *
+   * @param osMin the min OS value
    */
   public void setOsMin(int osMin)
   {
@@ -329,7 +320,7 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method returns the max value for OS
-   * 
+   *
    * @return
    */
   public int getOsMax()
@@ -339,9 +330,8 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method is used to set the max value for OS
-   * 
-   * @param osMax
-   *          the max OS value
+   *
+   * @param osMax the max OS value
    */
   public void setOsMax(int osMax)
   {
@@ -350,7 +340,7 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method returns the minimum value for software1
-   * 
+   *
    * @return
    */
   public int getSoftware1Min()
@@ -360,9 +350,8 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method is used to set the minimum value for software1
-   * 
-   * @param software1Min
-   *          the minimum software1 value
+   *
+   * @param software1Min the minimum software1 value
    */
   public void setSoftware1Min(int software1Min)
   {
@@ -371,7 +360,7 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method returns the max value for software1
-   * 
+   *
    * @return
    */
   public int getSoftware1Max()
@@ -381,9 +370,8 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method is used to set the max value for software1
-   * 
-   * @param software1Max
-   *          the max software1 value
+   *
+   * @param software1Max the max software1 value
    */
   public void setSoftware1Max(int software1Max)
   {
@@ -392,7 +380,7 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method returns the minimum value for software2
-   * 
+   *
    * @return
    */
   public int getSoftware2Min()
@@ -402,9 +390,8 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method is used to set the minimum value for software2
-   * 
-   * @param software2Min
-   *          the minimum software2 value
+   *
+   * @param software2Min the minimum software2 value
    */
   public void setSoftware2Min(int software2Min)
   {
@@ -413,7 +400,7 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method returns the max value for software2
-   * 
+   *
    * @return
    */
   public int getSoftware2Max()
@@ -423,9 +410,8 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method is used to set the max value for software2
-   * 
-   * @param software2Max
-   *          the max software2 value
+   *
+   * @param software2Max the max software2 value
    */
   public void setSoftware2Max(int software2Max)
   {
@@ -434,7 +420,7 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method returns the minimum value for software3
-   * 
+   *
    * @return
    */
   public int getSoftware3Min()
@@ -444,9 +430,8 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method is used to set the minimum value for software3
-   * 
-   * @param software3Min
-   *          the minimum software3 value
+   *
+   * @param software3Min the minimum software3 value
    */
   public void setSoftware3Min(int software3Min)
   {
@@ -455,7 +440,7 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method returns the max value for software3
-   * 
+   *
    * @return
    */
   public int getSoftware3Max()
@@ -465,9 +450,8 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method is used to set the max value for software3
-   * 
-   * @param software3Max
-   *          the max software3 value
+   *
+   * @param software3Max the max software3 value
    */
   public void setSoftware3Max(int software3Max)
   {
@@ -476,7 +460,7 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method returns the minimum value for deviceId
-   * 
+   *
    * @return
    */
   public int getDeviceIdMin()
@@ -486,9 +470,8 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method is used to set the minimum value for deviceId
-   * 
-   * @param deviceIdMin
-   *          the minimum deviceId value
+   *
+   * @param deviceIdMin the minimum deviceId value
    */
   public void setDeviceIdMin(int deviceIdMin)
   {
@@ -497,7 +480,7 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method returns the max value for deviceId
-   * 
+   *
    * @return
    */
   public int getDeviceIdMax()
@@ -507,12 +490,27 @@ public class InputReceiver extends BaseOperator implements InputOperator
 
   /**
    * This method is used to set the max value for deviceId
-   * 
-   * @param deviceIdMax
-   *          the max deviceId value
+   *
+   * @param deviceIdMax the max deviceId value
    */
   public void setDeviceIdMax(int deviceIdMax)
   {
     this.deviceIdMax = deviceIdMax;
   }
+
+  /**
+   * @return the tupleBlastSize
+   */
+  public int getTupleBlastSize()
+  {
+    return tupleBlastSize;
+  }
+
+  /**
+   * @param tupleBlastSize the tupleBlastSize to set
+   */
+  public void setTupleBlastSize(int tupleBlastSize)
+  {
+    this.tupleBlastSize = tupleBlastSize;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/9f1a1bb9/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/data/MachineKey.java
----------------------------------------------------------------------
diff --git a/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/data/MachineKey.java b/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/data/MachineKey.java
index 5debe77..9391d21 100644
--- a/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/data/MachineKey.java
+++ b/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/data/MachineKey.java
@@ -38,7 +38,7 @@ public class MachineKey
 
   /**
    * This constructor takes the format in which time has to be captured and the day when this instance is created
-   * 
+   *
    * @param timeKey the format in which time has to be captured
    * @param day the day when this instance is created
    */
@@ -58,8 +58,8 @@ public class MachineKey
   /**
    * This constructor takes format in which time has to be captured, the day when this instance is created, the customer
    * id, product Id on the device, OS version on the device, software1 version on the device, software2 version on the device,
-   * software3 version on the device, deviceId on the device,  
-   * 
+   * software3 version on the device, deviceId on the device,
+   *
    * @param timeKey the format in which time has to be captured
    * @param day the day when this instance is created
    * @param customer the customer Id
@@ -86,7 +86,7 @@ public class MachineKey
   /**
    * This method returns the format in which the time is captured. The time is the time when this instance of MachineKey
    * was generated. For e.g. HHmm to capture Hour and minute
-   * 
+   *
    * @return
    */
   public String getTimeKey()
@@ -97,7 +97,7 @@ public class MachineKey
   /**
    * This method sets the format in which the time is captured. The time is the time when this instance of MachineKey
    * was generated. For e.g. HHmm to capture Hour and minute
-   * 
+   *
    * @param timeKey
    *          the value of format
    */
@@ -108,7 +108,7 @@ public class MachineKey
 
   /**
    * This method returns the day of the month when this instance of MachineKey was generated
-   * 
+   *
    * @return
    */
   public String getDay()
@@ -118,7 +118,7 @@ public class MachineKey
 
   /**
    * This method sets the day of the month when this instance of MachineKey was generated
-   * 
+   *
    * @param day
    *          the day of the month
    */
@@ -129,7 +129,7 @@ public class MachineKey
 
   /**
    * This method returns the customer Id
-   * 
+   *
    * @return
    */
   public Integer getCustomer()
@@ -139,7 +139,7 @@ public class MachineKey
 
   /**
    * This method sets the customer Id
-   * 
+   *
    * @param customer
    *          the customer Id
    */
@@ -150,7 +150,7 @@ public class MachineKey
 
   /**
    * This method returns product on the device
-   * 
+   *
    * @return
    */
   public Integer getProduct()
@@ -160,7 +160,7 @@ public class MachineKey
 
   /**
    * This method sets the product on the device
-   * 
+   *
    * @param product
    *          the value of product
    */
@@ -171,7 +171,7 @@ public class MachineKey
 
   /**
    * This method returns the OS version on the device
-   * 
+   *
    * @return
    */
   public Integer getOs()
@@ -181,7 +181,7 @@ public class MachineKey
 
   /**
    * This method sets the OS version on the device
-   * 
+   *
    * @param os
    *          OS version
    */
@@ -192,7 +192,7 @@ public class MachineKey
 
   /**
    * This method returns the version of the software1 on the device
-   * 
+   *
    * @return
    */
   public Integer getSoftware1()
@@ -202,9 +202,8 @@ public class MachineKey
 
   /**
    * This method sets the version of the software1 on the device
-   * 
-   * @param software3
-   *          the version of the software1
+   *
+   * @param software1 the version of the software1
    */
   public void setSoftware1(Integer software1)
   {
@@ -213,7 +212,7 @@ public class MachineKey
 
   /**
    * This method returns the version of the software2 on the device
-   * 
+   *
    * @return
    */
   public Integer getSoftware2()
@@ -223,7 +222,7 @@ public class MachineKey
 
   /**
    * This method sets the version of the software2 on the device
-   * 
+   *
    * @param software2
    *          the version of the software2
    */
@@ -234,7 +233,7 @@ public class MachineKey
 
   /**
    * This method returns the version of the software3 on the device
-   * 
+   *
    * @return
    */
   public Integer getSoftware3()
@@ -244,7 +243,7 @@ public class MachineKey
 
   /**
    * This method sets the version of the software3 on the device
-   * 
+   *
    * @param software3
    *          the version of the software3
    */
@@ -348,6 +347,7 @@ public class MachineKey
 
   /**
    * This method returns the deviceId of the device
+   * @return The deviceId
    */
   public Integer getDeviceId()
   {
@@ -356,7 +356,7 @@ public class MachineKey
 
   /**
    * This method sets the deviceId of the device
-   * 
+   *
    * @param deviceId
    */
   public void setDeviceId(Integer deviceId)

http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/9f1a1bb9/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/CalculatorOperator.java
----------------------------------------------------------------------
diff --git a/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/CalculatorOperator.java b/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/CalculatorOperator.java
index 1fe4bac..b5b8e6c 100644
--- a/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/CalculatorOperator.java
+++ b/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/CalculatorOperator.java
@@ -49,7 +49,7 @@ import com.datatorrent.demos.machinedata.util.DataTable;
 public class CalculatorOperator extends BaseOperator
 {
 
-  private final DataTable<MachineKey, ResourceType, List<Integer>> data = new DataTable<MachineKey, ResourceType, List<Integer>>();
+  private final DataTable<MachineKey, ResourceType, List<Integer>> data = new DataTable<>();
 
   @Min(1)
   @Max(99)
@@ -62,8 +62,6 @@ public class CalculatorOperator extends BaseOperator
   private int sdThreshold = 70;
   private int maxThreshold = 99;
 
-  private transient DateFormat dateFormat = new SimpleDateFormat();
-
   public final transient DefaultInputPort<MachineInfo> dataPort = new DefaultInputPort<MachineInfo>()
   {
     @Override
@@ -82,13 +80,13 @@ public class CalculatorOperator extends BaseOperator
     }
   };
 
-  public final transient DefaultOutputPort<KeyValPair<MachineKey, Map<ResourceType, Double>>> percentileOutputPort = new DefaultOutputPort<KeyValPair<MachineKey, Map<ResourceType, Double>>>();
+  public final transient DefaultOutputPort<KeyValPair<MachineKey, Map<ResourceType, Double>>> percentileOutputPort = new DefaultOutputPort<>();
 
-  public final transient DefaultOutputPort<KeyValPair<MachineKey, Map<ResourceType, Double>>> sdOutputPort = new DefaultOutputPort<KeyValPair<MachineKey, Map<ResourceType, Double>>>();
+  public final transient DefaultOutputPort<KeyValPair<MachineKey, Map<ResourceType, Double>>> sdOutputPort = new DefaultOutputPort<>();
 
-  public final transient DefaultOutputPort<KeyValPair<MachineKey, Map<ResourceType, Integer>>> maxOutputPort = new DefaultOutputPort<KeyValPair<MachineKey, Map<ResourceType, Integer>>>();
+  public final transient DefaultOutputPort<KeyValPair<MachineKey, Map<ResourceType, Integer>>> maxOutputPort = new DefaultOutputPort<>();
 
-  public transient DefaultOutputPort<String> smtpAlert = new DefaultOutputPort<String>();
+  public transient DefaultOutputPort<String> smtpAlert = new DefaultOutputPort<>();
 
   private void addDataToCache(MachineInfo tuple)
   {
@@ -117,7 +115,7 @@ public class CalculatorOperator extends BaseOperator
         percentileData.put(ResourceType.CPU, getKthPercentile(data.get(machineKey, ResourceType.CPU)));
         percentileData.put(ResourceType.RAM, getKthPercentile(data.get(machineKey, ResourceType.RAM)));
         percentileData.put(ResourceType.HDD, getKthPercentile(data.get(machineKey, ResourceType.HDD)));
-        percentileOutputPort.emit(new KeyValPair<MachineKey, Map<ResourceType, Double>>(machineKey, percentileData));
+        percentileOutputPort.emit(new KeyValPair<>(machineKey, percentileData));
 
         for (ResourceType resourceType : percentileData.keySet()) {
           double percentileValue = percentileData.get(resourceType);
@@ -135,7 +133,7 @@ public class CalculatorOperator extends BaseOperator
         for (ResourceType resourceType : ResourceType.values()) {
           sdData.put(resourceType, getSD(data.get(machineKey, resourceType)));
         }
-        sdOutputPort.emit(new KeyValPair<MachineKey, Map<ResourceType, Double>>(machineKey, sdData));
+        sdOutputPort.emit(new KeyValPair<>(machineKey, sdData));
 
         for (ResourceType resourceType : sdData.keySet()) {
           double sdValue = sdData.get(resourceType);
@@ -153,7 +151,7 @@ public class CalculatorOperator extends BaseOperator
         maxData.put(ResourceType.RAM, Collections.max(data.get(machineKey, ResourceType.RAM)));
         maxData.put(ResourceType.HDD, Collections.max(data.get(machineKey, ResourceType.HDD)));
 
-        maxOutputPort.emit(new KeyValPair<MachineKey, Map<ResourceType, Integer>>(machineKey, maxData));
+        maxOutputPort.emit(new KeyValPair<>(machineKey, maxData));
 
         for (ResourceType resourceType : maxData.keySet()) {
           double sdValue = maxData.get(resourceType).doubleValue();

http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/9f1a1bb9/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/MachineInfoAveragingOperator.java
----------------------------------------------------------------------
diff --git a/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/MachineInfoAveragingOperator.java b/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/MachineInfoAveragingOperator.java
index 7835c34..65d1428 100644
--- a/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/MachineInfoAveragingOperator.java
+++ b/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/MachineInfoAveragingOperator.java
@@ -50,17 +50,14 @@ public class MachineInfoAveragingOperator extends BaseOperator
   public static final String HDD = "hdd";
   public static final String DAY = "day";
 
-  private transient Map<MachineKey, AverageData> dataMap = new HashMap<MachineKey, AverageData>();
+  private final transient Map<MachineKey, AverageData> dataMap = new HashMap<>();
 
-  public final transient DefaultOutputPort<KeyValPair<MachineKey, Map<String, String>>> outputPort = new DefaultOutputPort<KeyValPair<MachineKey, Map<String, String>>>();
+  public final transient DefaultOutputPort<KeyValPair<MachineKey, Map<String, String>>> outputPort = new DefaultOutputPort<>();
 
-  public transient DefaultOutputPort<String> smtpAlert = new DefaultOutputPort<String>();
+  public transient DefaultOutputPort<String> smtpAlert = new DefaultOutputPort<>();
 
   private int threshold = 95;
 
-  private boolean genAlert;
-  //private transient DateFormat dateFormat = new SimpleDateFormat();
-
   /**
    * Buffer all the tuples as is till end window gets called
    */
@@ -122,8 +119,8 @@ public class MachineInfoAveragingOperator extends BaseOperator
       average = averageResultMap.getRam() / count;
       averageResult.put(RAM, average + "");
       emitAlert(average, RAM, key);
-      averageResult.put(DAY, key.getDay().toString());
-      outputPort.emit(new KeyValPair<MachineKey, Map<String, String>>(key, averageResult));
+      averageResult.put(DAY, key.getDay());
+      outputPort.emit(new KeyValPair<>(key, averageResult));
     }
     dataMap.clear();
   }

http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/9f1a1bb9/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/MachineInfoAveragingPrerequisitesOperator.java
----------------------------------------------------------------------
diff --git a/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/MachineInfoAveragingPrerequisitesOperator.java b/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/MachineInfoAveragingPrerequisitesOperator.java
index 4ad6358..ce3079b 100644
--- a/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/MachineInfoAveragingPrerequisitesOperator.java
+++ b/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/MachineInfoAveragingPrerequisitesOperator.java
@@ -38,10 +38,11 @@ public class MachineInfoAveragingPrerequisitesOperator extends BaseOperator
 {
 
   // Aggregate sum of all values seen for a key.
-  private Map<MachineKey, AverageData> sums = new HashMap<MachineKey, AverageData>();
+  private Map<MachineKey, AverageData> sums = new HashMap<>();
 
   public final transient DefaultOutputPort<KeyHashValPair<MachineKey, AverageData>> outputPort = new DefaultOutputPort<KeyHashValPair<MachineKey, AverageData>>()
   {
+    @Override
     public Unifier<KeyHashValPair<MachineKey, AverageData>> getUnifier()
     {
       MachineInfoAveragingUnifier unifier = new MachineInfoAveragingUnifier();
@@ -78,7 +79,7 @@ public class MachineInfoAveragingPrerequisitesOperator extends BaseOperator
 
     for (Map.Entry<MachineKey, AverageData> entry : sums.entrySet()) {
       if (outputPort.isConnected()) {
-        outputPort.emit(new KeyHashValPair<MachineKey, AverageData>(entry.getKey(), entry.getValue()));
+        outputPort.emit(new KeyHashValPair<>(entry.getKey(), entry.getValue()));
       }
     }
     sums.clear();

http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/9f1a1bb9/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/MachineInfoAveragingUnifier.java
----------------------------------------------------------------------
diff --git a/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/MachineInfoAveragingUnifier.java b/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/MachineInfoAveragingUnifier.java
index 41226d7..78f6bfb 100644
--- a/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/MachineInfoAveragingUnifier.java
+++ b/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/operator/MachineInfoAveragingUnifier.java
@@ -35,8 +35,8 @@ import com.datatorrent.lib.util.KeyHashValPair;
 public class MachineInfoAveragingUnifier implements Unifier<KeyHashValPair<MachineKey, AverageData>>
 {
 
-  private Map<MachineKey, AverageData> sums = new HashMap<MachineKey, AverageData>();
-  public final transient DefaultOutputPort<KeyHashValPair<MachineKey, AverageData>> outputPort = new DefaultOutputPort<KeyHashValPair<MachineKey, AverageData>>();
+  private Map<MachineKey, AverageData> sums = new HashMap<>();
+  public final transient DefaultOutputPort<KeyHashValPair<MachineKey, AverageData>> outputPort = new DefaultOutputPort<>();
 
   @Override
   public void beginWindow(long arg0)
@@ -49,7 +49,7 @@ public class MachineInfoAveragingUnifier implements Unifier<KeyHashValPair<Machi
   public void endWindow()
   {
     for (Map.Entry<MachineKey, AverageData> entry : sums.entrySet()) {
-      outputPort.emit(new KeyHashValPair<MachineKey, AverageData>(entry.getKey(), entry.getValue()));
+      outputPort.emit(new KeyHashValPair<>(entry.getKey(), entry.getValue()));
     }
     sums.clear();
 

http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/9f1a1bb9/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/util/Combinatorics.java
----------------------------------------------------------------------
diff --git a/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/util/Combinatorics.java b/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/util/Combinatorics.java
index ad523f7..e06b8c5 100644
--- a/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/util/Combinatorics.java
+++ b/demos/machinedata/src/main/java/com/datatorrent/demos/machinedata/util/Combinatorics.java
@@ -40,7 +40,7 @@ public class Combinatorics<T> {
     public Combinatorics(T[] values) {
         this.values = values;
         this.size = -1;
-        this.result = new ArrayList<T>();
+        this.result = new ArrayList<>();
     }
 
     /**
@@ -52,7 +52,7 @@ public class Combinatorics<T> {
     public Combinatorics(T[] values, int size) {
         this.values = values;
         this.size = size;
-        this.result = new ArrayList<T>();
+        this.result = new ArrayList<>();
     }
 
     public Map<Integer, List<T>> generate() {
@@ -76,11 +76,9 @@ public class Combinatorics<T> {
         if (depth == tmp.length) {
             for (int j = 0; j < depth; j++) {
                 result.add(values[tmp[j]]);
-//                System.out.print(values[tmp[j]] + " ");
             }
             resultMap.put(++resultMapSize, result);
-//            System.out.println(resultMapSize);
-            result = new ArrayList<T>();
+            result = new ArrayList<>();
             return;
         }
         for (int i = start; i < values.length; i++) {