本文整理汇总了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));
}
示例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;
}
示例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;
}