当前位置: 首页>>代码示例>>Java>>正文


Java UnitDefinition类代码示例

本文整理汇总了Java中org.sbml.jsbml.UnitDefinition的典型用法代码示例。如果您正苦于以下问题:Java UnitDefinition类的具体用法?Java UnitDefinition怎么用?Java UnitDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UnitDefinition类属于org.sbml.jsbml包,在下文中一共展示了UnitDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: completeUnitDefinitions

import org.sbml.jsbml.UnitDefinition; //导入依赖的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;
}
 
开发者ID:funasoul,项目名称:celldesigner-parser,代码行数:30,代码来源:SBMLModelCompleter.java

示例2: checkUnitsInAssignmentRule

import org.sbml.jsbml.UnitDefinition; //导入依赖的package包/类
public static boolean checkUnitsInAssignmentRule(SBMLDocument document, Rule rule)
{
	UnitDefinition unitDef = rule.getDerivedUnitDefinition();
	UnitDefinition unitDefVar;
	Species species = document.getModel().getSpecies(getVariable(rule));
	Compartment compartment = document.getModel().getCompartment(getVariable(rule));
	Parameter parameter = document.getModel().getParameter(getVariable(rule));
	if (species != null)
	{
		unitDefVar = species.getDerivedUnitDefinition();
	}
	else if (compartment != null)
	{
		unitDefVar = compartment.getDerivedUnitDefinition();
	}
	else
	{
		unitDefVar = parameter.getDerivedUnitDefinition();
	}
	if (!UnitDefinition.areEquivalent(unitDef, unitDefVar))
	{
		return true;
	}
	return false;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:26,代码来源:SBMLutilities.java

示例3: checkUnitsInInitialAssignment

import org.sbml.jsbml.UnitDefinition; //导入依赖的package包/类
public static boolean checkUnitsInInitialAssignment(SBMLDocument document, InitialAssignment init)
{
	UnitDefinition unitDef = init.getDerivedUnitDefinition();
	UnitDefinition unitDefVar;
	Species species = document.getModel().getSpecies(init.getVariable());
	Compartment compartment = document.getModel().getCompartment(init.getVariable());
	Parameter parameter = document.getModel().getParameter(init.getVariable());
	if (species != null)
	{
		unitDefVar = species.getDerivedUnitDefinition();
	}
	else if (compartment != null)
	{
		unitDefVar = compartment.getDerivedUnitDefinition();
	}
	else
	{
		unitDefVar = parameter.getDerivedUnitDefinition();
	}
	if (!UnitDefinition.areEquivalent(unitDef, unitDefVar))
	{
		return true;
	}
	return false;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:26,代码来源:SBMLutilities.java

示例4: checkUnitsInEventAssignment

import org.sbml.jsbml.UnitDefinition; //导入依赖的package包/类
public static boolean checkUnitsInEventAssignment(SBMLDocument document, EventAssignment assign)
{
	UnitDefinition unitDef = assign.getDerivedUnitDefinition();
	UnitDefinition unitDefVar;
	Species species = document.getModel().getSpecies(assign.getVariable());
	Compartment compartment = document.getModel().getCompartment(assign.getVariable());
	Parameter parameter = document.getModel().getParameter(assign.getVariable());
	if (species != null)
	{
		unitDefVar = species.getDerivedUnitDefinition();
	}
	else if (compartment != null)
	{
		unitDefVar = compartment.getDerivedUnitDefinition();
	}
	else
	{
		unitDefVar = parameter.getDerivedUnitDefinition();
	}
	if (unitDef != null && unitDefVar != null && !UnitDefinition.areEquivalent(unitDef, unitDefVar))
	{
		return true;
	}
	return false;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:26,代码来源:SBMLutilities.java

示例5: createUnitsChoices

import org.sbml.jsbml.UnitDefinition; //导入依赖的package包/类
public static JComboBox createUnitsChoices(BioModel bioModel) {
	JComboBox specUnits = new JComboBox();
	specUnits.addItem("( none )");
	for (int i = 0; i < bioModel.getSBMLDocument().getModel().getUnitDefinitionCount(); i++) {
		UnitDefinition unit = bioModel.getSBMLDocument().getModel().getUnitDefinition(i);
		if ((unit.getUnitCount() == 1)
				&& (unit.getUnit(0).isMole() || unit.getUnit(0).isItem() || unit.getUnit(0).isGram() || unit.getUnit(0).isKilogram())
				&& (unit.getUnit(0).getExponent() == 1)) {
			if (!(bioModel.getSBMLDocument().getLevel() < 3 && unit.getId().equals("substance"))) {
				specUnits.addItem(unit.getId());
			}
		}
	}
	if (bioModel.getSBMLDocument().getLevel() < 3) {
		specUnits.addItem("substance");
	}
	String[] unitIds = { "dimensionless", "gram", "item", "kilogram", "mole" };
	for (int i = 0; i < unitIds.length; i++) {
		specUnits.addItem(unitIds[i]);
	}
	return specUnits;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:23,代码来源:MySpecies.java

示例6: addUnitDefinition

import org.sbml.jsbml.UnitDefinition; //导入依赖的package包/类
private void addUnitDefinition(String strLB_Unit) {
	if (!strLB_Unit.equals("dimensionless")) {
		boolean bFound = false;

		for (String strUnitDef : _ListOfUnitDefinitions) {
			if (strUnitDef.equals(strLB_Unit.trim())) {
				bFound = true;
				break;
			}
		}

		if (!bFound) {
			UnitDefinition _unit = model.createUnitDefinition();
			_unit.setId(strLB_Unit);
			_ListOfUnitDefinitions.add(strLB_Unit);
		}
	}
}
 
开发者ID:ibalaur,项目名称:MetabolicFramework,代码行数:19,代码来源:JSON2SBMLParser.java

示例7: definitionToXml

import org.sbml.jsbml.UnitDefinition; //导入依赖的package包/类
private static String definitionToXml(UnitDefinition definition) {
	if (definition.getUnitCount() == 0) {
		return NO_UNIT;
	}

	SBMLDocument doc = new SBMLDocument(LEVEL, VERSION);
	Model model = doc.createModel("ID");

	model.addUnitDefinition(definition.clone());

	ByteArrayOutputStream out = new ByteArrayOutputStream();

	try {
		SBMLWriter.write(doc, out, "test", "1.0", ' ', (short) 0);

		String xml = out.toString(StandardCharsets.UTF_8.name());
		String from = "<listOfUnitDefinitions>";
		String to = "</listOfUnitDefinitions>";

		return xml.substring(xml.indexOf(from) + from.length(), xml.indexOf(to)).replace("\n", "");
	} catch (SBMLException | XMLStreamException | UnsupportedEncodingException e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:26,代码来源:PmmUnit.java

示例8: UnitDefinitionTable

import org.sbml.jsbml.UnitDefinition; //导入依赖的package包/类
/**
 * Instantiates a new unit definition table.
 *
 * @param loud the loud
 */
UnitDefinitionTable(ListOf<UnitDefinition> loud){
	this.model = loud.getModel();
	list = loud;
	setUnitDefinitionToList(loud);
	MyTableModel tm = getTableModelWithUnitDefinitions(loud);
	table = new JTable(tm);
	setTableProperties(table);
	pane = setTableToScroll("unit",table);
}
 
开发者ID:spatialsimulator,项目名称:XitoSBML,代码行数:15,代码来源:UnitDefinitionTable.java

示例9: setUnitDefinitionToList

import org.sbml.jsbml.UnitDefinition; //导入依赖的package包/类
/**
 * Sets the unit definition to list.
 *
 * @param loud the new unit definition to list
 */
private void setUnitDefinitionToList(ListOf<UnitDefinition> loud){
	long max = loud.size();
	for(int i = 0; i < max; i++){
		UnitDefinition ud = loud.get(i);
		memberList.add(ud.clone());
	}
}
 
开发者ID:spatialsimulator,项目名称:XitoSBML,代码行数:13,代码来源:UnitDefinitionTable.java

示例10: getTableModelWithUnitDefinitions

import org.sbml.jsbml.UnitDefinition; //导入依赖的package包/类
/**
 * Gets the table model with unit definitions.
 *
 * @param loud the loud
 * @return the table model with unit definitions
 */
private MyTableModel getTableModelWithUnitDefinitions(ListOf<UnitDefinition> loud){
	int max = memberList.size();
	Object[][] data  = new Object[max][header.length];
	for(int i = 0; i < max; i++){
		UnitDefinition ud = (UnitDefinition) memberList.get(i);
		data[i][0] = ud.getId();
		data[i][1] = unitsToString(ud.getListOfUnits());
	}
	
	MyTableModel tm = new MyTableModel(data, header) {
		private static final long serialVersionUID = 1L;

		@Override
		public Class<?> getColumnClass(int Column) {
			switch (Column) {
			case 0: // id
			case 1: // units
				return String.class;
			default:
				return String.class;
			}
		}
	};
	
	tm.setColumnIdentifiers(header);
		
	return tm;
}
 
开发者ID:spatialsimulator,项目名称:XitoSBML,代码行数:35,代码来源:UnitDefinitionTable.java

示例11: unitDefinitionToVector

import org.sbml.jsbml.UnitDefinition; //导入依赖的package包/类
/**
	 * Unit definition to vector.
	 *
	 * @param ud the ud
	 * @return the vector
	 */
	private Vector<Object> unitDefinitionToVector(UnitDefinition ud){
		Vector<Object> v = new Vector<Object>();
		v.add(ud.getId());
//		v.add(p.getValue());
//		v.add(p.getUnits());
//		v.add(p.getConstant());
//		
		return v;
	}
 
开发者ID:spatialsimulator,项目名称:XitoSBML,代码行数:16,代码来源:UnitDefinitionTable.java

示例12: addUnits

import org.sbml.jsbml.UnitDefinition; //导入依赖的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));
}
 
开发者ID:spatialsimulator,项目名称:XitoSBML,代码行数:31,代码来源:SpatialSBMLExporter.java

示例13: getUnits

import org.sbml.jsbml.UnitDefinition; //导入依赖的package包/类
public ArrayList<String> getUnits() {
	ArrayList<String> unitSet = new ArrayList<String>();
	if (sbml!=null) {
		for (int i = 0; i < sbml.getModel().getUnitDefinitionCount(); i++) {
			UnitDefinition unit = sbml.getModel().getUnitDefinition(i);
			unitSet.add(unit.getId());
		}
	}
	return unitSet;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:11,代码来源:BioModel.java

示例14: checkUnitsInEventDelay

import org.sbml.jsbml.UnitDefinition; //导入依赖的package包/类
public static boolean checkUnitsInEventDelay(Delay delay)
{
	UnitDefinition unitDef = delay.getDerivedUnitDefinition();
	if (unitDef != null && !(unitDef.isVariantOfTime()))
	{
		return true;
	}
	return false;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:10,代码来源:SBMLutilities.java

示例15: Units

import org.sbml.jsbml.UnitDefinition; //导入依赖的package包/类
public Units(BioModel gcm, ModelEditor modelEditor) {
	super(new BorderLayout());
	this.bioModel = gcm;
	this.modelEditor = modelEditor;
	Model model = gcm.getSBMLDocument().getModel();
	addUnit = new JButton("Add Unit");
	removeUnit = new JButton("Remove Unit");
	editUnit = new JButton("Edit Unit");
	unitDefs = new JList();
	ListOf<UnitDefinition> listOfUnits = model.getListOfUnitDefinitions();
	String[] units = new String[model.getUnitDefinitionCount()];
	for (int i = 0; i < model.getUnitDefinitionCount(); i++) {
		UnitDefinition unit = listOfUnits.get(i);
		units[i] = unit.getId();
		// GET OTHER THINGS
	}
	JPanel addRem = new JPanel();
	addRem.add(addUnit);
	addRem.add(removeUnit);
	addRem.add(editUnit);
	addUnit.addActionListener(this);
	removeUnit.addActionListener(this);
	editUnit.addActionListener(this);
	JLabel panelLabel = new JLabel("List of Units:");
	JScrollPane scroll = new JScrollPane();
	scroll.setMinimumSize(new Dimension(260, 220));
	scroll.setPreferredSize(new Dimension(276, 152));
	scroll.setViewportView(unitDefs);
	edu.utah.ece.async.ibiosim.dataModels.biomodel.util.Utility.sort(units);
	unitDefs.setListData(units);
	unitDefs.setSelectedIndex(0);
	unitDefs.addMouseListener(this);
	this.add(panelLabel, "North");
	this.add(scroll, "Center");
	this.add(addRem, "South");
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:37,代码来源:Units.java


注:本文中的org.sbml.jsbml.UnitDefinition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。