Class DefaultBatch

  • All Implemented Interfaces:
    Batch

    public class DefaultBatch
    extends Object
    implements Batch
    Author:
    Alexey Loubyansky
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultBatch()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(BatchedCommand cmd)
      Adds a command or an operation to the batch.
      void clear()
      Removes all the commands and the operations from the batch.
      protected void ensureRange​(int lineNumber)  
      Attachments getAttachments()  
      List<BatchedCommand> getCommands()
      Returns all the commands and operations in the batch as a list.
      void move​(int currentIndex, int newIndex)
      Move the command or operation corresponding to the currentIndex to the newIndex position, shifting the commands/operations in between the indexes.
      void remove​(int lineNumber)
      Removes command or operation corresponding to its index in the list.
      void set​(int index, BatchedCommand cmd)
      Replaces the command or operation at the specified index with the new one.
      int size()
      Returns the number of the commands and operations in the batch.
      org.jboss.dmr.ModelNode toRequest()
      Generates a composite operation request from all the commands and operations in the batch.
    • Constructor Detail

      • DefaultBatch

        public DefaultBatch()
    • Method Detail

      • getCommands

        public List<BatchedCommand> getCommands()
        Description copied from interface: Batch
        Returns all the commands and operations in the batch as a list.
        Specified by:
        getCommands in interface Batch
        Returns:
        list of commands and operations in the batch
      • add

        public void add​(BatchedCommand cmd)
        Description copied from interface: Batch
        Adds a command or an operation to the batch.
        Specified by:
        add in interface Batch
        Parameters:
        cmd - command or operation to add to the batch
      • clear

        public void clear()
        Description copied from interface: Batch
        Removes all the commands and the operations from the batch.
        Specified by:
        clear in interface Batch
      • remove

        public void remove​(int lineNumber)
        Description copied from interface: Batch
        Removes command or operation corresponding to its index in the list. The indexes start with 0.
        Specified by:
        remove in interface Batch
        Parameters:
        lineNumber - the index of the command or operation to be removed from the batch
      • set

        public void set​(int index,
                        BatchedCommand cmd)
        Description copied from interface: Batch
        Replaces the command or operation at the specified index with the new one. The indexes start with 0.
        Specified by:
        set in interface Batch
        Parameters:
        index - the position for the new command or operation.
        cmd - the new command or operation
      • ensureRange

        protected void ensureRange​(int lineNumber)
      • size

        public int size()
        Description copied from interface: Batch
        Returns the number of the commands and operations in the batch.
        Specified by:
        size in interface Batch
        Returns:
        the number of the commands and operations in the batch
      • move

        public void move​(int currentIndex,
                         int newIndex)
        Description copied from interface: Batch
        Move the command or operation corresponding to the currentIndex to the newIndex position, shifting the commands/operations in between the indexes. The indexes start with 0.
        Specified by:
        move in interface Batch
        Parameters:
        currentIndex - the index of the command or operation to move the new position
        newIndex - the new position for the command/operation
      • toRequest

        public org.jboss.dmr.ModelNode toRequest()
        Description copied from interface: Batch
        Generates a composite operation request from all the commands and operations in the batch.
        Specified by:
        toRequest in interface Batch
        Returns:
        operation request that includes all the commands and operations in the batch