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


Java AbstractVariable.getParent方法代码示例

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


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

示例1: visitVariable

import net.ssehub.easy.varModel.model.AbstractVariable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
    AbstractVariable var = variable.getVariable();
    if (!defined.contains(var) && null == variable.getQualifier()) {
        // unqualified compound slot use in constraint in compound
        if (var instanceof DecisionVariableDeclaration) {
            IModelElement par = var.getParent();
            while (null != par && par instanceof AttributeAssignment) {
                par = par.getParent();
            }
            if (par instanceof Compound) {
                result.add((DecisionVariableDeclaration) var);
            }
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:17,代码来源:StaticAccessFinder.java

示例2: visitVariable

import net.ssehub.easy.varModel.model.AbstractVariable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
    AbstractVariable decl = variable.getVariable();
    if (nextVarIsMandatory) {
        IModelElement parent = decl.getParent();
        if (parent instanceof DerivedDatatype) {
            List<AbstractVariable> instances = getDeclarationsByType((DerivedDatatype) parent);
            if (null != instances) {
                for (int i = 0, end = instances.size(); i < end; i++) {
                    setImportanceForAllInstancesOfDeclaration(instances.get(i), Importance.MANDATORY);
                }
            }
        } else {
            String qName = context.hasParent() ? getSlotOfCompound(decl) : decl.getQualifiedName();
            context.elementFound();
            varContainer.setImportance(qName, Importance.MANDATORY);
            if (context.depth() > 0) {
                context.addParent(qName);
            }
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:23,代码来源:MandatoryDeclarationClassifier.java

示例3: freezeValues

import net.ssehub.easy.varModel.model.AbstractVariable; //导入方法依赖的package包/类
/**
 * Sets {@link AssignmentState#FROZEN} state to the given variables <code>var</code>. 
 * 
 * @param var the variable to be frozen
 * @param selector the freeze selector
 */
private void freezeValues(AbstractVariable var, IFreezeSelector selector) {
    if (var.isTopLevel() || var.getParent() instanceof AttributeAssignment) {
        IDecisionVariable frozenVariable = getDecision(var);
        
        // Check that variable was not deleted in the meanwhile
        if (null != frozenVariable) {
            frozenVariable.freeze(selector);
        }
    } else {
        IModelElement parent = var.getParent();
        System.out.println("Config freeze for nested variable not implemented: " + parent);
        //TODO SE: Handle nested Variables.
        //DecisionVariableDeclaration parent = (DecisionVariableDeclaration) frozenElement.getParent();
        //freezeNestedVariable(parent, frozenElement);
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:23,代码来源:Configuration.java

示例4: visitReferenceValue

import net.ssehub.easy.varModel.model.AbstractVariable; //导入方法依赖的package包/类
@Override
public void visitReferenceValue(ReferenceValue referenceValue) {
    appendOutput(REFBY);
    appendOutput(BEGINNING_PARENTHESIS);
    AbstractVariable referenced = referenceValue.getValue();
    if (null != referenced) {
        String containerPrefix = "";
        String containerPostfix = "";
        IModelElement iter = referenced.getParent();
        while (iter instanceof DecisionVariableDeclaration 
            && Container.TYPE.isAssignableFrom(((DecisionVariableDeclaration) iter).getType())) {
            containerPrefix = iter.getName() + "[" + containerPrefix;
            containerPostfix += "]";
            iter = iter.getParent();
        }
        appendOutput(containerPrefix + referenced.getName() + containerPostfix);
    } else {
        ConstraintSyntaxTree ex = referenceValue.getValueEx();
        if (null != ex) {
            ex.accept(this);
        }
    }
    appendOutput(ENDING_PARENTHESIS);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:25,代码来源:IVMLWriter.java

示例5: getDeclaringCompound

import net.ssehub.easy.varModel.model.AbstractVariable; //导入方法依赖的package包/类
/**
 * Returns the declaring compound type.
 * 
 * @param decl the variable declaration to return the compound parent for
 * @return the compound parent or <b>null</b> if there is none
 */
static Compound getDeclaringCompound(AbstractVariable decl) {
    IModelElement parent = decl.getParent();
    while (!(parent instanceof Project || parent instanceof Compound)) {
        parent = parent.getParent();
    }
    return parent instanceof Compound ? (Compound) parent : null;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:14,代码来源:EvaluationUtils.java

示例6: hasMandatoryTypeOrParent

import net.ssehub.easy.varModel.model.AbstractVariable; //导入方法依赖的package包/类
/**
 * Checks whether the given declaration is mandatory because of its type, or while the parent specifies that all
 * nested elements shall be mandatory. Part of {@link #isMandatory(IDecisionVariable)}
 * and {@link #isMandatory(AbstractVariable)}.
 * @param declaration The declaration to check.
 * @return <tt>true</tt> if the user should specify a value. This is only a heuristic value.
 */
private boolean hasMandatoryTypeOrParent(AbstractVariable declaration) {
    boolean isMandatory = false;
    // Test mandatory by datatype, e.g., CP.slotName
    IModelElement parent = declaration.getParent();
    if (!(parent instanceof Project)) {
        String qName = parent.getQualifiedName() + "::" + declaration.getName();
        Importance importance = importances.get(qName);
        isMandatory = Importance.MANDATORY == importance;
    }
    return isMandatory;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:19,代码来源:VariableContainer.java

示例7: createDecision

import net.ssehub.easy.varModel.model.AbstractVariable; //导入方法依赖的package包/类
/**
 * Creates a visible decision in this configuration. The declaration must be on top-level and not created before.
 * 
 * @param decl the declaration to create the decision for
 * @return the created decision variable, may be <b>null</b> if the conditions are not met
 * @throws ConfigurationException in case that creating the variable failed
 */
public IDecisionVariable createDecision(AbstractVariable decl) throws ConfigurationException {
    // we need dynamic modification capabilities!
    IDecisionVariable result = null;
    if (decl.getParent() instanceof Project && null == getDecision(decl)) {
        result = createDecision(decl, true);
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:16,代码来源:Configuration.java

示例8: getParentNames

import net.ssehub.easy.varModel.model.AbstractVariable; //导入方法依赖的package包/类
@Override
public String getParentNames(AbstractVariable variable) {
    String result = null;
    if (variable.getParent() != null) {
        result = variable.getParent().getQualifiedName();
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:9,代码来源:DisplayNameProvider.java

示例9: isOverriddenSlot

import net.ssehub.easy.varModel.model.AbstractVariable; //导入方法依赖的package包/类
/**
 * Returns whether <code>decl</code> is an overridden slot.
 * 
 * @param decl the declaration of the slot to search for
 * @return <code>true</code> if overridden, <code>false</code> else
 */
static boolean isOverriddenSlot(AbstractVariable decl) {
    boolean overridden = false;
    IModelElement iter = decl.getParent(); 
    // find declaring compound
    while (null != iter && !(iter instanceof Compound)) {
        iter = iter.getParent();
    }
    if (iter instanceof Compound) {
        overridden = countSlots((Compound) iter, decl.getName(), true) > 1;
    }
    return overridden;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:19,代码来源:ReasoningUtils.java

示例10: createCompoundAccess

import net.ssehub.easy.varModel.model.AbstractVariable; //导入方法依赖的package包/类
/**
 * Handles unqualified variable names inside of a compound.
 * @param decl The nested declaration.
 * @return A string in form of: <tt>$var.get("decl.getName()")</tt>.
 */
private String createCompoundAccess(AbstractVariable decl) {
    String result = null;
    // Workaround attribute assignment nesting in compounds
    if (decl.getParent() == type || decl.getParent().getParent() == type) {
        result = variableName + ".get(\"" + decl.getName() + "\")";
    } else {
        AbstractVariable parent = (AbstractVariable) decl.getParent();
        result = createCompoundAccess(parent) + ".get(\"" + decl.getName() + "\")";
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:17,代码来源:CompoundConstraintTranslator.java

示例11: analyzeEvaluationResult

import net.ssehub.easy.varModel.model.AbstractVariable; //导入方法依赖的package包/类
/**
 * Records information about the evaluation result, failed evaluation messages.
 * 
 * @param constraint the constraint to record the actual messages for
 */
private void analyzeEvaluationResult(Constraint constraint) {
    if (evaluator.constraintFailed()) {
        FailedElementDetails failedElementDetails = new FailedElementDetails();
        failedElementDetails.setProblemPoints(new HashSet<IDecisionVariable>(usedVariables));
        failedElementDetails.setProblemConstraintPart(getFailedConstraintPart());
        failedElementDetails.setProblemConstraint(constraint);
        failedElementDetails.setErrorClassifier(ReasoningErrorCodes.FAILED_CONSTRAINT);
        failedElements.addProblemConstraint(constraint, failedElementDetails);
        if (Descriptor.LOGGING) {
            LOGGER.debug("Failed constraint: " + toIvmlString(constraint));
            printModelElements(config, "constraint resolved");
            printProblemPoints(usedVariables);
        }
    } else if (evaluator.constraintFulfilled()) {
        failedElements.removeProblemConstraint(constraint);
        if (Descriptor.LOGGING) {
            LOGGER.debug("Constraint fulfilled: " + toIvmlString(constraint));
        }
    }
    // must be done always, constraints -> undefined may cause illegal variable assignments as side effect
    for (int j = 0; j < evaluator.getMessageCount(); j++) {
        Message msg = evaluator.getMessage(j);
        AbstractVariable var = msg.getVariable();
        if (var != null) {
            // no local variable, i.e., defined for/within user-defined operation or within constraint
            if (!(var.getParent() instanceof OperationDefinition) && !(var.getParent() instanceof Constraint)) {
                usedVariables.clear();
                usedVariables.add(msg.getDecision());
                FailedElementDetails failedelementDetails = new FailedElementDetails();
                failedelementDetails.setProblemPoints(new HashSet<IDecisionVariable>(usedVariables));
                // due to NULL result if failed assignment
                failedelementDetails.setProblemConstraintPart(constraint.getConsSyntax());
                failedelementDetails.setProblemConstraint(constraint);
                failedelementDetails.setErrorClassifier(ReasoningErrorCodes.FAILED_REASSIGNMENT);
                failedElements.addProblemVariable(var, failedelementDetails);
                if (Descriptor.LOGGING) {
                    LOGGER.debug("Assigment error: " + evaluator.getMessage(j).getVariable());
                    printProblemPoints(usedVariables);
                }
            }
        } 
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:49,代码来源:Resolver.java


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