本文整理汇总了Java中net.ssehub.easy.varModel.model.values.ContainerValue.addElement方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerValue.addElement方法的具体用法?Java ContainerValue.addElement怎么用?Java ContainerValue.addElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.ssehub.easy.varModel.model.values.ContainerValue
的用法示例。
在下文中一共展示了ContainerValue.addElement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleNextValue
import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
/**
* Handles the next value by checking whether it was already added.
*
* @param value the value
* @param result the result container to be changed if not already added
* @param data the temporary data storing already added elements
* @param nextValues the next values to be considered for iteration
* @throws ValueDoesNotMatchTypeException if adding <code>value</code> to <code>result</code> is failing
*/
private void handleNextValue(Value value, ContainerValue result, Map<Object, Object> data,
List<Value> nextValues) throws ValueDoesNotMatchTypeException {
@SuppressWarnings("unchecked")
Set<Object> marking = (Set<Object>) data.get(DATA_CLOSURE_MARKED);
if (null == marking) {
marking = new HashSet<Object>();
data.put(DATA_CLOSURE_MARKED, marking);
}
if (!marking.contains(value)) {
nextValues.add(value);
if (null != result) {
result.addElement(value);
}
marking.add(value);
} else {
data.put(DATA_CLOSURE_CYCLIC, Boolean.TRUE);
}
}
示例2: postProcessResult
import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
@Override
public void postProcessResult(EvaluationAccessor result, Map<Object, Object> data)
throws ValueDoesNotMatchTypeException {
Value rVal = result.getValue();
Object tmp = data.get(KEY_SORTED_BY);
if (null != tmp && rVal instanceof ContainerValue) {
ContainerValue container = (ContainerValue) rVal;
@SuppressWarnings("unchecked")
TreeMap<Value, List<Value>> keyMap = (TreeMap<Value, List<Value>>) tmp;
for (List<Value> valList : keyMap.values()) {
for (Value val: valList) {
container.addElement(val);
}
}
}
}
示例3: evaluate
import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
@Override
public EvaluationAccessor evaluate(EvaluationAccessor operand, EvaluationAccessor[] arguments) {
EvaluationAccessor result = null;
if (1 == arguments.length) {
Value oValue = operand.getValue();
Value aValue = arguments[0].getValue();
if (oValue instanceof ContainerValue && null != aValue) {
ContainerValue cont = (ContainerValue) oValue;
try {
cont.addElement(aValue);
result = ConstantAccessor.POOL.getInstance().bind(aValue, operand.getContext());
} catch (ValueDoesNotMatchTypeException e) {
// result -> null
operand.getContext().addErrorMessage(e);
}
}
}
return result;
}