本文整理汇总了Java中org.sbml.jsbml.Unit.Kind类的典型用法代码示例。如果您正苦于以下问题:Java Kind类的具体用法?Java Kind怎么用?Java Kind使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Kind类属于org.sbml.jsbml.Unit包,在下文中一共展示了Kind类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: completeUnitDefinitions
import org.sbml.jsbml.Unit.Kind; //导入依赖的package包/类
/**
* Complete unit definitions.
*
* @param unitDefinitions
* the unit definitions
* @return ListOf<UnitDefinition>
* TODO
*/
public static ListOf<UnitDefinition> completeUnitDefinitions(
ListOf<UnitDefinition> unitDefinitions) {
for (UnitDefinition ud : unitDefinitions) {
ListOf<Unit> units = ud.getListOfUnits();
for (Unit u : units) {
if (!u.isSetExponent()) {
u.setExponent(1d);
}
if (!u.isSetMultiplier()) {
u.setMultiplier(1d);
}
if (!u.isSetKind()) {
u.setKind(Kind.INVALID);
}
if (!u.isSetScale()) {
u.setScale(0);
}
}
}
return unitDefinitions;
}
示例2: addUnits
import org.sbml.jsbml.Unit.Kind; //导入依赖的package包/类
/**
* Adds the units.
*/
public void addUnits(){
if(unit == null)
return;
UnitDefinition ud = model.createUnitDefinition();
ud.setId("length");
Unit u = ud.createUnit();
u.setKind(Kind.METRE);
u.setExponent(1d);
u.setScale(0);
u.setMultiplier(getUnitMultiplier(unit));
ud = model.createUnitDefinition();
ud.setId("area");
u = ud.createUnit();
u.setKind(Kind.METRE);
u.setExponent(2d);
u.setScale(0);
u.setMultiplier(getUnitMultiplier(unit));
ud = model.createUnitDefinition();
ud.setId("volume");
u = ud.createUnit();
u.setKind(Kind.METRE);
u.setExponent(3d);
u.setScale(0);
u.setMultiplier(getUnitMultiplier(unit));
}
示例3: unitIndexToString
import org.sbml.jsbml.Unit.Kind; //导入依赖的package包/类
/**
* Unit index to string.
*
* @param index the index
* @return the string
*/
@SuppressWarnings("deprecation")
public static String unitIndexToString(Kind index){
if(index == Kind.AMPERE) return "ampere";
if(index == Kind.AVOGADRO) return "avogadro";
if(index == Kind.BECQUEREL) return "becquerel";
if(index == Kind.CANDELA) return "candela";
if(index == Kind.CELSIUS) return "celsius";
if(index == Kind.COULOMB) return "coulomb";
if(index == Kind.DIMENSIONLESS) return "dimensionless";
if(index == Kind.FARAD) return "farad";
if(index == Kind.GRAM) return "gram";
if(index == Kind.GRAY) return "gray";
if(index == Kind.HENRY) return "henry";
if(index == Kind.HERTZ) return "hertz";
if(index == Kind.ITEM) return "item";
if(index == Kind.JOULE) return "joule";
if(index == Kind.KATAL) return "katal";
if(index == Kind.KELVIN) return "kelvin";
if(index == Kind.KILOGRAM) return "kilogram";
if(index == Kind.LITER) return "liter";
if(index == Kind.LITRE) return "litre";
if(index == Kind.LUMEN) return "lumen";
if(index == Kind.LUX) return "lux";
if(index == Kind.METER) return "meter";
if(index == Kind.METRE) return "metre";
if(index == Kind.MOLE) return "mole";
if(index == Kind.NEWTON) return "newton";
if(index == Kind.OHM) return "ohm";
if(index == Kind.PASCAL) return "pascal";
if(index == Kind.RADIAN) return "radian";
if(index == Kind.SECOND) return "second";
if(index == Kind.SIEMENS) return "siemens";
if(index == Kind.SIEVERT) return "sievert";
if(index == Kind.STERADIAN) return "steradian";
if(index == Kind.TESLA) return "tesla";
if(index == Kind.VOLT) return "volt";
if(index == Kind.WATT) return "watt";
if(index == Kind.WEBER) return "weber";
return null;
}
示例4: StringToUnit
import org.sbml.jsbml.Unit.Kind; //导入依赖的package包/类
/**
* String to unit.
*
* @param s the s
* @return the kind
*/
//TODO use jsbml method
@SuppressWarnings("deprecation")
public static Kind StringToUnit(String s){
if(s.equals("ampere")) return Kind.AMPERE;
else if(s.equals("avogadro")) return Kind.AVOGADRO;
else if(s.equals("becquerel")) return Kind.BECQUEREL;
else if(s.equals("candela")) return Kind.CANDELA;
else if(s.equals("celsius")) return Kind.CELSIUS;
else if(s.equals("coulomb")) return Kind.COULOMB;
else if(s.equals("farad")) return Kind.FARAD;
else if(s.equals("gram")) return Kind.GRAM;
else if(s.equals("gray")) return Kind.GRAY;
else if(s.equals("henry")) return Kind.HENRY;
else if(s.equals("hertz")) return Kind.HERTZ;
else if(s.equals( "item")) return Kind.ITEM;
else if(s.equals("joule")) return Kind.JOULE;
else if(s.equals( "katal")) return Kind.KATAL;
else if(s.equals("kelvin")) return Kind.KELVIN;
else if(s.equals("kilogram")) return Kind.KILOGRAM;
else if(s.equals("liter")) return Kind.LITER;
else if(s.equals("litre")) return Kind.LITRE;
else if(s.equals("lumen")) return Kind.LUMEN;
else if(s.equals("lux")) return Kind.LUX;
else if(s.equals("meter")) return Kind.METER;
else if(s.equals("metre")) return Kind.METRE;
else if(s.equals("mole")) return Kind.MOLE;
else if(s.equals("newton")) return Kind.NEWTON;
else if(s.equals("ohm")) return Kind.OHM;
else if(s.equals("pascal")) return Kind.PASCAL;
else if(s.equals("radian")) return Kind.RADIAN;
else if(s.equals("second")) return Kind.SECOND;
else if(s.equals("siemens")) return Kind.SIEMENS;
else if(s.equals("sievert")) return Kind.SIEVERT;
else if(s.equals("steradian")) return Kind.STERADIAN;
else if(s.equals("tesla")) return Kind.TESLA;
else if(s.equals("volt")) return Kind.VOLT;
else if(s.equals("watt")) return Kind.WATT;
else if(s.equals( "weber")) return Kind.WEBER;
else return Kind.DIMENSIONLESS ;
}
示例5: getUnitString
import org.sbml.jsbml.Unit.Kind; //导入依赖的package包/类
public static String getUnitString(ArrayList<String> unitNames,
ArrayList<Integer> exponents, ArrayList<Integer> multiplier,
Model model) {
// First build the name of the unit and see if it exists, start by
// sorting the units to build a unique string
for (int i = 0; i < unitNames.size(); i++) {
for (int j = i; j > 0; j--) {
if (unitNames.get(j - 1).compareTo(unitNames.get(i)) > 0) {
Integer tempD = multiplier.get(j);
Integer tempI = exponents.get(j);
String tempS = unitNames.get(j);
multiplier.set(j, multiplier.get(j - 1));
unitNames.set(j, unitNames.get(j - 1));
exponents.set(j, exponents.get(j - 1));
multiplier.set(j - 1, tempD);
unitNames.set(j - 1, tempS);
exponents.set(j - 1, tempI);
}
}
}
UnitDefinition t = new UnitDefinition(GlobalConstants.SBML_LEVEL, GlobalConstants.SBML_VERSION);
String name = "u_";
for (int i = 0; i < unitNames.size(); i++) {
String sign = "";
if (exponents.get(i).intValue() < 0) {
sign = "n";
}
name = name + multiplier.get(i) + "_" + unitNames.get(i) + "_"
+ sign + Math.abs(exponents.get(i)) + "_";
Unit u = t.createUnit();
u.setKind(Kind.valueOf(unitNames.get(i).toUpperCase()));
u.setExponent(exponents.get(i).intValue()*1.0);
u.setMultiplier(multiplier.get(i).intValue());
u.setScale(0);
}
name = name.substring(0, name.length() - 1);
t.setId(name);
if (model.getUnitDefinition(name) == null) {
model.addUnitDefinition(t);
}
return name;
}