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


Java ContainerValue.getElementSize方法代码示例

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


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

示例1: getPipelineArtifact

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
/**
 * Returns the pipeline artifact specification.
 * 
 * @param config configuration the configuration of the model
 * @param pipelineName the name of the pipeline
 * @return the pipeline artifact in Maven notation (groupId:artifactId:version), <b>null</b> if not 
 *     available / configured
 */
public static String getPipelineArtifact(Configuration config, String pipelineName) {
    String artifact = null;
    if (null != pipelineName && null != config) {
        ContainerValue pipelines = getPipelines(config);
        if (null != pipelines) {
            for (int e = 0, n = pipelines.getElementSize(); null == artifact && e < n; e++) {
                Value val = dereference(pipelines.getElement(e), config);
                if (val instanceof CompoundValue) {
                    CompoundValue pipeline = (CompoundValue) val;
                    String name = pipeline.getStringValue(PIPELINE_NAME_VAR_NAME);
                    if (pipelineName.equals(name)) {
                        artifact = pipeline.getStringValue(PIPELINE_ARTIFACT_VAR_NAME);
                    }
                } else {
                    getLogger().error("Pipeline value is not a compound rather than " + val.getType());
                }
            }
        }
    }
    return artifact;
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:30,代码来源:RepositoryConnector.java

示例2: visitContainerValue

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
@Override
    public void visitContainerValue(ContainerValue cValue) {
        boolean setValue = Set.TYPE.isAssignableFrom(cValue.getType());
//        this.ruleSupported = false;
        if (cValue.getElementSize() != 0) {
            contValues.add("Group 2_" + ruleCount);
            String append = "";
            if (!setValue) {
                append += " new java.util.ArrayList(java.util.Arrays.asList(new Object[] {";
            } else {
                append += " new java.util.HashSet(java.util.Arrays.asList(new Object[] {";
            }
            constraint += append;
            
            for (int i = 0; i < cValue.getElementSize(); i++) {
                cValue.getElement(i).accept(this);
                if (i != cValue.getElementSize() - 1) {
                    constraint += rule + " , ";
                }
            }
            constraint += "}))";
        } else {
            constraint += "null";
        }
    }
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:26,代码来源:DroolsImpliesEvaluator.java

示例3: initializeNested

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
/**
 * Initializes nested variables.
 */
private void initializeNested() {
    if (null == nested) {
        if (value instanceof CompoundValue) {
            CompoundValue comp = (CompoundValue) value;
            Compound type = (Compound) comp.getType();
            nested = new IDecisionVariable[type.getElementCount()];
            for (int i = 0; i < nested.length; i++) {
                DecisionVariableDeclaration d = type.getElement(i);
                nested[i] = new DecVar(this, comp.getNestedValue(d.getName()), d);
            }
        } else if (value instanceof ContainerValue) {
            ContainerValue cont = (ContainerValue) value;
            nested = new IDecisionVariable[cont.getElementSize()];
            for (int i = 0; i < nested.length; i++) {
                nested[i] = new DecVar(this, cont.getElement(i), null);
            }
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:23,代码来源:AbstractIvmlVariable.java

示例4: collectReferences

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
/**
 * Collects the references for a single variable.
 * 
 * @param var the variable to collect the references for
 * @param references the references in terms of a reference target - referring elements maps (modified as a side 
 *     effect)
 */
private void collectReferences(IDecisionVariable var, Map<AbstractVariable, List<IDecisionVariable>> references) {
    IDatatype type = var.getDeclaration().getType();
    if (Reference.TYPE.isAssignableFrom(type)) {
        collectReference(var, var.getValue(), references);
    } else if (Container.TYPE.isAssignableFrom(type)) {
        Value value = var.getValue();
        if (value instanceof ContainerValue) { // NULLVALUE
            ContainerValue val = (ContainerValue) value;
            if (null != val) {
                for (int e = 0; e < val.getElementSize(); e++) {
                    collectReference(var, val.getElement(e), references);
                }
            }
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:24,代码来源:ConfigurationContextResolver.java

示例5: evaluate

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
@Override
public EvaluationAccessor evaluate(EvaluationAccessor operand, EvaluationAccessor[] arguments) {
    EvaluationAccessor result = null;
    Value oValue = operand.getValue();
    if (oValue instanceof ContainerValue) {
        ContainerValue cont = (ContainerValue) oValue;
        List<Value> res = new ArrayList<Value>();
        for (int i = cont.getElementSize() - 1; i >= 0; i--) {
            res.add(cont.getElement(i));
        }
        try {
            Value rValue = ValueFactory.createValue(oValue.getType(), res.toArray());
            result = ConstantAccessor.POOL.getInstance().bind(rValue, operand.getContext());
        } catch (ValueDoesNotMatchTypeException e) {
            operand.getContext().addErrorMessage(e);
        }
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:20,代码来源:SequenceOperations.java

示例6: visitValue

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
/**
 * Recursive method to find reference values pointing to a {@link AbstractVariable}.
 * @param value the content of a {@link ConstantValue}.
 * @see #visitConstantValue(ConstantValue)
 */
protected void visitValue(Value value) {
    if (null != value) {
        if (value instanceof ContainerValue) {
            ContainerValue containerValue = (ContainerValue) value;
            for (int i = 0; i < containerValue.getElementSize(); i++) {
                visitValue(containerValue.getElement(i));
            }
        } else if (value instanceof CompoundValue) {
            CompoundValue compoundValue = (CompoundValue) value;
            Compound cType = (Compound) compoundValue.getType();
            for (int i = 0; i < cType.getInheritedElementCount(); i++) {
                visitValue(compoundValue.getNestedValue(cType.getInheritedElement(i).getName()));
            }
        } else if (value instanceof ReferenceValue) {
            ReferenceValue refValue = (ReferenceValue) value;
            addVariable(refValue.getValue());
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:25,代码来源:AbstractVariableInConstraintFinder.java

示例7: checkSetContainer

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
/**
 * Checks a set container for equality against expected values.
 * 
 * @param expected the expected values
 * @param cValue the set container value
 * @return a message if checking fails, <b>null</b> if ok
 */
private static String checkSetContainer(Object[] expected, ContainerValue cValue) {
    String result = null;
    for (int i = 0; i < expected.length; i++) {
        String tmp = null;
        // may also be done in linear time - reuse complex value test
        for (int j = 0; j < cValue.getElementSize(); j++) {
            tmp = checkContainerValue(expected[i], cValue.getElement(j));
            if (null == tmp) {
                break;
            }
        }
        result = appendMessage(result, tmp);
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:23,代码来源:Utils.java

示例8: visitContainerValue

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
/**
 * Iterates through a container, extracts all referenced variables, and calls the visit method.
 * @param containerValue A container of references.
 */
private void visitContainerValue(ContainerValue containerValue) {
    for (int i = 0, end = containerValue.getElementSize(); i < end; i++) {
        ReferenceValue refValue = (ReferenceValue) containerValue.getElement(i);
        IDecisionVariable referencedVariable = extractVar(refValue);
        visitPipelineElement(referencedVariable);
    }
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:12,代码来源:PipelineVisitor.java

示例9: collectAlgorithmFromFamily

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
/**
 * Part of {@link #gatherAlgorithms()}, collects one (original) algorithm together with its mapped counterpart.
 * @param config The top level configuration, needed for querying {@link IDecisionVariable}s.
 * @param referencedOrgAlgos A container value containing reference values to algorithms.
 * @param runtimeAlgorithms A list of already mapped counterparts. Maybe <tt>null</tt>,
 *     in this case no mapping will be created.
 */
private void collectAlgorithmFromFamily(Configuration config, ContainerValue referencedOrgAlgos,
    List<IDecisionVariable> runtimeAlgorithms) {
    int lastIndex = null != referencedOrgAlgos ? referencedOrgAlgos.getElementSize() : 0;
    
    INameMapping nMapping = getNameMapping();
    for (int i = 0; i < lastIndex; i++) {
        ReferenceValue orgRef = (ReferenceValue) referencedOrgAlgos.getElement(i);
        IDecisionVariable orgAlgorithm = Utils.extractVariable(orgRef, config);
        String orgName = orgAlgorithm.getNestedElement(QmConstants.SLOT_NAME).getValue().getValue().toString();
        
        if (null != runtimeAlgorithms) {
            IDecisionVariable mappedAlgorithm = null;
            for (int j = 0; j < runtimeAlgorithms.size() && null == mappedAlgorithm; j++) { // due to deletion
                IDecisionVariable tmpAlgo = runtimeAlgorithms.get(j);
                if (tmpAlgo.getNestedElement(QmConstants.SLOT_NAME).getValue().getValue().equals(orgName)) {
                    mappedAlgorithm = tmpAlgo;
                    runtimeAlgorithms.remove(j);
                }
            }
            
            if (null != mappedAlgorithm) {
                algorithmMapping.put(orgName, mappedAlgorithm);
                String impl = NameMappingHelper.getAlgorithmImplName(nMapping, orgName);
                if (null != impl && !impl.equals(orgName)) {
                    algorithmMapping.put(impl, mappedAlgorithm);
                }
                allMappedVariables.add(mappedAlgorithm);
            }
        }
    }
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:39,代码来源:PipelineContentsContainer.java

示例10: extractVariables

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
/**
 * Extracts all referenced {@link IDecisionVariable}s from a container of {@link ReferenceValue}s.
 * @param refValues A value pointing other declarations, must not use an expression.
 * @param config The complete configuration form where to take the {@link IDecisionVariable}.
 * @return The referenced {@link IDecisionVariable}s or an empty list in case of any errors.
 */
public static List<IDecisionVariable> extractVariables(ContainerValue refValues, Configuration config) {
    List<IDecisionVariable> result = new ArrayList<IDecisionVariable>();
    for (int i = 0, end = refValues.getElementSize(); i < end; i++) {
        Value nestedValue = refValues.getElement(i);
        if (nestedValue instanceof ReferenceValue) {
            IDecisionVariable referrencedVar = extractVariable((ReferenceValue) nestedValue, config);
            if (null != referrencedVar) {
                result.add(referrencedVar);
            }
        }
    }
    
    return result;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:21,代码来源:Utils.java

示例11: projectFirstValue

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
/**
 * Returns the "first value" of <code>value</code>, i.e., <code>value</code> if <code>value</code> is not a 
 * container, the first value of the container else.
 * 
 * @param value the value to look into
 * @return the projected first value (may be <b>null</b>)
 */
private static Value projectFirstValue(Value value) {
    Value result = null;
    if (value instanceof ContainerValue) {
        ContainerValue cVal = (ContainerValue) value;
        if (cVal.getElementSize() > 0) {
            result = cVal.getElement(0);
        }
    } else {
        result = value;
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:20,代码来源:VariableValueCopierTest.java

示例12: assertFrozen

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
/**
 * Asserts that <code>value</code> is "frozen", i.e., if it is a container, all elements are considered to be
 * frozen and if it is not a container but a reference value, the referenced variable is frozen (regardless 
 * compound slots as the may be subject to freeze-buts).
 * 
 * @param cfg the configuration
 * @param value the value to assert the frozen state on
 */
private static void assertFrozen(net.ssehub.easy.varModel.confModel.Configuration cfg, Value value) {
    if (value instanceof ContainerValue) {
        ContainerValue cVal = (ContainerValue) value;
        for (int e = 0; e < cVal.getElementSize(); e++) {
            assertFrozen(cfg, cVal.getElement(e));
        }
    } else if (value instanceof ReferenceValue) {
        ReferenceValue refValue = (ReferenceValue) value;
        IDecisionVariable var = cfg.getDecision(refValue.getValue());
        Assert.assertNotNull(var);
        Assert.assertEquals(AssignmentState.FROZEN, var.getState());
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:22,代码来源:VariableValueCopierTest.java

示例13: flatten

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
/**
 * (Recursively) Flattens the given value if needed.
 * 
 * @param value the value to be flattened
 * @param result the flattened values (modified as a side effect)
 */
static void flatten(Value value, Collection<Value> result) {
    if (value instanceof ContainerValue) {
        ContainerValue cont = (ContainerValue) value;
        for (int i = 0, size = cont.getElementSize(); i < size; i++) {
            flatten(cont.getElement(i), result);
        }            
    } else {
        result.add(value);
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:17,代码来源:ContainerOperations.java

示例14: evaluate

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
public void evaluate(ContainerValue cont, Value value, List<Value> result) {
    for (int i = 0; i < cont.getElementSize(); i++) {
        Value elt = cont.getElement(i);
        if (!elt.equals(value)) {
            result.add(elt);
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:9,代码来源:SetOperations.java

示例15: addAll

import net.ssehub.easy.varModel.model.values.ContainerValue; //导入方法依赖的package包/类
/**
 * Adds all elements in <code>cont</code> to <code>result</code>.
 * 
 * @param cont the source of the elements
 * @param result the target (to be modified as a side effect)
 * @param done all elements considered so far
 */
private static final void addAll(ContainerValue cont, List<Value> result, HashSet<Value> done) {
    for (int i = 0; i < cont.getElementSize(); i++) {
        Value elt = cont.getElement(i);
        if (!done.contains(elt)) {
            result.add(elt);
            done.add(elt);
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:17,代码来源:SetOperations.java


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