Update onos.api.batchoperation package.

This task is a part of ONOS-1692.

- Removed UpdateOperation class and related methods.
- Updated AddOperation and RemoveOperation classes to use generic type parameter.
- Added unit tests.

Change-Id: Ifbc34f15dd06f430f4dc8cd658c7932d03cb0515
diff --git a/src/main/java/net/onrc/onos/api/batchoperation/AddOperation.java b/src/main/java/net/onrc/onos/api/batchoperation/AddOperation.java
index 7e8b97a..f8fb8d0 100644
--- a/src/main/java/net/onrc/onos/api/batchoperation/AddOperation.java
+++ b/src/main/java/net/onrc/onos/api/batchoperation/AddOperation.java
@@ -3,15 +3,16 @@
 /**
  * An add-operation entry of a batch operation.
  */
-public class AddOperation implements BatchOperationEntry {
-    private final IBatchOperationTarget target;
+public class AddOperation<T extends IBatchOperationTarget>
+        implements BatchOperationEntry<T> {
+    private final T target;
 
     /**
      * Creates a add-operation with specified target.
      *
-     * @param target The target object to be assigned to this add-operation.
+     * @param target the target object to be assigned to this add-operation
      */
-    public AddOperation(IBatchOperationTarget target) {
+    public AddOperation(T target) {
         this.target = target;
     }
 
@@ -23,9 +24,9 @@
     /**
      * Gets the target object which assigned to this add-operation.
      *
-     * @return The target object which assigned to this add-operation.
+     * @return the target object which assigned to this add-operation
      */
-    public IBatchOperationTarget getTarget() {
+    public T getTarget() {
         return target;
     }
 }
diff --git a/src/main/java/net/onrc/onos/api/batchoperation/BatchOperation.java b/src/main/java/net/onrc/onos/api/batchoperation/BatchOperation.java
index 9fc20c0..cb8ddd8 100644
--- a/src/main/java/net/onrc/onos/api/batchoperation/BatchOperation.java
+++ b/src/main/java/net/onrc/onos/api/batchoperation/BatchOperation.java
@@ -12,13 +12,13 @@
  *        MatchAction.
  */
 public class BatchOperation<T extends IBatchOperationTarget> {
-    private List<BatchOperationEntry> ops;
+    private List<BatchOperationEntry<T>> ops;
 
     /**
      * Constructor.
      */
     public BatchOperation() {
-        ops = new LinkedList<BatchOperationEntry>();
+        ops = new LinkedList<>();
     }
 
     /**
@@ -31,7 +31,7 @@
     /**
      * Returns the number of operations in this object.
      *
-     * @return the number of operations in this object.
+     * @return the number of operations in this object
      */
     public int size() {
         return ops.size();
@@ -40,50 +40,38 @@
     /**
      * Returns an iterator over the operations in this object.
      *
-     * @return an iterator over the operations in this object.
+     * @return an iterator over the operations in this object
      */
-    public Iterator<BatchOperationEntry> iterator() {
+    public Iterator<BatchOperationEntry<T>> iterator() {
         return ops.iterator();
     }
 
     /**
      * Returns the operations in this object.
      *
-     * @return the operations in this object.
+     * @return the operations in this object
      */
-    public List<BatchOperationEntry> getOperations() {
+    public List<BatchOperationEntry<T>> getOperations() {
         return Collections.unmodifiableList(ops);
     }
 
     /**
      * Adds an add-operation.
      *
-     * @param target IBatchOperationTarget object to be added.
-     * @return true if succeeded, false otherwise.
+     * @param target IBatchOperationTarget object to be added
+     * @return true if succeeded, false otherwise
      */
     public boolean addAddOperation(T target) {
-        return ops.add(new AddOperation(target));
+        return ops.add(new AddOperation<T>(target));
     }
 
     /**
      * Adds a remove-operation.
      *
-     * @param id ID of the target to be removed.
-     * @return true if succeeded, false otherwise.
+     * @param id ID of the target to be removed
+     * @return true if succeeded, false otherwise
      */
     public boolean addRemoveOperation(BatchOperationTargetId id) {
-        return ops.add(new RemoveOperation(id));
-    }
-
-    /**
-     * Adds an update-operation.
-     * <p>
-     * The existing entry having the same ID with the new target is overwritten.
-     *
-     * @param target The new target to be used for the update.
-     * @return true if succeeded, false otherwise.
-     */
-    public boolean addUpdateOperation(T target) {
-        return ops.add(new UpdateOperation(target));
+        return ops.add(new RemoveOperation<T>(id));
     }
 }
diff --git a/src/main/java/net/onrc/onos/api/batchoperation/BatchOperationEntry.java b/src/main/java/net/onrc/onos/api/batchoperation/BatchOperationEntry.java
index fce31d1..7274d5f 100644
--- a/src/main/java/net/onrc/onos/api/batchoperation/BatchOperationEntry.java
+++ b/src/main/java/net/onrc/onos/api/batchoperation/BatchOperationEntry.java
@@ -6,11 +6,11 @@
  * This is the interface to AddOperation, UpdateOperation and RemoveOperation
  * classes which are the entry maintained by BatchOperation.
  */
-public interface BatchOperationEntry {
+public interface BatchOperationEntry<T extends IBatchOperationTarget> {
     /**
      * Gets the BatchOperator of this operation.
      *
-     * @return The BatchOperator of this operation.
+     * @return the BatchOperator of this operation
      */
     public BatchOperator getOperator();
 }
diff --git a/src/main/java/net/onrc/onos/api/batchoperation/BatchOperationTargetId.java b/src/main/java/net/onrc/onos/api/batchoperation/BatchOperationTargetId.java
index dfa3da9..d2d0ad1 100644
--- a/src/main/java/net/onrc/onos/api/batchoperation/BatchOperationTargetId.java
+++ b/src/main/java/net/onrc/onos/api/batchoperation/BatchOperationTargetId.java
@@ -10,7 +10,7 @@
     /**
      * Returns a string representation of the target object's ID.
      *
-     * @return a string representation of the target object's ID.
+     * @return a string representation of the target object's ID
      */
     @Override
     public abstract String toString();
diff --git a/src/main/java/net/onrc/onos/api/batchoperation/BatchOperator.java b/src/main/java/net/onrc/onos/api/batchoperation/BatchOperator.java
index 00ab908..0b9a2ce 100644
--- a/src/main/java/net/onrc/onos/api/batchoperation/BatchOperator.java
+++ b/src/main/java/net/onrc/onos/api/batchoperation/BatchOperator.java
@@ -5,22 +5,17 @@
  */
 public enum BatchOperator {
     /**
-     * Adds new intent.
+     * Adds new target object.
      */
     ADD,
 
     /**
-     * Removes existing intent specified by intent ID.
+     * Removes existing object.
      */
     REMOVE,
 
     /**
-     * Overwrites existing intent using new intent.
-     */
-    UPDATE,
-
-    /**
-     * Unknown type.
+     * Unknown operator type.
      */
     UNKNOWN,
 }
diff --git a/src/main/java/net/onrc/onos/api/batchoperation/IBatchOperationTarget.java b/src/main/java/net/onrc/onos/api/batchoperation/IBatchOperationTarget.java
index 45e05ea..3b2d3d9 100644
--- a/src/main/java/net/onrc/onos/api/batchoperation/IBatchOperationTarget.java
+++ b/src/main/java/net/onrc/onos/api/batchoperation/IBatchOperationTarget.java
@@ -7,7 +7,7 @@
     /**
      * Gets ID of the object.
      *
-     * @return ID of the object.
+     * @return ID of the object
      */
     public BatchOperationTargetId getId();
 }
diff --git a/src/main/java/net/onrc/onos/api/batchoperation/RemoveOperation.java b/src/main/java/net/onrc/onos/api/batchoperation/RemoveOperation.java
index bafe926..52eec95 100644
--- a/src/main/java/net/onrc/onos/api/batchoperation/RemoveOperation.java
+++ b/src/main/java/net/onrc/onos/api/batchoperation/RemoveOperation.java
@@ -3,14 +3,14 @@
 /**
  * A remove-operation entry of a batch operation.
  */
-public class RemoveOperation implements BatchOperationEntry {
+public class RemoveOperation<T extends IBatchOperationTarget>
+        implements BatchOperationEntry<T> {
     private final BatchOperationTargetId targetId;
 
     /**
      * Creates a remove-operation with specified target.
      *
-     * @param id The target object ID to be assigned to this
-     *        remove-operation.
+     * @param id the target object ID to be assigned to this remove-operation
      */
     public RemoveOperation(BatchOperationTargetId id) {
         this.targetId = id;
@@ -24,7 +24,7 @@
     /**
      * Gets the target ID to be removed.
      *
-     * @return The target ID to be removed.
+     * @return the target ID to be removed
      */
     public BatchOperationTargetId getTargetId() {
         return targetId;
diff --git a/src/main/java/net/onrc/onos/api/batchoperation/UpdateOperation.java b/src/main/java/net/onrc/onos/api/batchoperation/UpdateOperation.java
deleted file mode 100644
index a2f368e..0000000
--- a/src/main/java/net/onrc/onos/api/batchoperation/UpdateOperation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package net.onrc.onos.api.batchoperation;
-
-/**
- * An update-operation entry of a batch operation.
- */
-public class UpdateOperation implements BatchOperationEntry {
-    private final IBatchOperationTarget target;
-
-    /**
-     * Creates an update-operation with specified targets.
-     *
-     * @param target The new target to be used for the update.
-     */
-    public UpdateOperation(IBatchOperationTarget target) {
-        this.target = target;
-    }
-
-    @Override
-    public BatchOperator getOperator() {
-        return BatchOperator.UPDATE;
-    }
-
-    /**
-     * Gets the new target object to be used for the update.
-     *
-     * @return The new target object to be used for the update.
-     */
-    public IBatchOperationTarget getTarget() {
-        return target;
-    }
-
-}