StratifiedTextures.java [src/java/d/soils/wwe02_wepssoilinput] Revision: default Date:
/*
* $Id$
*
* This file is part of the Cloud Services Integration Platform (CSIP),
* a Model-as-a-Service framework, API, and application suite.
*
* 2012-2017, OMSLab, Colorado State University.
*
* OMSLab licenses this file to you under the MIT license.
* See the LICENSE file in the project root for more information.
*/
package d.soils.wwe02_wepssoilinput;
import java.util.HashMap;
import java.util.Map;
/**
*
* @author Joseph Levin <a href="joelevin@weru.ksu.edu">EMails</a>
*/
public class StratifiedTextures {
public static enum textures {
C, CL, COS, COSL, FS, FSL, L, LCOS, LFS, LS, LVFS, S, SC, SCL, SI, SIC, SICL, SIL, SL, VFS, VFSL
};
private static StratifiedTextures c_instance = null;
private static Map<String, double[]> c_values = new HashMap<>();
/**
*
* @return
*/
public synchronized static StratifiedTextures getInstance() {
if (c_instance == null) {
c_instance = new StratifiedTextures();
}
return c_instance;
}
private StratifiedTextures() {
c_values.put("C", new double[]{0.22, 0.13, 0.23, 0.55});
c_values.put("CL", new double[]{0.33, 0.18, 0.33, 0.34});
c_values.put("COS", new double[]{0.92, 0.3, 0.04, 0.04});
c_values.put("COSL", new double[]{0.65, 0.25, 0.25, 0.1});
c_values.put("FS", new double[]{0.92, 0.4, 0.04, 0.04});
c_values.put("FSL", new double[]{0.65, 0.25, 0.25, 0.1});
c_values.put("L", new double[]{0.41, 0.17, 0.41, 0.18});
c_values.put("LCOS", new double[]{0.84, 0.25, 0.1, 0.06});
c_values.put("LFS", new double[]{0.84, 0.45, 0.1, 0.06});
c_values.put("LS", new double[]{0.84, 0.35, 0.1, 0.06});
c_values.put("LVFS", new double[]{0.84, 0.55, 0.1, 0.06});
c_values.put("S", new double[]{0.92, 0.35, 0.04, 0.04});
c_values.put("SC", new double[]{0.53, 0.2, 0.41, 0.06});
c_values.put("SCL", new double[]{0.59, 0.22, 0.14, 0.27});
c_values.put("SI", new double[]{0.04, 0.02, 0.88, 0.08});
c_values.put("SIC", new double[]{0.06, 0.04, 0.48, 0.46});
c_values.put("SICL", new double[]{0.1, 0.07, 0.55, 0.35});
c_values.put("SIL", new double[]{0.2, 0.1, 0.6, 0.2});
c_values.put("SL", new double[]{0.65, 0.2, 0.25, 0.1});
c_values.put("VFS", new double[]{0.92, 0.6, 0.04, 0.04});
c_values.put("VFSL", new double[]{0.65, 0.35, 0.25, 0.1});
}
/**
*
* @return
*/
public String[] textures() {
return c_values.keySet().toArray(new String[c_values.size()]);
}
/**
*
* @param texture
* @return
*/
public boolean isTextureValid(String texture) {
return c_values.containsKey(texture.toUpperCase());
}
protected double getValue(String texture, int i) {
if (i < c_values.size()) {
double[] values = c_values.get(texture.toUpperCase());
if (values != null) {
return values[i];
}
}
return Double.NaN;
}
/**
*
* @param texture
* @return
*/
public double getSand(String texture) {
return getValue(texture, 0);
}
/**
*
* @param texture
* @return
*/
public double getVeryFineSand(String texture) {
return getValue(texture, 1);
}
/**
*
* @param texture
* @return
*/
public double getSilt(String texture) {
return getValue(texture, 2);
}
/**
*
* @param texture
* @return
*/
public double getClay(String texture) {
return getValue(texture, 3);
}
}