Class IndirectionTableBatch

  • All Implemented Interfaces:
    Table

    public class IndirectionTableBatch
    extends java.lang.Object
    implements Table
    A class representing all changes to be made to an SQL indirection table.
    Author:
    Matthew Wakeling
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        IndirectionTableBatch​(java.lang.String leftColName, java.lang.String rightColName)
      Constructor for this class.
      protected IndirectionTableBatch​(java.lang.String leftColName, java.lang.String rightColName, java.util.Set<Row> toInsert)
      Constructor for dodgy temp table deleting stuff
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int addRow​(int left, int right)
      Adds a row to the batch.
      void clear()
      Clears the batch.
      int deleteRow​(int left, int right)
      Deletes a row from the batch.
      java.lang.String getLeftColName()
      Returns the left column name.
      java.lang.String getRightColName()
      Returns the right column name.
      java.util.Set<Row> getRowsToDelete()
      Returns the Set of rows to delete.
      java.util.Set<Row> getRowsToInsert()
      Returns the Set of rows to insert.
      int getSize()
      Returns the current amount of data, in bytes, held in this object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IndirectionTableBatch

        public IndirectionTableBatch​(java.lang.String leftColName,
                                     java.lang.String rightColName)
        Constructor for this class. Generates a batch with no data to write.
        Parameters:
        leftColName - the left column name
        rightColName - the right column name
      • IndirectionTableBatch

        protected IndirectionTableBatch​(java.lang.String leftColName,
                                        java.lang.String rightColName,
                                        java.util.Set<Row> toInsert)
        Constructor for dodgy temp table deleting stuff
        Parameters:
        leftColName - the left column name
        rightColName - the right column name
        toInsert - the Set of Rows to insert
    • Method Detail

      • addRow

        public int addRow​(int left,
                          int right)
        Adds a row to the batch. Whatever the previous state of the database and batch, the table will end up with one row matching the arguments.
        Parameters:
        left - the left int value
        right - the right int value
        Returns:
        the number of bytes by which the batch should be deemed to have expanded
      • deleteRow

        public int deleteRow​(int left,
                             int right)
        Deletes a row from the batch. Whatever the previous state of the database and batch, the table will end up with no rows that match the arguments.
        Parameters:
        left - the left int value
        right - the right int value
        Returns:
        the number of bytes by which the batch should be deemed to have expanded
      • getLeftColName

        public java.lang.String getLeftColName()
        Returns the left column name.
        Returns:
        leftColName
      • getRightColName

        public java.lang.String getRightColName()
        Returns the right column name.
        Returns:
        rightColName
      • getRowsToDelete

        public java.util.Set<Row> getRowsToDelete()
        Returns the Set of rows to delete.
        Returns:
        rowsToDelete
      • getRowsToInsert

        public java.util.Set<Row> getRowsToInsert()
        Returns the Set of rows to insert.
        Returns:
        rowsToInsert
      • clear

        public void clear()
        Clears the batch.
        Specified by:
        clear in interface Table
      • getSize

        public int getSize()
        Returns the current amount of data, in bytes, held in this object.
        Specified by:
        getSize in interface Table
        Returns:
        an int