import net.ssehub.easy.varModel.confModel.IDecisionVariable; //導入方法依賴的package包/類

/**

* Sets a reference value on slotName of var, e.g., for initializing a configuration

* appropriately.

*

* @param var the variable to modify

* @param slotName the slot name within var to modify

* @param availableSlotName the name of the slot in var containing valid resources

* @param elementName the name of the element to select, else the first value in availableSlotName

* shall be taken

*/

protected void setReference(IDecisionVariable var, String slotName, String availableSlotName,

String elementName) {

try {

IDecisionVariable slot = var.getNestedElement(slotName);

IDecisionVariable availables = var.getNestedElement(availableSlotName);

Value value = null;

if (null != slot && null != availables) {

if (null == elementName) {

if (availables.getNestedElementsCount() > 0) {

value = availables.getNestedElement(0).getValue();

}

} else {

for (int n = 0; null == value && n < availables.getNestedElementsCount(); n++) {

IDecisionVariable nested = availables.getNestedElement(n);

IDecisionVariable deref = Configuration.dereference(nested);

if (elementName.equals(VariableHelper.getName(deref))) {

value = nested.getValue(); // yes, nested - take the reference

}

}

}

}

if (null != value) {

slot.setValue(value, AssignmentState.ASSIGNED);

} else {

Assert.fail("cannot set value '" + elementName + "' for " + slotName

+ " as related variable does not exist");

}

} catch (ConfigurationException e) {

Assert.fail("cannot set value for " + slotName + ": " + e.getMessage());

}

}

java setvalue函数,Java IDecisionVariable.setValue方法代碼示例相关推荐

  1. java版本的getorcreate_Java ContainerUtil.getOrCreate方法代碼示例

    本文整理匯總了Java中com.intellij.util.containers.ContainerUtil.getOrCreate方法的典型用法代碼示例.如果您正苦於以下問題:Java Contai ...

  2. java document to xml_Java Document.asXML方法代碼示例

    本文整理匯總了Java中org.dom4j.Document.asXML方法的典型用法代碼示例.如果您正苦於以下問題:Java Document.asXML方法的具體用法?Java Document. ...

  3. python unescape函数_Python escape.url_unescape方法代碼示例

    本文整理匯總了Python中tornado.escape.url_unescape方法的典型用法代碼示例.如果您正苦於以下問題:Python escape.url_unescape方法的具體用法?Py ...

  4. python linspace函数_Python torch.linspace方法代碼示例

    本文整理匯總了Python中torch.linspace方法的典型用法代碼示例.如果您正苦於以下問題:Python torch.linspace方法的具體用法?Python torch.linspac ...

  5. java getchildren用法_Java ZkClient.getChildren方法代碼示例

    import org.apache.helix.manager.zk.ZkClient; //導入方法依賴的package包/類 private static void zkCopy(ZkClient ...

  6. java text to speech_Java TextToSpeech.speak方法代碼示例

    import android.speech.tts.TextToSpeech; //導入方法依賴的package包/類 @Override protected void onCreate(Bundle ...

  7. java drawrect负数_Java Graphics.drawRect方法代碼示例

    import javax.microedition.lcdui.Graphics; //導入方法依賴的package包/類 /** * Draws the item. * * @param g Gra ...

  8. java中setid(),Java Process.setId方法代碼示例

    本文整理匯總了Java中org.activiti.bpmn.model.Process.setId方法的典型用法代碼示例.如果您正苦於以下問題:Java Process.setId方法的具體用法?Ja ...

  9. java getselecteditem_Java JComboBox.getSelectedItem方法代碼示例

    本文整理匯總了Java中javax.swing.JComboBox.getSelectedItem方法的典型用法代碼示例.如果您正苦於以下問題:Java JComboBox.getSelectedIt ...

  10. java中elements_Java Element.elements方法代碼示例

    本文整理匯總了Java中org.dom4j.Element.elements方法的典型用法代碼示例.如果您正苦於以下問題:Java Element.elements方法的具體用法?Java Eleme ...

最新文章

  1. mysql定义条件和处理_MySQL定义条件和处理程序
  2. unittest 框架学习
  3. 从白盒测试到单元测试基础原理
  4. 零基础可以学python吗-Python编程语言好学吗?零基础转行能学Python吗?
  5. oracle 主键自增函数_oracle 实现主键自增
  6. 学Python可以用来干什么?就业情况究竟怎么样?
  7. 使用Web API和React创建用户注册和登录
  8. MongoDB - 分片管理
  9. java正向最大匹配算法_java中文分词之正向最大匹配法实例代码
  10. mySql 修改字段自增
  11. STK Component Insight3D控件-WPF方式
  12. Unity3D开发:向Unity3D中导入外部模型
  13. 阿里云达摩院视觉AI介绍
  14. 李沐动手学深度学习第四章-4.9.环境和分布偏移
  15. 《数据结构》实验报告二:顺序表 链表
  16. java 中的poi_Java中使用POI操作ExceL的读与
  17. 安装npm时报-4048错误的解决方案
  18. 023递归:这帮小兔崽子
  19. 批量修改txt(或其他)文件编码为utf-8
  20. 图像增强实例操作(含matlab代码)

热门文章

  1. ad中那个快捷键是重复上一部_PPT中十大快捷键
  2. 东莞 小学计算机编程大赛,小学生编程大赛【小学生大赛自我介绍】
  3. jQuery实现鼠标滑过图片放大效果
  4. C#实现将DataTable数据转为Html内容保存为一张图片
  5. 运行c程序的步骤及方法
  6. 使用TypeScript两年后,还值得吗?
  7. 计算机分盘的时候c盘留多少,win10分区c盘留多大合适
  8. 基于动物性去思考人性
  9. 第三章 教育法律法规
  10. 去除Edge打开外部应用时的提醒