Class JDBCSparseObjectMatrix

    • Field Detail

      • useExtendedSQL

        private boolean useExtendedSQL
      • connection

        private transient java.sql.Connection connection
      • getEntryStatement

        private transient java.sql.PreparedStatement getEntryStatement
      • insertEntryStatement

        private transient java.sql.PreparedStatement insertEntryStatement
      • deleteEntryStatement

        private transient java.sql.PreparedStatement deleteEntryStatement
      • selectAllStatement

        private transient java.sql.PreparedStatement selectAllStatement
      • truncateStatement

        private transient java.sql.PreparedStatement truncateStatement
      • url

        private final java.lang.String url
      • username

        private final java.lang.String username
      • password

        private java.lang.String password
      • tableName

        private final java.lang.String tableName
      • columnsForCoordinates

        private final java.lang.String[] columnsForCoordinates
      • columnForValue

        private final java.lang.String columnForValue
    • Constructor Detail

      • JDBCSparseObjectMatrix

        public JDBCSparseObjectMatrix​(long... size)
                               throws java.lang.ClassNotFoundException,
                                      java.io.IOException,
                                      java.sql.SQLException
        Throws:
        java.lang.ClassNotFoundException
        java.io.IOException
        java.sql.SQLException
      • JDBCSparseObjectMatrix

        public JDBCSparseObjectMatrix​(long[] size,
                                      java.lang.String url,
                                      java.lang.String username,
                                      java.lang.String password,
                                      java.lang.String tableName,
                                      java.lang.String columnForValue,
                                      java.lang.String... columnsForCoordinates)
                               throws java.lang.ClassNotFoundException,
                                      java.sql.SQLException
        Throws:
        java.lang.ClassNotFoundException
        java.sql.SQLException
      • JDBCSparseObjectMatrix

        public JDBCSparseObjectMatrix​(long[] size,
                                      java.sql.Connection connection,
                                      java.lang.String tableName,
                                      java.lang.String columnForValue,
                                      java.lang.String... columnsForCoordinates)
                               throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • JDBCSparseObjectMatrix

        public JDBCSparseObjectMatrix​(Matrix source)
                               throws java.lang.ClassNotFoundException,
                                      java.io.IOException,
                                      java.sql.SQLException
        Throws:
        java.lang.ClassNotFoundException
        java.io.IOException
        java.sql.SQLException
    • Method Detail

      • createColumnNames

        private static java.lang.String[] createColumnNames​(long... size)
      • createTableIfNotExists

        private void createTableIfNotExists()
                                     throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getSelectAllStatement

        private java.sql.PreparedStatement getSelectAllStatement()
                                                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getGetEntryStatement

        private java.sql.PreparedStatement getGetEntryStatement()
                                                         throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • clear

        public final void clear()
        Specified by:
        clear in interface Clearable
      • getTruncateStatement

        private java.sql.PreparedStatement getTruncateStatement()
                                                         throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getInsertEntryStatement

        private java.sql.PreparedStatement getInsertEntryStatement()
                                                            throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getDeleteEntryStatement

        private java.sql.PreparedStatement getDeleteEntryStatement()
                                                            throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getObject

        public java.lang.Object getObject​(long... coordinates)
        Specified by:
        getObject in interface GenericMatrixMultiD<java.lang.Object>
      • deleteObject

        private void deleteObject​(long... coordinates)
                           throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • getConnection

        public java.sql.Connection getConnection()
                                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getUrl

        public java.lang.String getUrl()
      • getUsername

        public java.lang.String getUsername()
      • getPassword

        public java.lang.String getPassword()
      • containsCoordinates

        public boolean containsCoordinates​(long... coordinates)
        Description copied from interface: CoordinateFunctions
        Determines if the given Coordinates are part of the Matrix. If the Matrix is dense, true is returned for all Coordinates smaller than the Matrix's size. For sparse Matrices, this function checks if the coordinates are actually stored in the matrix or not.
        Specified by:
        containsCoordinates in interface CoordinateFunctions
        Parameters:
        coordinates - The coordinates to check
        Returns:
        a boolean stating if the coordinates are part of the Matrix
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable
      • erase

        public void erase()
                   throws java.io.IOException
        Specified by:
        erase in interface Erasable
        Throws:
        java.io.IOException
      • availableCoordinates

        public java.lang.Iterable<long[]> availableCoordinates()
        Description copied from interface: CoordinateFunctions
        Returns an Iterator that only goes over the coordinates in the Matrix that are stored. For most Matrices, this is the same as allCoordinates(). For sparse Matrices, it iterates only over the entries in it.
        Specified by:
        availableCoordinates in interface CoordinateFunctions
        Returns:
        Iterable over the saved entries in a Matrix.