Class MemoryData

  • All Implemented Interfaces:
    Data
    Direct Known Subclasses:
    RewindableData

    public class MemoryData
    extends java.lang.Object
    implements Data
    An implementation of Data that stores the complete result in memory
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int currentRow  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addRow​(java.lang.Object[] row)
      Add a row of data
      void dump()  
      java.lang.Object get​(int index)
      get the data at a certain column
      java.lang.Object[] getRow​(int index)  
      boolean next()
      goto the next (or first) row
      void sort​(int[] sortBy, boolean[] ascending)
      sort the data set by the given columns each column is sorted seperate
      • Methods inherited from class java.lang.Object

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

      • currentRow

        protected int currentRow
    • Constructor Detail

      • MemoryData

        public MemoryData()
      • MemoryData

        public MemoryData​(Data data,
                          int numColumns)
                   throws java.sql.SQLException
        Throws:
        java.sql.SQLException
    • Method Detail

      • next

        public boolean next()
                     throws java.sql.SQLException
        goto the next (or first) row
        Specified by:
        next in interface Data
        Returns:
        true if row exits, false if not
        Throws:
        java.sql.SQLException
      • get

        public java.lang.Object get​(int index)
        get the data at a certain column
        Specified by:
        get in interface Data
        Parameters:
        index - the column to get
      • getRow

        public java.lang.Object[] getRow​(int index)
      • addRow

        public void addRow​(java.lang.Object[] row)
        Add a row of data
      • sort

        public void sort​(int[] sortBy,
                         boolean[] ascending)
                  throws java.sql.SQLException
        sort the data set by the given columns each column is sorted seperate
        Throws:
        java.sql.SQLException
      • dump

        public void dump()