LandUnit.java [src/java/m/ipat] 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 m.ipat;

import data.table.Table;
import data.table.column.ColumnDouble;
import data.table.column.ColumnString;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.ConcurrentHashMap;

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

        public static final String LAND_UNIT_ID = "land_unit_id";
        public static final String IRRIGATED_ACRES = "irrigated_acres";
        public static final String ROTATION_CROPS = "rotation";        

        //Calculated
        public static final String WATER_REQUIREMENT = "water_requirement";
        public static final String WATER_USE = "water_use";

        protected ConcurrentHashMap<String, Crops> crops;

        public LandUnit() {
            addDataColumn(LAND_UNIT_ID, new ColumnString(LAND_UNIT_ID, ""));
            addDataColumn(IRRIGATED_ACRES, new ColumnDouble(IRRIGATED_ACRES, ""));
            addDataColumn(ROTATION_CROPS, new ColumnCropsTable(ROTATION_CROPS));            

            addDataColumn(WATER_REQUIREMENT, new ColumnDouble(WATER_REQUIREMENT, ""));
            addDataColumn(WATER_USE, new ColumnDouble(WATER_USE, ""));

            setRequiredColumns(new ArrayList<>(Arrays.asList(
                    LAND_UNIT_ID, IRRIGATED_ACRES, ROTATION_CROPS
            )));
        }                
    }