TableFragments.java [src/soils/db/tables] Revision: default  Date:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package soils.db.tables;

import java.util.ArrayList;
import java.util.Arrays;

/**
 *
 * @author <a href="mailto:shaun.case@colostate.edu">Shaun Case</a>
 */
public class TableFragments extends Table {

    public static final String TABLE_NAME = "chfrags";
    public static final String FRAGVOL_L = "fragvol_l";
    public static final String FRAGVOL_R = "fragvol_r";
    public static final String FRAGVOL_H = "fragvol_h";
    public static final String FRAGKIND = "fragkind";
    public static final String FRAGSIZE_L = "fragsize_l";
    public static final String FRAGSIZE_R = "fragsize_r";
    public static final String FRAGSIZE_H = "fragsize_h";
    public static final String FRAGSHP = "fragshp";
    public static final String FRAGROUND = "fraground";
    public static final String FRAGHARD = "fraghard";
    public static final String CHKEY = "chkey";
    public static final String CHFRAGSKEY = "chfragskey";

    static final String[] FRAGVOL_L_DATA = {FRAGVOL_L, "The volume percentage of the horizon occupied by the 2 mm or larger fraction (20 mm or larger for wood fragments), on a whole soil base", "Percent", "%.2f"};
    static final String[] FRAGVOL_R_DATA = {FRAGVOL_R, "The volume percentage of the horizon occupied by the 2 mm or larger fraction (20 mm or larger for wood fragments), on a whole soil base", "Percent", "%.2f"};
    static final String[] FRAGVOL_H_DATA = {FRAGVOL_H, "The volume percentage of the horizon occupied by the 2 mm or larger fraction (20 mm or larger for wood fragments), on a whole soil base", "Percent", "%.2f"};
    static final String[] FRAGKIND_DATA = {FRAGKIND, "The lithology/composition of the 2 mm or larger fraction of the soil (20 mm or larger for wood fragments)."};
    static final String[] FRAGSIZE_L_DATA = {FRAGSIZE_L, "Size based on the multiaxial dimensions of the fragment fraction."};
    static final String[] FRAGSIZE_R_DATA = {FRAGSIZE_R, "Size based on the multiaxial dimensions of the fragment fraction."};
    static final String[] FRAGSIZE_H_DATA = {FRAGSIZE_H, "Size based on the multiaxial dimensions of the fragment fraction."};
    static final String[] FRAGSHP_DATA = {FRAGSHP, "A description of the overall shape of the fragment"};
    static final String[] FRAGROUND_DATA = {FRAGROUND, "An expression of the sharpness of edges and corners of fragments. (Sedimentary Rocks, Pettijohn, 1957)"};
    static final String[] FRAGHARD_DATA = {FRAGHARD, "The hardness of a fragment"};
    static final String[] CHKEY_DATA = {CHKEY, "A non-connotative string of characters used to uniquely identify a record in the Horizon table"};
    static final String[] CHFRAGSKEY_DATA = {CHFRAGSKEY, "A non-connotative string of characters used to uniquely identify a record in the Horizon Fragments table."};

    /**
     * This ArrayList contains a static list of columns for this table that are
     * required regardless of the calling program's preferences. This columns
     * typically identify indexes and foreign keys and other relational aspects
     * of a table that must be maintained for data integrity.
     * 
     * @see Table#getMandatoryColumns() 
     * @see #getMandatoryColumns() 
     */
    protected static final ArrayList<String> MANDATORY_COLUMNS = new ArrayList<>(Arrays.asList(CHKEY, CHFRAGSKEY));

    public TableFragments() {
        tableName=TABLE_NAME;
        addDataColumn(FRAGVOL_L, new TableColumnDouble(FRAGVOL_L_DATA));
        addDataColumn(FRAGVOL_R, new TableColumnDouble(FRAGVOL_R_DATA));
        addDataColumn(FRAGVOL_H, new TableColumnDouble(FRAGVOL_H_DATA));
        addDataColumn(FRAGKIND, new TableColumnString(FRAGKIND_DATA));
        addDataColumn(FRAGSIZE_L, new TableColumnDouble(FRAGSIZE_L_DATA));
        addDataColumn(FRAGSIZE_R, new TableColumnDouble(FRAGSIZE_R_DATA));
        addDataColumn(FRAGSIZE_H, new TableColumnDouble(FRAGSIZE_H_DATA));
        addDataColumn(FRAGSHP, new TableColumnString(FRAGSHP_DATA));
        addDataColumn(FRAGROUND, new TableColumnString(FRAGROUND_DATA));
        addDataColumn(FRAGHARD, new TableColumnString(FRAGHARD_DATA));
        addDataColumn(CHKEY, new TableColumnString(CHKEY_DATA));
        addDataColumn(CHFRAGSKEY, new TableColumnString(CHFRAGSKEY_DATA));
    }

    @Override
    protected ArrayList<String> getMandatoryColumns(){
        return MANDATORY_COLUMNS;
    }
    
    public double fragvol_l() {
        return ((double) columns.get(TableFragments.FRAGVOL_L).getValue());
    }

    public double fragvol_r() {
        return ((double) columns.get(TableFragments.FRAGVOL_R).getValue());
    }

    public double fragvol_h() {
        return ((double) columns.get(TableFragments.FRAGVOL_H).getValue());
    }

    public String fragkind() {
        return ((String) columns.get(TableFragments.FRAGKIND).getValue());
    }

    public double fragsize_l() {
        return ((double) columns.get(TableFragments.FRAGSIZE_L).getValue());
    }

    public double fragsize_r() {
        return ((double) columns.get(TableFragments.FRAGSIZE_R).getValue());
    }

    public double fragsize_h() {
        return ((double) columns.get(TableFragments.FRAGSIZE_H).getValue());
    }

    public String fragshp() {
        return ((String) columns.get(TableFragments.FRAGSHP).getValue());
    }

    public String fraground() {
        return ((String) columns.get(TableFragments.FRAGROUND).getValue());
    }

    public String fraghard() {
        return ((String) columns.get(TableFragments.FRAGHARD).getValue());
    }

    public String chkey() {
        return ((String) columns.get(TableFragments.CHKEY).getValue());
    }

    public String chfragskey() {
        return ((String) columns.get(TableFragments.CHFRAGSKEY).getValue());
    }

    public void fragvol_l(double value) {
        columns.get(TableFragments.FRAGVOL_L).setValue(value);
    }

    public void fragvol_r(double value) {
        columns.get(TableFragments.FRAGVOL_R).setValue(value);
    }

    public void fragvol_h(double value) {
        columns.get(TableFragments.FRAGVOL_H).setValue(value);
    }

    public void fragkind(String value) {
        columns.get(TableFragments.FRAGKIND).setValue(value);
    }

    public void fragsize_l(double value) {
        columns.get(TableFragments.FRAGSIZE_L).setValue(value);
    }

    public void fragsize_r(double value) {
        columns.get(TableFragments.FRAGSIZE_R).setValue(value);
    }

    public void fragsize_h(double value) {
        columns.get(TableFragments.FRAGSIZE_H).setValue(value);
    }

    public void fragshp(String value) {
        columns.get(TableFragments.FRAGSHP).setValue(value);
    }

    public void fraground(String value) {
        columns.get(TableFragments.FRAGROUND).setValue(value);
    }

    public void fraghard(String value) {
        columns.get(TableFragments.FRAGHARD).setValue(value);
    }

    public void chkey(String value) {
        columns.get(TableFragments.CHKEY).setValue(value);
    }

    public void chfragskey(String value) {
        columns.get(TableFragments.CHFRAGSKEY).setValue(value);
    }

}