⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datatablerow.java

📁 一个用java写的地震分析软件(无源码)
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
*/
    public int getNextSeq(Connection conn) {
  if (NullValueDb.isEmpty(sequenceName)) return -1;
  if (conn == null) {
      System.err.println(tableName + " DataTableRow getNextSeq: JDBC connection input argument null;" +
    " Application must first instantiate class;" +
    " see JDBConn(String url, String driverName, String user, String passwd)");
      return -1;
  }
  return SeqIds.getNextSeq(conn, sequenceName);
    }

/** Returns boolean true if the field at the specified column position is nullable in the database table.
*/
    public boolean isNullable(int index) throws IndexOutOfBoundsException {
  if (index < 0 || index > fields.size())
      throw new IndexOutOfBoundsException(tableName +
     " DataTableRow isNullable(int index) field index out of bounds:" + index);
  return fieldNulls[index];
    }

/** Returns boolean true if the named column field is nullable in the database table.
*/
    public boolean isNullable(String name) throws NoSuchFieldException {
  int index = findFieldIndex(name);
  if (index < 0)
    throw new NoSuchFieldException(tableName + " DataTableRow isNullable(String name) unknown field name:" + name);
  return isNullable(index);
    }

// Methods that implement a state control for a DataTableRow
/** Enable/Disable this DataTableRow object as updated or ready for processing.
* Returns a handle to this object instance.
*/
    public DataTableRow setUpdate(boolean value) {
        this.valueUpdate = value;
  return this;
    }

/** Returns update status of this object instance.
*/
    public boolean isUpdate() {
  return valueUpdate;
    }

/** Enable/Disable this DataTableRow object as flagged null.
* Returns a handle to this object instance.
*/
    public DataTableRow setNull(boolean value) {
        this.valueNull = value;
  return this;
    }

/** Returns null status of this object instance.
*/
    public boolean isNull() {
        return valueNull;
    }

/** Enable/Disable this DataTableRow as mutabile.
* Returns a handle to this object instance.
*/
    public DataTableRow setMutable(boolean value) {
        this.valueMutable = value;
  return this;
    }

/** Returns the mutability status of this object instance; is it editable or not.
*/
    public boolean isMutable() {
        return valueMutable;
    }

/** Sets the processing state of this DataTableRow object.
* Returns a handle to this object instance.
* Throws IndexOutOfBounds exception if input argument does not match know value range.
* @see DataTableRowStates
*/
    public DataTableRow setProcessing(int value) {
  if (value < 0 || value > MAX_PROCESSING_STATES)
    throw new IndexOutOfBoundsException(tableName + " DataTableRow setProcessing argument value not in range.");
        else this.processingStatus = value;
  return this;
    }

/** Get the processing state of this DataTableRow, must be one of the constants defined in DataTableRowStates interface.
* @see DataTableRowStates
*/
    public int getProcessing() {
        return processingStatus;
    }

/** Enable/disable the update state of the data value of every column field.
* Returns a handle to this object instance.
*/
    public DataTableRow setUpdateAllValues(boolean value) {
  for (int index = 0; index < fields.size(); index++) {
      DataState ds = (DataState) fields.get(index);
      if (ds != null) ds.setUpdate(value);
  }
  return this;
    }

/** Enable/disable the update state of every key column field.
* Returns a handle to this object instance.
* Note - keyColumnObject.isUpdate() must return true for a key column value to be included in the WHERE condition of a database
* modification SQL statement.
* Invoking setUpdateAllKeyValues(false) results in getWhereKeyString() returning null, thus results in a no-op for a
* insertXXX(), updateXXX() or deleteXXX methods.
* @see #getWhereKeyString()
*/
    public DataTableRow setUpdateAllKeyValues(boolean value) {
  for (int index = 0; index < keyIndexLength; index++) {
      DataState ds = (DataState) fields.get(keyColumnIndex[index]);
      if (ds != null) ds.setUpdate(value);
  }
  return this;
    }

/** Enable/disable the null state for the data value of every column field.
* Returns a handle to this object instance.
*/
    public DataTableRow setNullAllValues(boolean value) {
  for (int index = 0; index < fields.size(); index++) {
      DataState ds = (DataState) fields.get(index);
      if (ds != null) ds.setNull(value);
  }
  return this;
    }

/** Enable/disable the editable state of the data value of every column field.
* Returns a handle to this object instance.
*/
    public DataTableRow setMutableAllValues(boolean value) {
  for (int index = 0; index < fields.size(); index++) {
      DataState ds = (DataState) fields.get(index);
      if (ds != null) ds.setMutable(value);
  }
  return this;
    }

/** Returns the table column index of the specified table column name.
*/
    public int findFieldIndex(String name) {
  for (int index = 0; index < fields.size(); index++) {
      if (fieldNames[index].equals(name.trim().toUpperCase())) return index;
  }
  return -1;
    }

/** Returns data value null status by specified column field index.
*/
    public boolean isNullValue(int index) throws IndexOutOfBoundsException {
  if (index < 0 || index > fields.size())
                throw new IndexOutOfBoundsException(tableName + " DataTableRow isNullValue(int) index out of bounds:" + index);
  DataState ds = (DataState) fields.get(index);
  if (ds != null) return ds.isNull();
  else return true;
    }

/** Returns data value null status by specified column name.
*/
    public boolean isNullValue(String name) throws NoSuchFieldException {
  int index = findFieldIndex(name);
  if (index < 0) throw new NoSuchFieldException(tableName + " DataTableRow isNullValue(name) unknown field name:" + name);
  return isNullValue(index);
    }

