package net.onrc.onos.core.topology;

import net.onrc.onos.api.batchoperation.BatchOperation;
import net.onrc.onos.api.batchoperation.BatchOperationEntry;

/**
 * A list of topology operations.
 */
public class TopologyBatchOperation extends
        BatchOperation<BatchOperationEntry<TopologyBatchOperation.Operator, TopologyEvent>> {

    /**
     * The topology operations' operators.
     */
    public enum Operator {
        /**
         * Adds a new topology event.
         */
        ADD,

        /**
         * Removes an existing topology event.
         */
        REMOVE,
    }

    /**
     * Appends an ADD-TopologyEvent operation.
     *
     * @param topologyEvent the Topology Event to be appended
     * @return the TopologyBatchOperation object
     */
    public TopologyBatchOperation appendAddOperation(
                                        TopologyEvent topologyEvent) {
        return (TopologyBatchOperation) addOperation(
                new BatchOperationEntry<Operator, TopologyEvent>(
                                        Operator.ADD, topologyEvent));
    }

    /**
     * Appends a REMOVE-TopologyEvent operation.
     *
     * @param topologyEvent the Topology Event to be appended
     * @return the TopologyBatchOperation object
     */
    public TopologyBatchOperation appendRemoveOperation(
                                        TopologyEvent topologyEvent) {
        return (TopologyBatchOperation) addOperation(
                new BatchOperationEntry<Operator, TopologyEvent>(
                                        Operator.REMOVE, topologyEvent));
    }
}

@@ -1600,11 +1600,399 @@
 );%0A    %7D
+%0A%0A    /**%0A     * Concatenates specified TopologyBatchOperation.%0A     *%0A     * @param ops TopologyBatchOperation to concatenate.%0A     * @return this%0A     */%0A    public TopologyBatchOperation concat(final TopologyBatchOperation ops) %7B%0A        for (BatchOperationEntry%3COperator, TopologyEvent%3E e : ops.getOperations()) %7B%0A            this.addOperation(e);%0A        %7D%0A        return this;%0A    %7D
 %0A%7D%0A

Add a method to concatenate 2 TopologyBatchOperations.