本文整理汇总了Java中net.ssehub.easy.varModel.cst.Variable.getVariable方法的典型用法代码示例。如果您正苦于以下问题:Java Variable.getVariable方法的具体用法?Java Variable.getVariable怎么用?Java Variable.getVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.ssehub.easy.varModel.cst.Variable
的用法示例。
在下文中一共展示了Variable.getVariable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitVariable
import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的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);
}
}
}
}
示例2: visitVariable
import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的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);
}
}
}
}
示例3: visitVariable
import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
AbstractVariable var = variable.getVariable();
boolean needsFqn = false;
if (null != variable.getQualifier()) {
variable.getQualifier().accept(this);
appendOutput(".");
} else {
needsFqn = needsQualification(variable.getVariable());
}
if (needsFqn) {
appendOutput(var.getQualifiedName());
} else {
appendOutput(var.getName());
}
}
示例4: visitVariable
import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
AbstractVariable decl = variable.getVariable();
String name = decl.getName();
// Workaround for variable in assignments
if (decl.getParent().getParent() == null) {
append("$" + name);
} else if (decl.getParent().getClass().getSimpleName().equals("AttributeAssignment")
&& decl.getParent().getParent().getClass().getSimpleName().equals("Project")) {
append("$" + name);
} else if (decl.getParent().getClass().getSimpleName().equals("Compound")
|| (decl.getParent().getClass().getSimpleName().equals("AttributeAssignment")
&& decl.getParent().getParent().getClass().getSimpleName().equals("Compound"))) {
append(createCompoundAccess(decl));
} else {
append(createCompoundAccess(decl));
}
appendVariableAccess();
}
示例5: visitVariable
import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable var) {
AbstractVariable aVar = var.getVariable();
if (null != aVar) {
IDecisionVariable decVar = variables.get(aVar);
if (null != decVar) { // if found (already classified as runtime enact)
found.add(decVar);
}
}
}
示例6: mapLeaf
import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public ConstraintSyntaxTree mapLeaf(Variable variable) {
ConstraintSyntaxTree result = null;
AbstractVariable var = variable.getVariable();
for (int i = 0; null == result && i < decls.size(); i++) { // put into map???
if (decls.get(i) == var) {
result = new CompoundAccess(iter, var.getName());
}
}
return result;
}
示例7: visitVariable
import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
AbstractVariable var = variable.getVariable();
String name = var.getName();
AbstractVariable unQ = mapping.get(name);
boolean put;
if (null == unQ) {
put = true;
} else {
put = getImportPos(var) < getImportPos(unQ);
}
if (put) {
mapping.put(name, var);
}
}
示例8: visitingVariableTobeModified
import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
/**
* Method to process visiting the variable to be modified.
* @param variable Variable.
* @param variableName name of the variable.
*/
private void visitingVariableTobeModified(Variable variable, String variableName) {
boolean parentIsACompound = variable.getVariable().getParent().getClass().equals(Compound.class);
if ((variable.getVariable().getType().getTypeClass().equals(Compound.class))
&& !parentIsACompound) {
/**
* Modifying variable whose type is compound.
*/
modifyCompoundTypeVariable(variableName);
} else if (variable.getVariable().getParent().getClass().equals(Compound.class)) {
/**
* Modifying variable declared in a compound, i.e. variable whose parent is compound.
* Used for constraints expressed in a compound.
*/
modifyVariableDeclaredInCompound(variable);
} else {
if (variable.getVariable() instanceof Attribute) {
Attribute attr = (Attribute) variable.getVariable();
variableName = "$attr_" + attr.getElement().getName() + "_"
+ attr.getName();
}
if (DroolsVisitor.getDroolsClasseMap().get(variableName) == null) {
logger.info("null name " + variableName);
}
modifyingClassnr = DroolsVisitor.getDroolsClasseMap().get(variableName) / DroolsVisitor.THRESHOLD;
int thr = writeDroolsClassPattern(variableName);
modclass = "P" + thr;
rule += variableName;
dListAdder = variableName;
/*
* For future, in case only one group be used for all the rules for direct modification.
* Similar change needs to be made in the class DroolsConstraintVisitor suitably.
*
*
*/
patternList.add("!vList.contains(" + "\"" + variableName + "\") ");
}
}
示例9: constraintLogic
import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
/**
* Private method to write the constraint logic.
* Note: the param name can be extracted from variable, but here it is being passed
* for the sake of convenience.
* @param variable variable.
* @param name Name.
*/
private void constraintLogic(Variable variable, String name) {
String patternToAdd = "isDefined(" + "P." + name + ")";
boolean isDerivedType = variable.getVariable().getType().getTypeClass().equals(DerivedDatatype.class);
boolean isCompoundType = variable.getVariable().getType().getTypeClass().equals(Compound.class);
if (isDerivedType) {
logger.info("");
}
if (isCompoundType) {
patternToAdd = writeConstraintLogicForCompoundVariable(variable, name);
}
if ((variable.getVariable().getType().getTypeClass().equals(Compound.class))) {
notModification(name, patternToAdd, variable);
} else if (variable.getVariable().getParent().getClass().equals(Compound.class)) {
writeConstraintLogicForNestedElement(variable, name, isDerivedType);
} else {
if (variable.getVariable().getParent().getClass().equals(Project.class)) {
if (variable.getVariable() instanceof Attribute) {
Attribute attr = (Attribute) variable.getVariable();
name = "$attr_" + attr.getElement().getName() + "_"
+ attr.getName();
}
pattern.add(variableStatusChecker + "(" + "\"" + name + letSuffix + "\") ");
if (currentOp.equals("ivmlDef")) {
constraint += "dList, " + "\"" + name;
} else {
writeConstraintLogicForNonNestedElement(variable, name);
}
} else if (variable.getVariable().getParent().getClass().equals(Constraint.class)) {
// Mainly for the variables used in Let expressions. Parent is Constraint.
writeConstraintLogicForNonNestedElement(variable, name);
} else {
logger.info("name and parent " + name + " " + variable.getVariable().getParent().getClass());
ruleSupported = false;
}
}
}
示例10: constraintLogic
import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
/**
* Private method to write the constraint logic.
* Note: the param name can be extracted from variable, but here it is being passed
* for the sake of convenience.
* @param variable variable.
* @param name Name.
*/
private void constraintLogic(Variable variable, String name) {
String patternToAdd = "isDefined(" + "P." + name + ")";
boolean isDerivedType = variable.getVariable().getType().getTypeClass().equals(DerivedDatatype.class);
boolean isCompoundType = variable.getVariable().getType().getTypeClass().equals(Compound.class);
if (isDerivedType) {
logger.info("");
}
if (isCompoundType) {
patternToAdd = writeConstraintLogicForCompoundVariable(variable, name);
}
if ((variable.getVariable().getType().getTypeClass().equals(Compound.class))) {
notModification(name, patternToAdd, variable);
} else if (variable.getVariable().getParent().getClass().equals(Compound.class)) {
writeConstraintLogicForNestedElement(variable, name, isDerivedType);
} else {
if (variable.getVariable().getParent().getClass().equals(Project.class)) {
if (variable.getVariable() instanceof Attribute) {
Attribute attr = (Attribute) variable.getVariable();
name = "$attr_" + attr.getElement().getName() + "_"
+ attr.getName();
}
pattern.add(dListContains + "(" + "\"" + name + letSuffix + "\") ");
if (rhsCounter > 0) {
rhsPattern.add(dListContains + "(" + "\"" + name + letSuffix + "\") ");
}
if (currentOp.equals("ivmlDef")) {
constraint += "dList, " + "\"" + name;
} else {
writeConstraintLogicForNonNestedElement(variable, name);
}
} else if (variable.getVariable().getParent().getClass().equals(Constraint.class)) {
// Mainly for the variables used in Let expressions. Parent is Constraint.
writeConstraintLogicForNonNestedElement(variable, name);
} else {
logger.info("name and parent " + name + " " + variable.getVariable().getParent().getClass());
ruleSupported = false;
}
}
}
示例11: visitVariable
import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
AbstractVariable decl = variable.getVariable();
String name = decl.getName();
append("$" + name);
appendVariableAccess();
}
示例12: visitVariable
import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
if (null == variable.getVariable()) {
addError("link to variable declaration must not be <null>", variable, ValidationMessage.IS_NULL);
}
}
示例13: visitVariable
import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
AbstractVariable decl = variable.getVariable();
UsedProjectFinder.visitAbstractDeclaration(decl, usedProjects);
}
示例14: visitVariable
import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
@Override
public void visitVariable(Variable variable) {
AbstractVariable wrappedDeclaration = variable.getVariable();
variables.add(wrappedDeclaration);
}
示例15: constraintRetrievalTest
import net.ssehub.easy.varModel.cst.Variable; //导入方法依赖的package包/类
/**
* Test whether all constraints are retrieved correctly. At this moment only normal and internal constraints.
*/
@Test
public void constraintRetrievalTest() {
Project project = loadProject("ConstraintRetrievalCheck.ivml");
Configuration config = new Configuration(project, true);
ReasonerModel rModel = new ReasonerModel(config, null);
// Normal Constraints
List<ConstraintSyntaxTree> normalConstaintList
= new ArrayList<ConstraintSyntaxTree>(rModel.getNormalConstraintCount());
for (int i = 0; i < rModel.getNormalConstraintCount(); i++) {
normalConstaintList.add(rModel.getNormalConstraint(i));
}
printConstraints(normalConstaintList);
// Test normal constraints
System.out.println("Normal constraint count: " + normalConstaintList.size());
Assert.assertEquals("Number of normal constraints", 9, normalConstaintList.size());
//Internal Constraints
List<ConstraintSyntaxTree> internalConstaintList
= new ArrayList<ConstraintSyntaxTree>(rModel.getInternalConstraintCount());
for (int i = 0; i < rModel.getInternalConstraintCount(); i++) {
internalConstaintList.add(rModel.getInternalConstraint(i));
}
printConstraints(internalConstaintList);
// Test internal constraints
System.out.println("Internal constraint count: " + internalConstaintList.size());
Assert.assertEquals("Number of internal constraints", 3, internalConstaintList.size());
for (int i = 0; i < internalConstaintList.size(); i++) {
OCLFeatureCall constraint = (OCLFeatureCall) internalConstaintList.get(i);
Variable variable = (Variable) constraint.getOperand();
AbstractVariable decl = variable.getVariable();
IDatatype type = decl.getType();
Assert.assertEquals(DerivedDatatype.class, type.getClass());
}
// Test ReasonerDatatypes
int nDatatypes = 0;
Iterator<ReasonerDatatype> datatypeIterator = rModel.datatypeIterator();
while (datatypeIterator.hasNext()) {
nDatatypes++;
ReasonerDatatype customType = datatypeIterator.next();
if (customType instanceof EnumType) {
EnumType enumType = (EnumType) customType;
if (enumType.getName().equals("View")) {
Assert.assertEquals(0, enumType.getMinOrdinal());
Assert.assertEquals(2, enumType.getMaxOrdinal());
Assert.assertTrue(enumType.isValidOrdinal(1));
Assert.assertFalse(enumType.isValidOrdinal(enumType.getMaxOrdinal() + 1));
Assert.assertFalse(enumType.isValidOrdinal(enumType.getMinOrdinal() - 1));
} else if (enumType.getName().equals("ContentType")) {
Assert.assertEquals(1, enumType.getMinOrdinal());
Assert.assertEquals(8, enumType.getMaxOrdinal());
Assert.assertFalse(enumType.isValidOrdinal(3));
Assert.assertTrue(enumType.isValidOrdinal(4));
Assert.assertFalse(enumType.isValidOrdinal(5));
Assert.assertFalse(enumType.isValidOrdinal(enumType.getMaxOrdinal() + 1));
Assert.assertFalse(enumType.isValidOrdinal(enumType.getMinOrdinal() - 1));
}
} else {
CompoundType cmpType = (CompoundType) customType;
Assert.assertEquals(3, cmpType.getConstraintCount());
}
}
Assert.assertEquals(3, nDatatypes);
}