/** Returns data value update status by specified column field index.
*/
    public boolean isUpdateValue(int index) throws IndexOutOfBoundsException {
  if (index < 0 || index > fields.size())
    throw new IndexOutOfBoundsException(tableName +
       " DataTableRow isUpdateValue(int) field index out of bounds:" + index);
  DataState ds = (DataState) fields.get(index);
  if (ds != null) return ds.isUpdate();
  else return false;
    }

/** Returns data value update status by specified column name.
*/
    public boolean isUpdateValue(String name) throws NoSuchFieldException {
  int index = findFieldIndex(name);
  if (index < 0) throw new NoSuchFieldException(tableName + " DataTableRow isUpdateValue(name) unknown field name:" + name);
  return isUpdateValue(index);
    }

/** Returns data value mutability status by specified column field index.
*/
    public boolean isMutableValue(int index) throws IndexOutOfBoundsException {
  if (index < 0 || index > fields.size())
    throw new IndexOutOfBoundsException(tableName +
       " DataTableRow isMutableValue(int) field index out of bounds:" + index);
  DataState ds = (DataState) fields.get(index);
  if (ds != null) return ds.isMutable();
  else return true;
    }

/** Returns data value mutability status by specified column name.
*/
    public boolean isMutableValue(String name) throws NoSuchFieldException {
  int index = findFieldIndex(name);
  if (index < 0) throw new NoSuchFieldException(tableName + " DataTableRow isMutableValue(name) unknown field name:" + name);
  return isMutableValue(index);
    }

/** Set data value mutability state by specified column name.
*/
    public DataTableRow setMutableValue(String name, boolean value) throws NoSuchFieldException {
  int index = findFieldIndex(name);
  if (index < 0) throw new NoSuchFieldException(tableName + " DataTableRow setMutableValue(name) unknown field name:" + name);
  return setMutableValue(index, value);
    }

/** Set data value mutability state by specified column field index.
*/
    public DataTableRow setMutableValue(int index, boolean value) throws IndexOutOfBoundsException {
  if (index < 0 || index > fields.size())
    throw new IndexOutOfBoundsException(tableName +
       " DataTableRow setMutableValue(int) field index out of bounds:" + index);
  DataState ds = (DataState) fields.get(index);
  if (ds != null) ds.setMutable(value);
  return this;
    }

/** Set data value update state by specified column name.
*/
    public DataTableRow setUpdateValue(String name, boolean value) throws NoSuchFieldException {
  int index = findFieldIndex(name);
  if (index < 0) throw new NoSuchFieldException(tableName + " DataTableRow setUpdateValue(name) unknown field name:" + name);
  return setUpdateValue(index, value);
    }

/** Set data value update state by specified column field index.
*/
    public DataTableRow setUpdateValue(int index, boolean value) throws IndexOutOfBoundsException {
  if (index < 0 || index > fields.size())
    throw new IndexOutOfBoundsException(tableName +
       " DataTableRow setUpdateValue(int) field index out of bounds:" + index);
  DataState ds = (DataState) fields.get(index);
  if (ds != null) ds.setUpdate(value);
  return this;
    }

/** Set data value null state by specified column name.
*/
    public DataTableRow setNullValue(String name, boolean value) throws NoSuchFieldException {
  int index = findFieldIndex(name);
  if (index < 0) throw new NoSuchFieldException(tableName + " DataTableRow setNullValue(name) unknown field name:" + name);
  return setNullValue(index, value);
    }

/** Set data value null state by specified column field index.
*/
    public DataTableRow setNullValue(int index, boolean value) throws IndexOutOfBoundsException {
  if (index < 0 || index > fields.size())
    throw new IndexOutOfBoundsException(tableName +
       " DataTableRow setNullValue(int) field index out of bounds:" + index);
  if (value == true && ! fieldNulls[index]) return this;
  DataState ds = (DataState) fields.get(index);
  if (ds != null) ds.setNull(value);
  return this;
    }

/** Returns the DataObject for the specified table column name from the data collection.
*/
    public DataObject getDataObject(String name) throws NoSuchFieldException {
        int index = findFieldIndex(name);
        if (index < 0) throw new NoSuchFieldException(tableName +" DataTableRow getObject(String name) unknown field name:" + name);
  DataObject dataObj = getDataObject(index);
  if (dataObj == null) return null;
  else return (DataObject) dataObj.clone();
    }

/** Returns the DataObject for the specified table column index from the data collection.
*/
    public DataObject getDataObject(int index) throws IndexOutOfBoundsException {
  if (index < 0 || index > fields.size())
    throw new IndexOutOfBoundsException(tableName +
       " DataTableRow getDataObject(index) field index out of bounds:" + index);
  return (DataObject) fields.get(index);
    }

/** Returns a primitive equivalent to the value of the DataObject for the specified table column name.
*/
    public int getIntValue(String name) throws NoSuchFieldException {
        int index = findFieldIndex(name);
        if (index < 0) throw new NoSuchFieldException(tableName +
       " DataTableRow getIntValue(String name) unknown field name:" + name);
  return getIntValue(index);
    }

/** Returns a primitive equivalent to the value of the DataObject for the specified table column index.
*/
    public int getIntValue(int index) throws IndexOutOfBoundsException, NullPointerException {
  if (index < 0 || index > fields.size())

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -