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


Java ContainerValue.setValue方法代码示例

本文整理汇总了Java中net.ssehub.easy.varModel.model.values.ContainerValue.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerValue.setValue方法的具体用法?Java ContainerValue.setValue怎么用?Java ContainerValue.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.ssehub.easy.varModel.model.values.ContainerValue的用法示例。


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

示例1: cloneContainerTest

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
/**
 * Tests whether cloning of ContainerValue succeeds and if the cloned objects are the same.
 * @throws ValueDoesNotMatchTypeException Must not occur, otherwise it the setValue method of {@link ContainerValue}
 * is detecting duplicates but there are no duplicates.
 */
@Test
public void cloneContainerTest() throws ValueDoesNotMatchTypeException {
    ContainerValue clone = (ContainerValue) value.clone();
    Assert.assertNotSame(clone, value);
    ContainerValue subValue = (ContainerValue) value.getElement(0);
    int subsize = subValue.getElementSize();
    Value integerValue = null;
    try {
        integerValue = ValueFactory.createValue(IntegerType.TYPE, "5");
    } catch (ValueDoesNotMatchTypeException e) {
        LOGGER.exception(e);
    }
    subValue.setValue(0, integerValue);
    Assert.assertEquals(subsize, subValue.getElementSize());
    Assert.assertNotSame(clone, value);
    Assert.assertFalse("ContainerValue and its clone are the same!", value.equals(clone));
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:23,代码来源:ContainerValueTest.java

示例2: setValue

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
@Override
public boolean setValue(Value value, boolean asAssignment) {
    boolean done = false;
    IDecisionVariable variable = getVariable();
    if (Container.TYPE.isAssignableFrom(variable.getDeclaration().getType())) {
        ContainerValue val = (ContainerValue) variable.getValue();
        if (null != val) {
            try {
                val.setValue(index, value);
                done = true;
            } catch (ValueDoesNotMatchTypeException e) {
                EASyLoggerFactory.INSTANCE.getLogger(IndexAccessor.class, Bundle.ID).exception(e);
            }
        }
    }
    return done;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:18,代码来源:IndexAccessor.java

示例3: setValue

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
@Override
protected void setValue(Value value, IAssignmentState state) throws ConfigurationException {
    ContainerValue parentValue = (ContainerValue) getParent().getValue();
    if (parentValue != null) {
        try {
            parentValue.setValue(index, value);
        } catch (ValueDoesNotMatchTypeException e) {
            throw new ConfigurationException(getConfiguration(), e.getMessage(),
                ConfigurationException.DUPLICATES_IN_SET);
        }
    } else {
        ContainerVariable parent = getParent();
        String nestedName = parent.getElementName(index);
        IDatatype type = DerivedDatatype.resolveToBasis(parent.getDeclaration().getType());
        type = ((Container) type).getContainedType();
        DecisionVariableDeclaration nestedDecl = new DecisionVariableDeclaration(nestedName,
            type, parent.getDeclaration());
        VariableCreator creator = new VariableCreator(nestedDecl, parent, parent.isVisible(), false);
        IDecisionVariable nestedVar = creator.getVariable(false);
        parent.addNestedElement(nestedVar);
    }
    this.state = state;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:24,代码来源:ContainerItemConfigProvider.java


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