Update BatchOperation class to be more generic and extensible.

- addAddOperation() and addRemoveOperation() methods are removed
  from BatchOperation class, and now the class has just addOperation() method.

- Removed AddOperation and RemoveOperation classes,
  and defined IntentBatchOperation, FlowBatchOperation and MatchActionPhase classes
  as sub-classes of BatchOperation class, for Intent, IFlow and MatchAction objects
  respectively.

- These classes include definitions of add/remove operators and helper methods
  specific to Intent, IFlow and MatchAction objects.

- Removed BatchOperationTargetId class.

- Updated unit tests.

- This task is a part of ONOS-1692.

Change-Id: Iba2f737af1fef6a6555e0e0166836865ed070fa3
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 cb8ddd8..7ef8c45 100644
--- a/src/main/java/net/onrc/onos/api/batchoperation/BatchOperation.java
+++ b/src/main/java/net/onrc/onos/api/batchoperation/BatchOperation.java
@@ -1,18 +1,18 @@
 package net.onrc.onos.api.batchoperation;
 
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 
 /**
  * A list of BatchOperationEntry.
  *
- * @param <T> IBatchOperationTarget. This should be Intent, IFlow, or
- *        MatchAction.
+ * @param <T> the enum of operators <br>
+ *        This enum must be defined in each sub-classes.
+ *
  */
-public class BatchOperation<T extends IBatchOperationTarget> {
-    private List<BatchOperationEntry<T>> ops;
+public abstract class BatchOperation<T extends BatchOperationEntry<?, ?>> {
+    private List<T> ops;
 
     /**
      * Constructor.
@@ -38,40 +38,21 @@
     }
 
     /**
-     * Returns an iterator over the operations in this object.
-     *
-     * @return an iterator over the operations in this object
-     */
-    public Iterator<BatchOperationEntry<T>> iterator() {
-        return ops.iterator();
-    }
-
-    /**
      * Returns the operations in this object.
      *
      * @return the operations in this object
      */
-    public List<BatchOperationEntry<T>> getOperations() {
+    public List<T> getOperations() {
         return Collections.unmodifiableList(ops);
     }
 
     /**
-     * Adds an add-operation.
+     * Adds an operation.
      *
-     * @param target IBatchOperationTarget object to be added
-     * @return true if succeeded, false otherwise
+     * @param entry the operation to be added
+     * @return this object if succeeded, null otherwise
      */
-    public boolean addAddOperation(T 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
-     */
-    public boolean addRemoveOperation(BatchOperationTargetId id) {
-        return ops.add(new RemoveOperation<T>(id));
+    public BatchOperation<T> addOperation(T entry) {
+        return ops.add(entry) ? this : null;
     }
 }